CentOS7安装elasticsearch-head

今天在安装elasticsearch-head的时候,需要用到npm环境,因此通过yum安装了一个npm,这里把遇到的问题和坑都记录一下。
elasticsearch-head的github地址:https://github.com/mobz/elasticsearch-head

1、操作系统版本

[root@elk01 ~]# cat /etc/redhat-release 
CentOS Linux release 7.3.1611 (Core)

2、安装启动elasticsearch-head

方法1:通过源码编译安装

#安装epel源
yum -y install epel-release

#安装npm、git客户端以及openssl
yum -y install npm git openssl

#克隆elasticsearch项目到本地
git clone git://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head

#安装项目,这个过程需花费大量时间
npm install

#安装完成后,会生成一个node_modes的文件夹
[root@elk01 elasticsearch-head]# ls -ld node_modules/
drwxr-xr-x 374 root root 12288 Mar  5 23:38 node_modules/

#启动
npm run start &

方法2:通过docker容器启动

#安装docker服务
yum -y install docker

#启动容器
docker run -p 9100:9100 mobz/elasticsearch-head:5

3、elasticsearch配置

需要在elasticsearch配置文件里面添加支持http访问的参数

vim /etc/elasticsearch/elasticsearch.yml

#在文件末尾增加如下内容
http.cors.enabled: true http.cors.allow-origin: "*"

4、浏览器访问

两种方法任选一种,安装完成后即可通过浏览器进行访问

http://localhost:9100/

安装过程中遇到的问题:

执行命令`npm install`的时候遇到报错如下:

npm: relocation error: npm: symbol SSL_set_cert_cb, version libssl.so.10 not defined in file libssl.so.10 with link time reference

这是由于没有安装openssl导致的,因此需要事先安装好openssl!

猜你喜欢

转载自www.cnblogs.com/liuguangjiji/p/10480719.html
今日推荐