一:安装Git(如果未安装)
1, yum install git
2, git --version #查看版本
二:安装node(如果未安装)
https://blog.csdn.net/zhuwei_clark/article/details/89521181
三:安装grunt(如果未安装,head插件的启动使用grunt)
npm install -g grunt-cli #安装grunt命令行工具grunt-cli
npm install grunt --save-dev #安装grunt及其插件
grunt -version #查看安装版本情况
四:下载并安装elasticsearch-head
# 选择一个目录下执行下面命令,别把head插件clone后放到 elasticsearch的plugins目录下,否则会报错
git clone git://github.com/mobz/elasticsearch-head.git #git下载
cd elasticsearch-head #进入目录
npm install # 如果npm使用很多错误,尝试使用cnpm
npm install grunt --save #安装grunt到模块中并保存
会出现以下错误
>> Local Npm module "grunt-contrib-clean" not found. Is it installed?
>> Local Npm module "grunt-contrib-concat" not found. Is it installed?
>> Local Npm module "grunt-contrib-watch" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
>> Local Npm module "grunt-contrib-copy" not found. Is it installed?
>> Local Npm module "grunt-contrib-jasmine" not found. Is it installed?
Warning: Task "connect:server" not found. Use --force to continue.
补全安装插件
npm install grunt-contrib-clean --registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat --registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch --registry=https://registry.npm.taobao.org
npm install grunt-contrib-connect --registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy --registry=https://registry.npm.taobao.org
npm -g install phantomjs-prebuilt@2.1.16 --ignore-script
npm install grunt-karma@2.0.0 --registry=https://registry.npm.taobao.org
npm install http-proxy@1.16.x --registry=https://registry.npm.taobao.org
npm install karma@1.3.0 --registry=https://registry.npm.taobao.org
npm install grunt-contrib-jasmine@1.0.3 --registry=https://registry.npm.taobao.org
查看是否还存在error信息
npm audit fix
启动:
grunt server
这个是前台启动,端口是9100
后台启动的话,我这里采用的是supervisord托管进程,配置如下,也可以使用nohup grunt server
[program:eh]
directory = /usr/local/elasticsearch-head
command=grunt server
autostart=true
autorestart=true
user=root
numprocs=1
redirect_stderr=true
stdout_logfile=/data/logs/eh.log
更新:
supervisorctl update
使用IP:9100访问
配置成功