一、下載安裝包
1,下載elasticsearch-head
https://github.com/mobz/elasticsearch-head
2荠商,下載node.js二進(jìn)制版寂恬;安裝方式見? ? 【centos6.5源碼編譯安裝nodejs】
https://nodejs.org/en/download/current/
二,安裝grunt
安裝好elasticsearch ?和node.js之后 ?安裝grunt
命令: npm install -g grunt-cli
輸入“grunt”命令 驗(yàn)證
結(jié)果:?
? ? ? ? ? ? 參考:http://blog.csdn.net/yuchen_0515/article/details/48653061
? ? ? ? ? ? 官網(wǎng):http://gruntjs.com/getting-started
三莱没、npm 安裝依賴
到elasticsearch-head-master目錄下初肉,運(yùn)行命令:
# npm install? 建議耐心等待或者? 執(zhí)行npm install grunt --save-dev
安裝過程中如果出現(xiàn)如下錯(cuò)誤,不要管饰躲,繼續(xù)往下走:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression
npm ERR! Linux 2.6.32-504.el6.x86_64
npm ERR! argv "/opt/soft/node/bin/node" "/opt/soft/node/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm? v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! phantomjs-prebuilt@2.1.14 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phantomjs-prebuilt@2.1.14 install script 'node install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the phantomjs-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!? ? node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!? ? npm bugs phantomjs-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!? ? npm owner ls phantomjs-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!? ? /usr/local/elk/elasticsearch-head-master/npm-debug.log
如果速度較慢或者安裝失敗牙咏,可以使用國內(nèi)鏡像:(執(zhí)行這個(gè)命令成功后往下走還是會報(bào)錯(cuò))
npm install -g cnpm --registry=https://registry.npm.taobao.org
四、修改Elasticsearch配置文件
編輯elasticsearch-5.1.1/config/elasticsearch.yml,加入以下內(nèi)容:
http.cors.enabled: true
http.cors.allow-origin: "*"
五嘹裂、修改Gruntfile.js
打開elasticsearch-head-master/Gruntfile.js妄壶,找到下面connect屬性,新增hostname: ‘0.0.0.0’:
? connect: {
? ? ? ? ? server: {
? ? ? ? ? ? ? ? ? ? options: {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? hostname: '0.0.0.0',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? port: 9100,
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? base: '.',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? keepalive: true
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? }
六寄狼、啟動elasticsearch-head
在elasticsearch-head-master/目錄下丁寄,運(yùn)行啟動命令:
# grunt server
如果報(bào)如下錯(cuò)誤,這說明 第三步:npm 安裝依賴 出了問題 ? 重新耐心 npm install
# grunt server
grunt-cli: The grunt command line interface (v1.2.0)
Fatal error: Unable to find local grunt.
If you're seeing this message, grunt hasn't been installed locally to
your project. For more information about installing and configuring grunt,
please see the Getting Started guide:
http://gruntjs.com/getting-started
訪問9100端口: