安装前需要先安装nodejs
1、下载安装Node.js
官方地址:[https://nodejs.org/en/](https://nodejs.org/en/) 或 [https://nodejs.org/zh-cn/](https://nodejs.org/zh-cn/)
a.解压
tar -xvf node-v10.6.0-linux-x64.tar.xz
重命名文件夹
mv node-v10.6.0-linux-x64 nodejs
b.通过建立软连接变为全局
ln -s /usr/local/application/nodejs/bin/npm /usr/local/bin/
ln -s /usr/local/application/nodejs/bin/node /usr/local/bin/
c.配置
vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
d.检查是否安装成功,命令:node-v npm -v
2、下载安装head
下载地址:[https://github.com/mobz/elasticsearch-head](https://github.com/mobz/elasticsearch-head)
下载完毕后可以安装在相应(elk)目录下
在elk目录下执行:
npm install
在head目录下安装grunt:
cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org
安装插件
npm install
在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行:
npm install grunt --save
修改配置 elasticsearch-head下Gruntfile.js文件
修改connect配置节点
connect: {
server: {
options: {
hostname:'192.168.1.10'
port: 9100,
base: '.',
keepalive: true
}
}
}
修改 _site/app.js 修改http://localhost:9200字段到本机ES端口与IP
修改 elasticsearch配置文件
修改elasticsearch.yml文件加入以下内容:
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
启动head插件服务(后台运行)
/elasticsearch-head/node_modules/grunt/bin/grunt server &
浏览器打开访问http://ip:9100
网友评论