---
title: 编译和安装
description: "1. 使用PuTTY工具，以root用户登录服务器。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpcindapp/prtg-osc/centos_kunpeng_elasticsearch_792_02_0006.html
sourcePath: /source/zh/kunpenghpcs/hpcindapp/prtg-osc/centos_kunpeng_elasticsearch_792_02_0006.html
indexId: 9c7a24cf132cd7da4b36dce3533274ec1385f389aced3edf5974c366f0bdbfc887
---
# 编译和安装

#### 操作步骤

1. 使用PuTTY工具，以root用户登录服务器。
2. 执行以下命令进入源码包存放的目录。

```
cd
/path/to
```


3. 执行以下命令解压压缩包。

```
tar -xf elasticsearch-7.9.2-linux-aarch64.tar.gz
```


4. 执行以下命令复制三个文件夹。

```
cp -r elasticsearch-7.9.2 es-7.9.2-node1
cp -r elasticsearch-7.9.2 es-7.9.2-node2
cp -r elasticsearch-7.9.2 es-7.9.2-node3
```


  本文安装es集群，只有一台机器，因此在一台机器上安装集群，有条件可在三台机器上进行安装。如在三台机器安装需要注意后续使用到的ip和端口。

5. 执行以下命令修改三个es文件夹下的配置文件。

```
vim config/elasticsearch.yml
```

```
# es-7.9.2-node-1
cluster.name: search-7.9.2
node.name: node-1
node.master: true
node.data: false
node.ingest: false
network.host: 0.0.0.0
http.port: 9200
transport.port: 9300
discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
cluster.initial_master_nodes: ["node-1"]
# es-7.9.2-node-2
cluster.name: search-7.9.2
node.name: node-2
node.master: true
node.data: true
node.ingest: false
network.host: 0.0.0.0
http.port: 9201
transport.port: 9301
discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
# es-7.9.2-node-3
cluster.name: search-7.9.2
node.name: node-3
node.master: true
node.data: true
node.ingest: false
network.host: 0.0.0.0
http.port: 9202
transport.port: 9302
discovery.seed_hosts: ["127.0.0.1:9300","127.0.0.1:9301","127.0.0.1:9302"]
```


  #es-7.9.2-node1表示第一个节点下config/elasticsearch.yml的配置信息，其他依次。如果使用三台机器，注意各节点的ip和端口。

6. 执行以下命令修改/etc/security/limits.confi。

```
vi /etc/security/limits.confi
```


  最后面添加以下内容。

```
*                soft    nofile          65536
*                hard    nofile          131072
```


7. 执行以下命令修改/etc/sysctl.conf。

```
vi /etc/sysctl.conf
```


  最后面添加以下内容。

```
vm.max_map_count=655360
```


8. 执行以下命令刷新sysctl.conf。

```
sysctl -p
```
