參考:https://www.cnblogs.com/Onlywjy/p/Elasticsearch.htmlhtml
Elasticsearch6.0不能使用命令直接安裝head插件node
修改配置文件/etc/elasticsearch/elasticsearch.yml增長參數python
# 增長參數,使head插件能夠訪問es http.cors.enabled: true http.cors.allow-origin: "*"
下載head插件linux
wget https://github.com/mobz/elasticsearch-head/archive/master.zip
解壓至/opt目錄下git
安裝nodegithub
wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz tar -zxvf node-v4.4.7-linux-x64.tar.gz
修改環境變量/etc/profile添加web
export NODE_HOME=/opt/node-v4.4.7-linux-x64 export PATH=$PATH:$NODE_HOME/bin export NODE_PATH=$NODE_HOME/lib/node_modules
設置生效npm
source /etc/profile
安裝gruntapp
cd /opt/elasticsearch-head-master npm install -g grunt-cli
檢查是否安裝成功cors
修改head插件源碼/opt/elasticsearch-head-master/Gruntfile.js
PS:hostname是新增的,不要忘記原有的true後面加,符號
修改鏈接地址/opt/elasticsearch-head-master/_site/app.js
下載運行head必要的文件(放置在文件夾/tmp下)
cd /tmp wget https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-linux-x86_64.tar.bz2 yum -y install bzip2
運行head
cd /opt/elasticsearch-head-master npm install
後臺啓動
grunt server &
web頁面驗證