# 2.2.2 Unix RPM (yum) 설치 및 실행

&#x20; 레드햇 리눅스 계열에서 편하게 사용 가능한 yum 패키지로도 설치가 가능합니다. 버전에 따라 다를 수 있으므로 정확한 설정은 [공식 문서](<https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html >) 에서 확인하시기 바랍니다.

### yum 다운로드

&#x20; 먼저 최신 버전의 elasticsearch를 yum 으로 설치하기 위해 /etc/yum.repos.d/ 디렉토리 아래에 elasticsearch.repo 파일을 만들고 아래와 같이 내용을 입력합니다.

{% code title="/etc/yum.repos.d/elasticsearch.repo" %}

```
[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
```

{% endcode %}

Apache 2.0 라이센스 배포판을 설치하려면 baseurl 부분을 아래와 같이 입력합니다.

{% code title="/etc/yum.repos.d/elasticsearch.repo" %}

```
baseurl=https://artifacts.elastic.co/packages/oss-7.x/yum
```

{% endcode %}

&#x20; 파일을 추가하고 나서 이제 yum명령을 이용해서 Elasticsearch를 설치합니다.

{% code title="yum 을 이용해서 Elasticsearch 설치" %}

```bash
$ sudo yum install elasticsearch -y
```

{% endcode %}

&#x20; 위와 같이 하면 최신 버전이 설치되고, 특정 버전을 설치하고 싶으면 다음과 같이 뒤에 버전을 명시 해 주면 됩니다.

{% code title="7.0.0 버전으로 설치" %}

```bash
$ sudo yum install elasticsearch-7.0.0 –y
```

{% endcode %}

### 서비스 등록

&#x20; ps -p 1 를 이용해서 SysV init 과 systemd 중 어떤 서비스를 사용하는지 확인합니다. init 을 사용하는 경우 서비스에 등록하기 위해 다음 명령을 실행합니다.

```bash
$ sudo chkconfig --add elasticsearch
```

&#x20; 이제 service 명령으로 elasticsearch의 실행 또는 종료가 가능합니다.

```bash
$ sudo -i service elasticsearch start
$ sudo -i service elasticsearch stop
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://esbook.kimjmin.net/02-install/2.2/2.2.2-unix-rpm-yum.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
