Linux下离线安装head,linux下elasticSearch安装及head安装

一、安装elasticsearch

前提

首先,确保jdk为jdk1.8.0_73以上,并已确保安装ok。

1、下载elasticsearch

wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.1.1.tar.gz

tar -zxvf elasticsearch-5.1.1.tar.gz

cd elasticsearch-5.1.1

2、修改limit限制(5.0以后都要修改)

> vi /etc/security/limits.conf

* soft nofile 65536

* hard nofile 65536

> echo 'vm.max_map_count=262144'>> /etc/sysctl.conf

> sysctl -p

> vi /etc/security/limits.d/90-nproc.conf

* soft nproc 2048

3、设置配置文件

> vim config/elasticsearch.yml

node.name: node-1

path.data: /tmp/elasticsearch/data

path.logs: /tmp/elasticsearch/logs

network.host: 192.168.x.x

http.port: 9200

# 跨域

http.cors.enabled: true

http.cors.allow-origin: "*"

4、创建用户

# 创建elasticsearch用户

groupadd elasticsearch

useradd elasticsearch -g elasticsearch -p elasticsearch

# 赋权限

chown elasticsearch:elasticsearch -R /usr/local/elasticsearch-5.1.1

5、启动

su - elasticsearch -c "nohup /usr/local/elasticsearch-5.1.1/bin/elasticsearch >/dev/null 2>&1 &"

二、head插件的安装

1、下载

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

cd elasticsearch-head

在elasticsearch-head目录下node_modules/grunt下如果没有grunt二进制程序,需要执行

cd elasticsearch-head

npm install grunt --save

2、修改服务器监听地址

修改elasticsearch-head下Gruntfile.js文件,默认监听在127.0.0.1下9200端口

Linux下离线安装head,linux下elasticSearch安装及head安装_第1张图片

修改head的连接地址: 目录:head/_site/app.js

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "https://localhost:9200";

把localhost修改成你es的服务器地址,如:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "https://x.x.x.10:9200";

然后在head目录中,执行npm install下载依赖的包:

npm install

3、启动服务

/usr/local/elasticsearch-head/node_modules/grunt/bin/grunt server

fb8606b13040845bb19e3f9cef000743.png

Linux下离线安装head,linux下elasticSearch安装及head安装_第2张图片

三、如果没有npm,则需安装npm

curl https://npmjs.org/install.sh | sh

sh install.sh

如果出现

npm cannot be installed without Node.js.

Install Node.js first, and then try again.

则需要 安装Node.js

yum install -y nodejs

如果node.js版本过低,则需要升级

升级node.js

# 第一步:首先安装 n 模块:

npm install -g n

# 第二步:升级node.js到最新稳定版

n stable

你可能感兴趣的:(Linux下离线安装head)