1.安装node

1.下载node,webpack需要node来依赖JavaScript包。

  1. wget https://nodejs.org/dist/v10.15.2/node-v10.15.2-linux-x64.tar.xz

2. 解压

  1. tar xvf node-v10.15.2-linux-x64.tar.xz

3.设置软连接

  1. ln -s bin/npm /usr/local/bin/
  2. ln -s bin/node /usr/local/bin/

4.配置环境变量

  1. vi /etc/profile

# node配置

  1. export NODE_HOME=/opt/nodejs/node-v10.15.2-linux-x64
  2. export PATH=$PATH:$NODE_HOME/bin

# 重启服务

  1. source /etc/profile

# 验证node版本

  1. node -v

2.grunt安装

1.下载grunt

  1. npm install -g grunt-cli

2.验证grunt版本

  1. grunt --version

3.head安装

1.下载git

  1. yum -y install git

2.验证git版本

  1. git --version

3.下载head

  1. git clone git://github.com/mobz/elasticsearch-head.git

4.修改elasticsearch.yml配置

  1. vim /opt/elasticsearch-7.4.0/config/elasticsearch.yml
  1. #开启cors跨域访问支持,默认为false
  2. http.cors.enabled: true
  3. #跨域访问允许的域名地址,(允许所有域名)以上使用正则
  4. http.cors.allow-origin: "*"

5.运行head

# 这是node的命令

  1. npm run start

image.pngimage.png
成功启动!
image.pngimage.png

注意:

之前还有一些报错,
需要重启ElasticSearch服务
如果启动head报错,就是webpack中的package.json当中缺少相应的坐标依赖。
image.pngimage.png
自行下载坐标依赖就行

  1. npm install grunt-contrib-copy
  2. npm install grunt-contrib-concat
  3. npm install grunt-contrib-uglify
  4. npm install grunt-contrib-clean
  5. npm install grunt-contrib-watch
  6. npm install grunt-contrib-connect
  7. npm install grunt-contrib-jasmine

访问http://192.168.135.143:9100/
image.pngimage.png