1. 자바 설치 버전을 확인한다.
java -version
1.8.0이상 버전이라면 따로 설치를 안해도 된다.
* 자바가 없을경우 아래 명령어로 설치해준다.
yum install -y java-1.8.0-openjdk-devel.x86_64
2. repo 생성 후 편집
다른 버전을 설치하고 싶다면 8.x를 설치하고 싶은 버전대로 변경하면 된다. ex) 7.x
vim /etc/yum.repos.d/elasticsearch.repo
위 명령어로 파일을 생성해서 아래 내용을 입력한다.
[elasticsearch-8.x]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
3. elasticsearch설치
- 2번에서 입력한 버전대의 가상 최신 버전이 설치된다. ex) 8.x > 8.6.0
yum install -y elasticsearch
- 정확한 버전명을 입력하면 해당 버전이 설치된다.
yum install -y elasticsearch-8.3.3
4. 설정 변경
아래 명령어로 파일을 연다.
vim /etc/elasticsearch/elasticsearch.yml
아래 텍스트를 찾아서 바꿔준다.
#network.host: localhost
#http.port: 9200
xpack.security.enabled: true
대체 내용
network.host: 0.0.0.0 //외부 접속할려면
http.port: 9200
xpack.security.enabled: false
5. 방화벽 등록
#방화벽 설치(설치되어있으면 생략)
yum install firewalld
firewall-cmd --permanent --zone=public --add-port=9200/tcp
firewall-cmd --permanent --zone=public --add-service=elasticsearch
firewall-cmd --reload
firewall-cmd --list-ports
6. 서비스 등록
systemctl enable elasticsearch
systemctl start elasticsearch
systemctl status elasticsearch
7. 확인
curl -X GET 'localhost:9200'
위 명령어를 입력해서 아래와 같은 형식으로 나온다면 설치가 정상적으로 완료된것이다.
[root@localhost ~]# curl -X GET 'localhost:9200'
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "msh4LuBYRDO92kqiei2Piw",
"version" : {
"number" : "8.3.3",
"build_flavor" : "default",
"build_type" : "rpm",
"build_hash" : "801fed82df74dbe537f89b71b098ccaff88d2c56",
"build_date" : "2022-07-23T19:30:09.227964828Z",
"build_snapshot" : false,
"lucene_version" : "9.2.0",
"minimum_wire_compatibility_version" : "7.17.0",
"minimum_index_compatibility_version" : "7.0.0"
},
"tagline" : "You Know, for Search"
}
'Linux' 카테고리의 다른 글
Spring-Elasticsearch 연동 (Java Socket+Centos7+Python3.7) (0) | 2023.02.21 |
---|---|
[CentOS7] python3.7 설치, pip3 설치 (0) | 2023.01.26 |
[CentOS7] Kibana 설치 (0) | 2023.01.18 |