原文地址:http://blog.youkuaiyun.com/qq942477618/article/details/53637817
1、下载head插件源码
https://github.com/mobz/elasticsearch-head
由于elasticsearch5.0版本变化较大,目前elasticsearch5.0 暂时不支持直接安装,但是head作者提供了另一种安装方法。
2、下载nodejs
nodejs官网下载地址https://nodejs.org/dist/
3、配置node环境变量
xz –d node-v6.9.2-linux-x64.tar.xz
tar –xvf node-v6.9.2-linux-x64.tar
mv node-v6.9.2-linux-x64 /data/PRG/node
vim /etc/profile
export NODE_HOME=/data/PRG/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
# node –v
v6.9.2
# npm –v
3.10.9
4、安装grunt
如果生产环境无法联网在线安装grunt,可以找一台能联网的主机配置好node,安装好grunt后将elasticsearch-head目录下的node_models打包上传
cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org
修改head目录下的Gruntfile.js配置,head默认监听127.0.0.1
# vim Gruntfile.js
hostname: '0.0.0.0',
5、elasticsearch配置允许跨域访问
修改elasticsearch配置文件elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
6、重启elasticsearch,并启动node
cd elasticsearch-head
node_modules/grunt/bin/grunt server