在 CentOS 7 上安装 Elasticsearch 和 Kibana
要运行 Elasticsearch,计算机上需要 Java Runtime Environment(JRE)
。Elasticsearch 需要 Java 7 或更高版本,并建议使用 Oracle JDK version 1.8.0_73
。
因此,请确保你的系统中是否有 Java。如果没有,请按照以下步骤操作:
# Install wget with yum
yum -y install wget
# Download the rpm jre-8u60-linux-x64.rpm for 64 bit
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u60-b27/jre-8u60-linux-x64.rpm"
# Download the rpm jre-8u101-linux-i586.rpm for 32 bit
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u101-b13/jre-8u101-linux-i586.rpm"
# Install jre-.*.rpm
rpm -ivh jre-.*.rpm
Java 现在应该安装在 centOS 系统中。你可以查看:
java -version
下载并安装 elasticsearch
# Download elasticsearch-2.3.5.rpm
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.3.5/elasticsearch-2.3.5.rpm
# Install elasticsearch-.*.rpm
rpm -ivh elasticsearch-.*.rpm
在启动时将 elasticsearch 作为 systemd 服务运行
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch
sudo systemctl start elasticsearch
# check the current status to ensure everything is okay.
systemctl status elasticsearch
安装 Kibana
首先在 rpm 上导入 GPG 密钥
sudo rpm --import http://packages.elastic.co/GPG-KEY-elasticsearch
然后创建一个本地存储库 kibana.repo
sudo vi /etc/yum.repos.d/kibana.repo
并添加以下内容:
[kibana-4.4]
name=Kibana repository for 4.4.x packages
baseurl=http://packages.elastic.co/kibana/4.4/centos
gpgcheck=1
gpgkey=http://packages.elastic.co/GPG-KEY-elasticsearch
enabled=1
现在按照以下命令安装 kibana:
yum -y install kibana
从以下开始:
systemctl start kibana
检查状态:
systemctl status kibana
你可以将其作为启动服务运行。
systemctl enable kibana