在CentOS 7上安装Elasticsearch 7、Kibana以及中文分词器IK,可以按照以下步骤进行:
- 导入Elasticsearch和Kibana的公钥:
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
- 创建Elasticsearch的yum仓库文件:
echo "[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 tee /etc/yum.repos.d/elasticsearch.repo
- 安装Elasticsearch:
sudo yum install --enablerepo=elasticsearch elasticsearch
- 启动并设置Elasticsearch开机自启:
sudo systemctl start elasticsearch.service
sudo systemctl enable elasticsearch.service
- 下载并安装Kibana:
echo "[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" | sudo tee /etc/yum.repos.d/kibana.repo
sudo yum install --enablerepo=kibana kibana
sudo systemctl start kibana.service
sudo systemctl enable kibana.service
安装中文分词器IK:
首先,你需要在Elasticsearch的config
目录下的elasticsearch.yml
文件中添加以下配置,以支持中文:
index.codec: best_compression
然后,你可以通过Elasticsearch的插件命令安装IK分词器:
sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.7.0/elasticsearch-analysis-ik-7.7.0.zip
确保你的云服务器安全组或防火墙规则允许访问Elasticsearch和Kibana的默认端口(9200和5601)。