在 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