1、安裝Node
由于head插件本質上還是一個nodejs的工程,是以需要安裝node,使用npm來安裝依賴的包。
1.1 下載下傳解壓
wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-x64.tar.xz
xz –d node-v6.10.2-linux-x64.tar.xz
tar xvf node-v6.10.2-linux-x64.tar
mv node-v6.10.2-linux-x64 /usr/local/node
1.2 配置并生效
vim /etc/profile
export NODE_HOME=/usr/local/node
export PATH=$PATH:$NODE_HOME/bin
source /etc/profile
1.3 檢視版本驗證
1.4 安裝cnpm(這一步可有可無)
cnpm是淘寶國内npm鏡像,比npm速度會快一點
npm install -g cnpm --registry=https://registry.npm.taobao.org
2、下載下傳head插件
如果未安裝git ,則先安裝git工具
yum install –y git
git clone https://github.com/mobz/elasticsearch-head.git
3、安裝grunt
cd elasticsearch-head
npm install -g grunt --registry=https://registry.npm.taobao.org
4、安裝插件
npm install
在elasticsearch-head目錄下node_modules/grunt下如果沒有grunt二進制程式,需要執行:
npm install grunt --save
5、修改配置 elasticsearch-head下Gruntfile.js檔案
修改connect配置節點
修改 _site/app.js 修改http://localhost:9200字段到本機ES端口與IP
6、修改 elasticsearch配置檔案
修改elasticsearch.yml檔案加入以下内容:
#是否支援跨域
http.cors.enabled: true
#*表示支援所有域名
http.cors.allow-origin: "*"
7、啟動head插件服務(背景運作)
/elasticsearch-head/node_modules/grunt/bin/grunt server &
或者用npm運作
npm run start
8、驗證是否已安裝
如下圖說明安裝OK