CentOS 使用yum安装ELK环境命令详解
使用yum安装elasticsearch
官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/7.10/rpm.html#rpm-repo
配置仓库:在 /etc/yum.repos.d/ 目录下创建 elasticsearch.repo文件,写入如下内容:
[elasticsearch] 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=0 autorefresh=1 type=rpm-md
yum安装:
sudo yum install --enablerepo=elasticsearch elasticsearch
启动elasticsearch:
systemctl start elasticsearch
访问9200端口,效果如下图,证明安装成功:
异常情况处理:
配置文件: /etc/elasticsearch/elasticsearch.yml
安装目录: /usr/share/elasticsearch
使用yum安装kibana
官方文档:https://www.elastic.co/guide/en/kibana/7.10/rpm.html#rpm-repo
配置仓库:在 /etc/yum.repos.d/ 目录下创建 kibana.repo文件,写入如下内容:
[kibana-7.x] name=Kibana 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
yum安装:
sudo yum install kibana
使用systemd运行kibana:
sudo /bin/systemctl daemon-reload sudo /bin/systemctl enable kibana.service //设置开机自动启动 sudo systemctl start kibana.service //启动 sudo systemctl stop kibana.service //关闭
访问kibana的默认端口5601 (http://localhost:5601),效果如下图,证明安装成功
kibana界面汉化,在kibana配置文件中添加如下配置即可:
i18n.locale: "zh-CN"
使用yum安装logstash
官方文档:https://www.elastic.co/guide/en/logstash/7.10/installing-logstash.html#_yum
配置仓库:在 /etc/yum.repos.d/ 目录下创建 logstash.repo文件,写入如下内容:
[logstash-7.x] name=Elastic 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
yum安装:
sudo yum install logstash
安装成systemd服务(logstash需要执行该步骤,主动安装成systemd服务):
/usr/share/logstash/bin/system-install /etc/logstash/startup.options systemd
运行logstash:
systemctl start logstash