安装Java 1.8环境
解压源码安装包:
tar xf jdk-8u121-linux-x64.tar.gz
ll
mkdir /work/opt -p
mv jdk1.8.0_121 /work/opt/jdk
ll /work/opt/jdk/
chown -R root.root /work/opt
vim /etc/profile : //添加
export JAVA_HOME=/work/opt/jdk
export JAVA_BIN=$JAVA_HOME/bin
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_BIN:$PATH
安装 elasticsearch-5.3.0
tar xf elasticsearch-5.3.0.tar.gz
mv elasticsearch-5.3.0 /work/opt/elasticsearch
Ubuntu@ip-172-31-1-79:/work/opt/elasticsearch/config$ egrep -v '#|^$' elasticsearch.yml
cluster.name: lvnian-elk
node.name: lvnian-elk-node1
path.data: /data #由于是普通用户启动elasticsearch,所以这个目录的属主需要改为普通用户
path.logs: /work/opt/elasticsearch/logs #由于是普通用户启动elasticsearch,所以这个目录的属主需要改为普通用户
bootstrap.memory_lock: false
network.host: 0.0.0.0
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
ubuntu@ip-172-31-1-79:/work/opt/elasticsearch/config$
nohup /work/opt/elasticsearch/bin/elasticsearch >> /tmp/elasticsearch.log &
##ES 5.1.1 安装 head:
(5.1.1版本的 elasticsearch 没有提供直接插件安装方法,但在该github上该插件作者给出了方法)
下载二进制源码包:
wget https://nodejs.org/dist/v4.2.2/node-v6.2.0-linux-x64.tar.gz
解压:
tar xf node-v6.2.0-linux-x64.tar.gz -C /work/opt/
设置环境变量:
vim /etc/profile:
export NODE_HOME=/work/opt/node/
export PATH=$PATH:$NODE_HOME/bin
root@ip-172-31-1-79:/work/source# node --version
v6.10.1
npm config set registry https://registry.npm.taobao.org //设置代理镜像源,加速下载
cd /home/stt/node-v4.2.2-linux-x64/lib/node_modules
npm install grunt //显示的2条warn可以忽略
测试grunt是否生效:
$ grunt -version
grunt-cli v1.2.0
grunt v1.0.1
安装head插件:
下载:git clone git://github.com/mobz/elasticsearch-head.git
cd /home/stt/elasticsearch-head
npm install (提示:如果遇到网络的瓶颈,将预先下载的源码包放在对应的位置效果一样,目录为/tmp/phantomjs/,确定位置后可自行创建并上传包)
修改 elasticsearch-head/ _site/app.js
// 把localhost改为ip
找到:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";
改为:
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.8.116:9200";
修改 elasticsearch-head/Gruntfile.js
connect: {
server: {
options: {
hostname: "0.0.0.0", //增加这个配置
port: 9100,
base: '.',
keepalive: true
}
}
}