下载Node.js
[root@localhost soft]# cd /opt/soft/
[root@localhost soft]# xz -d /usr/local/src/node-v8.11.3-linux-x64.tar.xz
[root@localhost soft]# tar -xvf /usr/local/src/node-v8.11.3-linux-x64.tar
检查Node.js安装成功
[root@localhost soft]# cd node-v8.11.3-linux-x64/bin/
[root@localhost bin]# ./node -v
返回
v8.11.3
[root@localhost bin]# ./npm -v
返回
/usr/bin/env: node: 没有那个文件或目录
[root@localhost bin]# vim /etc/profile
#node env
export NODE_HOME=/opt/soft/node-v8.11.3-linux-x64/
export NODE_PATH=$NODE_HOME/lib/node_modules
export PATH=$PATH:$JAVA_HOME/bin:$NODE_HOME/bin
[root@localhost bin]# source /etc/profile
[root@localhost bin]# ./node -v
v8.11.3
[root@localhost bin]# ./npm -v
5.6.0
下载elasticsearch-head
[root@localhost bin]# cd /opt/soft/elasticsearch-head-master/
#使用淘宝的镜像库进行下载
npm install -g cnpm --registry=https://registry.npm.taobao.org
[root@localhost elasticsearch-head-master]# npm i -g npm
/opt/soft/node-v8.11.3-linux-x64/bin/npm -> /opt/soft/node-v8.11.3-linux-x64/lib/node_modules/npm/bin/npm-cli.js
/opt/soft/node-v8.11.3-linux-x64/bin/npx -> /opt/soft/node-v8.11.3-linux-x64/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 282 packages, removed 363 packages and updated 41 packages in 211.606s
cnpm install
成功后当前目录多了一个node_modules文件夹
drwxr-xr-x. 374 root root 28672 7月 18 14:31 node_modules
[root@localhost elasticsearch-head-master]# vim Gruntfile.js
connect: {
server: {
options: {
port: 9100,
base: '.',
keepalive: true,
hostname: '*'
}
}
}
[root@localhost elasticsearch-head-master]# vim elasticsearch-6.3.1/config/elasticsearch.yml
# 末尾添加
http.cors.enabled: true
http.cors.allow-origin: "*"
启动
[root@localhost elasticsearch-head-master]# npm run start
[root@localhost ~]# cd /opt/soft/elasticsearch-6.3.1/
[root@localhost elasticsearch-6.3.1]# su elastic
[elastic@localhost elasticsearch-6.3.1]$ bin/elasticsearch
访问http://localhost:9100/