1.首先需要安装好java,并配置好环境变量
2.下载elasticsearch的rpm包,命令如下:
wget https://download.elastic.co/elasticsearch/release/org/elasticsearch/distribution/rpm/elasticsearch/2.4.2/elasticsearch-2.4.2.rpm
3.安装下载好的rpm包:
rpm -ivh elasticsearch-2.4.2.rpm
4.安装成功后,启动elasticsearch:
systemctl daemon-reload
systemctl enable elasticsearch.service (设置开机自启动)
systemctl start elasticsearch.service (开启服务)
systemctl status elasticsearch.service (查看服务状态)
5.进入elasticsearch的安装目录,我的是在/usr/share/elasticsearch目录下
plugin -install mobz/elasticsearch-head
6.测试是否安装成功:
curl http://localhost:9200
curl http://localhost:9200/_plugin/head
7.修改elasticsearch的配置文件:
vi /etc/elasticsearch/elasticsearch.yml
修改network.host和http.port的值,并开放centos的端口:
firewall-cmd --zone=public --add-port=9200/tcp --permanent