1、首先es依赖Java,所以必须保证Java环境已安装好
2、导入公共签名密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch?
3、添加yum源
vim /etc/yum.repos.d/elasticsearch.repo
[elasticsearch-7.x]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
4、更新yum缓存
yum makecache
5、安装es
yum install -y elasticsearch
6、按照提示启动es
?sudo systemctl daemon-reload
?sudo systemctl enable elasticsearch.service
?sudo systemctl start elasticsearch.service
7、如果安装没问题,启动失败了,可以查看日志 /var/log/elasticsearch/elasticsearch.log (一般都是内存不足引起的,我们的云主机一般都是1-2G内存的低配版,目前es启动默认要1-2G内存,所以要保证自己机器内存足够)
8、配置外网访问 vim
vim /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
如果有报错:bootstrap check failure [2] of [2]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured可以增加以下配置重启
node.name: node-1
cluster.initial_master_nodes: ["node-1"]
9、配置安全组