## 0x01本慕、ElasticSearch安裝與配置
##### 1侧漓、下載ElasticSearch
```
$ wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.zip
$ unzip elasticsearch-6.3.2.zip
```
##### 2、配置es:修改conf文件夾下的elasticsearch.yml
```
# 配置host使外網(wǎng)可訪問鉴象,不然ip:port不能訪問何鸡,只能通過localhost:port
network.host: 0.0.0.0
http.port: 9200
```
##### 3牛欢、報錯踩坑
- es的安全機制不能使用root用戶啟動,需要切換到其他用戶
- 配置了host后運行es報錯
```
ERROR: [3] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [3780] for user [jiang] is too low, increase to at least [4096]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
```
解決方案:
```
error [1][2]
$ sudo vi /etc/security/limits.conf
# 添加一下4條配置
*? ? ? ? ? ? ? soft? ? nofile? ? ? ? ? 65536
*? ? ? ? ? ? ? hard? ? nofile? ? ? ? ? 65536
*? ? ? ? ? ? ? soft? ? nproc? ? ? ? ? 4096
*? ? ? ? ? ? ? hard? ? nproc? ? ? ? ? 4096
error:[3]
$ vi /etc/sysctl.conf
# 添加一下配置
vm.max_map_count=262144
$ sysctl -p 生效
```
##### 4隔盛、啟動es
```
$ ./bin/elasticsearch
$ curl localhost/ip:9200
```
## 0x02拾稳、Kibana安裝
##### 1、下載kibana龙亲,kibana需要和es版本對應(yīng)
```
$ https://artifacts.elastic.co/downloads/kibana/kibana-6.3.2-linux-x86_64.tar.gz
```
##### 2悍抑、解壓kibana
```
# sha1sum 查看軟件的hash和完整性
$ sha1sum kibana-6.3.2-linux-x86_64.tar.gz
$ tar -zxvf kibana-6.3.2-linux-x86_64.tar.gz
```
##### 3、配置kibana
```
# 連接es
elasticsearch.url: "http://192.168.1.240:9250"
```
##### 4拂盯、運行kibana
```
$ ./bin/kibana
# 瀏覽器訪問? localhost:5601
```
##### 5记靡、Kibana用戶手冊
[Kibana官網(wǎng)用戶手冊](https://www.elastic.co/guide/cn/kibana/current/index.html)
## 0x03、Elasticsearch head安裝
1空凸、下載elasticsearch head
```
去github下載zip
$ wget? https://github.com/mobz/elasticsearch-head/archive/master.zip
```
2蜕便、安裝es head 依賴的nodejs 環(huán)境
[node.js教程](http://www.runoob.com/nodejs/nodejs-install-setup.html)
```
$ wget https://npm.taobao.org/mirrors/node/v10.8.0/node-v10.8.0-linux-x64.tar.xz
$ tar xf node-v10.8.0-linux-x64.tar.xz
```
3、配置nodejs環(huán)境變量
```
# 在/etc/profile添加以下兩行
# config nodejs
NODE_HOME=/home/jiang/app/node-v10.8.0-linux-x64
PATH=$NODE_HOME/bin:$PATH
# 使配置文件生效
$ source /etc/profile
```
4两嘴、安裝grunt
```
$ cd /elasticsearch-head-master
$ npm install -g grunt-cli
$ grunt -version
$ npm install
```
5、啟動head
```
$ cd /elasticsearch-head-master
$ grunt server
瀏覽器訪問: http://localhost:9100/
enjoy it...
```