adduser elastic
su elastic
cd ~/
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.4.1.tar.gz
tar -zxvf ./elasticsearch-6.4.1.tar.gz
mv ./elasticsearch-6.4.1 elastic
cd ./elastic
sudo ./bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.4.1/elasticsearch-analysis-ik-6.4.1.zip
./bin/elasticsearch
error
max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536] 文件描述符过小 sudo vim /etc/security/limits.conf elastic soft nofile 65536 elastic hard nofile 65536
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] 虚拟内存过小 sudo sysctl -w vm.max_map_count=262144
添加守护进程
sudo vim /lib/systemd/system/elastic.service
[Unit]
Description=ElasticSearch Service
After=network.target
[Service]
Type=forking
User=elastic
ExecStart=/home/elastic/elastic/bin/elasticsearch
ExecReload=
ExecStop=[Install]
WantedBy=multi-user.target
systemctl enable ./elastic.service