Centos7安装elasticsearch-head插件

1、安装elasticsearch

2、安装node

下载地址https://nodejs.org/en/download/

xz -d xx.tar.xz
tar -xvf xx.tar

测试安装成功

[root@localhost tools]# cd node-v10.15.0-linux-x64/bin
[root@localhost bin]# ./node -v
v10.15.0

安装成功,现在 node 和 npm 还不能全局使用,做个链接

ln -s /home/tools/node-v10.15.0-linux-x64/bin/node /usr/local/bin/node
ln -s /home/tools/node-v10.15.0-linux-x64/bin/npm /usr/local/bin/npm

可以在任何目录下执行 node 和 npm 命令

[root@localhost tools]# node -v
v10.15.0

3、安装elasticsearch-head

下载地址https://github.com/mobz/elasticsearch-head
不能将elasticsearch-head放到elasticsearch文件夹下
到elasticsearch-head目录下, 执行npm install 命令

[root@localhost tools]# cd elasticsearch-head/
[root@localhost elasticsearch-head]# npm install

报错

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-01-16T06_03_42_778Z-debug.log

执行

npm install [email protected] --ignore-scripts
npm run start

打开http://localhost:9100/
本地9100被占用,进入elasticsearch-head下Gruntfile.js文件,修改启动端口9111,默认是9100
修改elasticsearch配置elastichsearch.yml
添加

http.cors.enabled: true
http.cors.allow-origin: "*"

重启elasticsearch
启动elasticsearch-head

npm run start &

Centos7安装elasticsearch-head插件_第1张图片

你可能感兴趣的:(Elasticsearch)