基于elasticsearch6.5.1安装head插件

1.因为head是一个用于管理Elasticsearch的web前端插件,该插件在es5版本以后采用独立服务的形式进行安装使用(之前的版本可以直接在es安装目录中直接安装),因为需要安装nodejs、npm。所有的机器都要有同样的配置步骤。

sudo yum -y install nodejs

结果如下:

2.下载yum源

参考来源:http://www.cnblogs.com/fps2tao/p/9956139.html

sudo rpm -ivh https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

结果:

3.更新node.js的yum源,这里选择8.x。注意:此处需要切换为root 用户,sudo也不行。非root用户会报错。

curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -

非root用户报错:

 

4.yum安装node.js

sudo yum install -y nodejs

5.查看Node.js和npm版本

node -v
npm -v

结果:

6.下载elasticsearch-head

https://github.com/mobz/elasticsearch-head

7.解压后,在该目录下执行

npm install

结果报错:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the phantomjs-prebuilt@2.1.16 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/2018-12-07T01_27_30_244Z-debug.log
[zuowei.zhang@master elasticsearch-head]$ 
[zuowei.zhang@master elasticsearch-head]$ npm install phantomjs-prebuilt@2.1.16--ignore-scripts
npm ERR! code ETARGET
npm ERR! notarget No matching version found for phantomjs-prebuilt@2.1.16--ignore-scripts
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/zuowei.zhang/.npm/_logs/2018-12-07T01_29_33_475Z-debug.log

对于此错误,参考https://blog.csdn.net/z1035075390/article/details/73247412的做法:

npm install phantomjs-prebuilt@2.1.16 --ignore-scripts

 没有报错后,再次执行npm install

[zuowei.zhang@master elasticsearch-head]$ npm install
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 8 packages from 13 contributors and audited 1853 packages in 10.341s
found 23 vulnerabilities (17 low, 6 high)
  run `npm audit fix` to fix them, or `npm audit` for details

8.解决第一个warn:npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression

参考https://www.cnblogs.com/shengulong/p/6224908.html的解决办法,

9.剩下的两个WARN,参考https://blog.csdn.net/aerchi/article/details/54582891的解释,忽略即可。

10.run `npm audit fix` to fix them, or `npm audit` for details

参考提示,执行。

11.修改elasticsearch.yml,在末尾添加

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

12.修改elasticsearch-head目录下的Gruntfile.js。修改服务监听地址(增加hostname属性,将其值设置为*)

13.修改elasticsearch-head/_site目录下的app.js

14.在elasticsearch-head目录下执行:

npm run start

结果:

15.查看端口:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值