centos7 ELK安装head工具

需要安装nodejs 和head
1、nodejs下载安装

 

创建安装目录
在这里,把安装目录放在/opt/nodejs中
mkdir -p /opt/nodejs
wget https://nodejs.org/dist/v16.13.0/node-v16.13.0-linux-x64.tar.xz
分两步解压
xz -d node-v16.13.0-linux-x64.tar.xz
tar -xvf node-v16.13.0-linux-x64.tar
设置环境变量
在/etc/profile 文件中加入以下内容:
export NODEJS_HOME=/opt/nodejs/node-v16.13.0-linux-x64/bin
export PATH=$NODEJS_HOME:$PATH

使环境变量生效 source /etc/profile

测试安装
[root@jenkins ~]# node -v
v16.13.0
[root@jenkins ~]# npm version
{
  npm: '8.1.0',
  node: '16.13.0',
  v8: '9.4.146.19-node.13',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.17.2',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1l+quic',
  cldr: '39.0',
  icu: '69.1',
  tz: '2021a',
  unicode: '13.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}

 

2、安装 grunt
elasticsearch-head插件需要使用grunt,以下是安装grunt的命令。
[root@jenkins ~]# npm install -g grunt-cli

 

3、下载elasticsearch-head

下载地址:https://github.com/mobz/elasticsearch-head这里,直接点下载zip包。下载的文件为:elasticsearch-head-master.zip
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
解压文件:如果没有unzip命令,使用以下命令安装:
unzip elasticsearch-head-master.zip
sudo mv elasticsearch-head-master /opt/elasticsearch/elasticsearch-6.5.3/

安装pathomjs

在elasticsearch-head的目录中,运行以下命令进行安装:
cd /opt/elasticsearch/elasticsearch-6.5.3/elasticsearch-head-master/
sudo yum install bzip2 -y
npm install
修改elasticsearch配置
修改elasticsearch中elasticsearch.yml配置文件,增加以下内容:
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type

测试

启动elasticsearch-head:
[elasticsearch@server01 elasticsearch-head]$ grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
默认端口为:9100

 

 

  

  

 

  

 

  

  

  

 

 

posted @ 2021-11-12 16:31  苍茫宇宙  阅读(120)  评论(0编辑  收藏  举报