简介:CentOS 8是一个基于Red Hat Enterprise Linux(RHEL)源代码构建的开源操作系统。它是一款稳定、可靠、安全的服务器操作系统,适合用于企业级应用和服务的部署。CentOS 8采用了最新的Linux内核和软件包管理系统,提供了更好的性能和安全性,同时还支持Docker和Kubernetes等容器化技术,方便用户进行应用程序的部署和管理。
前提CentOS 8默认使用DNF作为软件包管理器。DNF是基于RPM的Linux发行版的软件包管理器,用于在Fedora / RHEL / CentOS操作系统中安装、更新和删除软件包。它是Fedora 22、CentOS8和RHEL8的默认软件包管理器。DNF是YUM的下一代版本,并打算在基于RPM的系统中替代YUM。
sudo dnf install java-11-openjdk-devel
java -version
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
sudo nano /etc/yum.repos.d/elasticsearch.repo
which nano
sudo yum install nano
sudo nano /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
sudo dnf install elasticsearch
sudo systemctl enable elasticsearch.service --now
curl -X GET "localhost:9200/"
将会输出:
{
"name" : "centos8.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "V_mfjn2PRJqX3PlZb_VD7w",
"version" : {
"number" : "7.6.0",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "7f634e9f44834fbc12724506cc1da681b0c3b1e3",
"build_date" : "2020-02-06T00:09:00.449973Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
常用命令:
重启es命令:systemctl restart elasticsearch.service
失败解决问题后启动es:systemctl start elasticsearch.service
查看es状态:systemctl status elasticsearch.service
sudo firewall-cmd --new-zone=elasticsearch --permanent
sudo firewall-cmd --reload
sudo firewall-cmd --zone=elasticsearch --add-source=192.168.121.80/32 --permanent
sudo firewall-cmd --zone=elasticsearch --add-port=9200/tcp --permanent
sudo firewall-cmd --reload
不要忘记将
192.168.121.80
修改成你的远程 IP 地址。
sudo firewall-cmd --zone=elasticsearch --add-source= --permanent
sudo firewall-cmd --reload
sudo nano /etc/elasticsearch/elasticsearch.yml
network.host: 0.0.0.0
sudo systemctl restart elasticsearch