1、下载head插件源码
https://github.com/mobz/elasticsearch-head
2、下载nodejs
nodejs官网下载地址https://nodejs.org/dist/
wget https://nodejs.org/dist/v6.9.2/node-v6.9.2-linux-x64.tar.xz
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 –vv6.9.2 # npm –v3.10.9
4、安装grunt
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
原文地址:http://kbson.blog.51cto.com/5359697/1882576