安裝前需要先安裝nodejs
1、下載安裝Node.js
官方地址:[https://nodejs.org/en/](https://nodejs.org/en/) 或 [https://nodejs.org/zh-cn/](https://nodejs.org/zh-cn/)
a.解壓
tar -xvf node-v10.6.0-linux-x64.tar.xz
重命名文件夾
mv node-v10.6.0-linux-x64 nodejs
b.通過(guò)建立軟連接變?yōu)槿? ln -s /usr/local/application/nodejs/bin/npm /usr/local/bin/
ln -s /usr/local/application/nodejs/bin/node /usr/local/bin/
c.配置
vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
d.檢查是否安裝成功,命令:node-v npm -v
2、下載安裝head
下載地址:[https://github.com/mobz/elasticsearch-head](https://github.com/mobz/elasticsearch-head)
下載完畢后可以安裝在相應(yīng)(elk)目錄下
在elk目錄下執(zhí)行:
npm install
在head目錄下安裝grunt:
cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org
安裝插件
npm install
在elasticsearch-head目錄下node_modules/grunt下如果沒(méi)有g(shù)runt二進(jìn)制程序,需要執(zhí)行:
npm install grunt --save
修改配置 elasticsearch-head下Gruntfile.js文件
修改connect配置節(jié)點(diǎn)
connect: {
server: {
options: {
hostname:'192.168.1.10'
port: 9100,
base: '.',
keepalive: true
}
}
}
修改 _site/app.js 修改http://localhost:9200字段到本機(jī)ES端口與IP
修改 elasticsearch配置文件
修改elasticsearch.yml文件加入以下內(nèi)容:
# 是否支持跨域
http.cors.enabled: true
# *表示支持所有域名
http.cors.allow-origin: "*"
啟動(dòng)head插件服務(wù)(后臺(tái)運(yùn)行)
/elasticsearch-head/node_modules/grunt/bin/grunt server &
瀏覽器打開(kāi)訪問(wèn)http://ip:9100