centos 安装ELKElasticSearch5.5.2安装head插件 一、head插件安装和使用 四、修改Elasticsearch配置文件 五、修改Gruntfile.js 六、启动elasticsearch-head 七、后台启动elasticsearch-head nodejs采坑记录之-“Make sure you have the latest version of node.js and npm installed”

centos 安装ELKElasticSearch5.5.2安装head插件
一、head插件安装和使用
四、修改Elasticsearch配置文件
五、修改Gruntfile.js
六、启动elasticsearch-head
七、后台启动elasticsearch-head
nodejs采坑记录之-“Make sure you have the latest version of node.js and npm installed”

下载nodejs最新源码,编译安装

wget http://nodejs.org/dist/v6.9.4/node-v6.9.4-linux-x64.tar.gz

tar -zxvf node-v6.9.4-linux-x64.tar.gz

mv node-v6.9.4-linux-x64 node

(重命名)

测试是否安装成功
进入 node 目录下的bin目录,执行 ls命令:
cd node/bin && ls

会看到node和npm,现在我们测试一下:
./node -v

如果出现 v6.9.4, 安装成功!

设置全局
现在node和npm还不能全局使用,我们要添加环境变量

vim ~/.bash_profile
找到 PATH=$PATH:$HOME/bin,在后面添加路径为:

PATH=$PATH:$HOME/bin:/root/node/bin

注意路径
保存修改,然后重载一下

source ~/.bash_profile
OK!大功告成!现在可以在任何目录下执行node和npm命令了!

首先在 root 目录下找到 .bash_profile 文件,编辑

2、安装淘宝npm镜像

npm install -g cnpm --registry=https://registry.npm.taobao.org

3、安装grunt

cnpm install -g grunt-cli
cnpm install -g grunt
#查看版本
grunt -version 

穿插

一、安装支持ZIP的工具

yum install -y unzip zip

二、解压zip文件

unzip 文件名.zip

三、压缩一个zip文件


    zip 文件名.zip
下载地址:https://github.com/mobz/elasticsearch-head,下载后解压缩。
#下载elasticsearch-head-master.zip
#解压head插件
tar -zxvf elasticsearch-head-master.zip
#进入插件目录
cd elasticsearch-head-master
#执行命令安装源码nodejs插件
cnpm install
#启动插件
grunt server

如果速度较慢或者安装失败,可以使用国内镜像:

 npm install -g cnpm --registry=https://registry.npm.taobao.org

四、修改Elasticsearch配置文件

编辑elasticsearch-5.1.1/config/elasticsearch.yml,加入以下内容:

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: '*',

                port: 9100,

                base: '.',

                keepalive: true

            }

        }

    }   

六、启动elasticsearch-head

在elasticsearch-head-master/目录下,运行启动命令:

grunt server

访问http://192.168.1.124:9100/

七、后台启动elasticsearch-head

后台启动grunt server命令;

nohup grunt server &exit

如果想关闭head插件,使用Linux查找进程命令:

ps aux|grep head

结束进程:

kill进程号

nodejs采坑记录之-“Make sure you have the latest version of node.js and npm installed”

参考:https://blog.csdn.net/qq_31758197/article/details/79566371

 https://blog.csdn.net/phoenix2121/article/details/25910919

https://blog.csdn.net/fenglailea/article/details/52934263

#参考#

https://blog.csdn.net/yu757371316/article/details/77897724

https://my.oschina.net/OkSerIous/blog/861714