在elasticsearch-head源码目录中,执行npm install:
1 npm install
在运行npm install时,可能会存在Head插件phantomjs权限问题:
1 [root@localhost elasticsearch-head]# npm install 2 phantomjs-prebuilt@2.1.16 install /usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt 3 node install.js 4 PhantomJS not found on PATH 5 Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 6 Verified checksum of previously downloaded file 7 Extracting tar contents (via spawned process) 8 Removing /usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom 9 Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1513568757772/phantomjs-2.1.1-linux-x86_64 -> /usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom 10 Phantom installation failed { Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1513568757772/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom' 11 errno: -13, 12 code: 'EACCES', 13 syscall: 'link', 14 path: '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1513568757772/phantomjs-2.1.1-linux-x86_64', 15 dest: '/usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom' } Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1513568757772/phantomjs-2.1.1-linux-x86_64' -> '/usr/local/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom' 16 npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression 17 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): 18 npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) 19 20 npm ERR! code ELIFECYCLE 21 npm ERR! errno 1 22 npm ERR! phantomjs-prebuilt@2.1.16 install: `node install.js` 23 npm ERR! Exit status 1 24 npm ERR! 25 npm ERR! Failed at the phantomjs-prebuilt@2.1.16 install script. 26 npm ERR! This is probably not a problem with npm. There is likely additional logging output above. 27 28 npm ERR! A complete log of this run can be found in: 29 npm ERR! /root/.npm/_logs/2017-12-18T03_46_03_878Z-debug.log
解决方法,在npm install命令后加 -g 参数:
1 npm install -g
最后,在elasticsearch-head源代码目录下启动nodejs,运行 grunt server。
运行成功后,访问 http://localhost:9100 网站,即可看到elasticsearch的相关信息: