借鉴:原文 (在基础上改正,添加报错解决办法)
下载elasticsearch-head
下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。
一、安装nodejs
curl -sL -o /etc/yum.repos.d/khara-nodejs.repo https://copr.fedoraproject.org/coprs/khara/nodejs/repo/epel-7/khara-nodejs-epel-7.repo
yum install -y nodejs nodejs-npm
再执行如下命令:
node -v
npm -v
结果:
[root@iZuf6g56n6ff2af11jmkfeZ plugins]# node -vv6.12.2
[root@iZuf6g56n6ff2af11jmkfeZ plugins]# npm -v
5.6.0
二、安装grunt
npm install -g grunt-cli
npm install grunt
grunt -version
版本查看结果:
[root@iZuf6g56n6ff2af11jmkfeZ plugins]# grunt -version
grunt-cli v1.2.0
grunt v1.0.1
补充报错解决办法:npm: relocation error: npm: symbol SSL_set_cert_cb, version libssl.so.10 not defined in file libssl.
1、关闭npm的https
npm config set strict-sslfalse
2、设置npm的获取地址
npm config set registry "http://registry.npmjs.org/"
三、npm安装依赖
到elasticsearch-head-master目录下,运行命令:
npm install
如果速度较慢或者安装失败,可以使用国内镜像:
npm install -g cnpm --registry=https://registry.npm.taobao.org
四、修改Elasticsearch配置文件
编辑elasticsearch-5.1.1/config/elasticsearch.yml,加入以下内容:
http.cors.enabled: true
http.cors.allow-origin: "*"
五、修改Gruntfile.js
打开elasticsearch-head-master/Gruntfile.js,找到下面connect属性,新增hostname: '0.0.0.0’'
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
六、启动elasticsearch-head
在elasticsearch-head-master/目录下,运行启动命令:
grunt server
访问http://192.168.1.124:9100/
七、后台启动elasticsearch-head
后台启动grunt server命令;
nohup grunt server &exit
如果想关闭head插件,使用Linux查找进程命令:
ps aux|grep head
结束进程:
kill进程号