1、需要提前安装好jdk环境
2、使用wget下载安装包本文版本使用6.3.2 wget http://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-6.3.2.tar.gz
3、解压 tar -zxvf elasticsearch-6.3.2.tar.gz
4、运行elasticsearch {替换成自己的目录}/elasticsearch-6.3.2/bin/elasticsearch
5、异常处理
①:java.lang.RuntimeException: can not run elasticsearch as root
解决方式:创建一个用户es useradd es -p 123456
授权 chown -R {替换成自己的目录}/elasticsearch-6.3.2
验证:切换到es用户 su - es 再次运行{替换成自己的目录}/elasticsearch-6.3.2/bin/elasticsearch
②:后台模式启动elasticsearch {替换成自己的目录}/elasticsearch-6.3.2/bin/elasticsearch -d 出现异常
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
修改/etc/security/limits.conf文件,增加配置,用户es退出后重新登录生效
* soft nofile 65536
* hard nofile 65536
*表示哪些用户
max number of threads [3818] for user [es] is too low, increase to at least [4096]
修改配置文件/etc/security/limit
* soft nproc 4096
* hard nproc 4096
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf文件,增加配置
vm.max_map_count=262144
执行命令sysctl -p生效