---
title: 编译和安装
description: "配置好Milvus编译环境后，执行以下操作进行Milvus数据库的编译与安装。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdbs/ecosystemEnable/Milvus/kunpeng_milvusinstall_42_014.html
sourcePath: /source/zh/kunpengdbs/ecosystemEnable/Milvus/kunpeng_milvusinstall_42_014.html
indexId: c346b2ddcbce415ff8d8e49851ea54b0d6478b4cf78b9a7de13c2c0852d53c7e78
---
# 编译和安装

配置好Milvus编译环境后，执行以下操作进行Milvus数据库的编译与安装。

1. 拉取Milvus源码。
  1 2 conda activate milvus git clone https://gitee.com/milvus-io/milvus.git

2. 添加远程链接并拉取最新修改。
  1 2 3 4 5 cd milvus git remote remove origin git remote add origin https://github.com/milvus-io/milvus.git git branch --set-upstream-to=origin/master master git fetch && git pull origin master

3. 切换到对应版本。
  1 git checkout v2.4.5

4. 编译Milvus。
  1 make milvus

5. 配置环境变量。
  1 2 3 echo 'export PATH=~/milvus/bin/:$PATH' >> ~/.bashrc echo 'export LD_LIBRARY_PATH=~/milvus/internal/core/output/lib64/:$LD_LIBRARY_PATH' >> ~/.bashrc source ~/.bashrc

6. 设置本地Milvus数据存储路径。

  a. 打开Milvus配置文件。
    1 vim ~/milvus/configs/milvus.yaml

  b. 找到localStorage，修改路径为自定义路径。

```
localStorage:
path: /data/milvus/milvus-data/data/
```


  c. 找到rocksmq，修改路径为自定义路径。

```
rocksmq:
path: /data/milvus/milvus-data/rdb_data
```


  d. 找到“natsmq->server->storeDir”，修改路径为自定义路径。

```
natsmq:
server:
storeDir: /data/milvus/milvus-data/nats
```


  e. 保存退出。
可以将以上路径根据服务器环境进行修改，建议都放在一个文件夹下，方便观察。


7. 查看安装是否成功。
  1 milvus

  若无报错，或回显信息如下图所示，包含milvus的常用命令，则表示Milvus安装成功。

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 Usage: milvus run [server type] [flags] Start a Milvus Server. Tips: Only the server type is 'mixture', flags about starting server can be used. [flags] -rootcoord 'true' Start the rootcoord server. -querycoord 'true' Start the querycoord server. -indexcoord 'true' Start the indexcoord server. -datacoord 'true' Start the datacoord server. -alias '' Set alias milvus stop [server type] [flags] Stop a Milvus Server. [flags] -alias '' Set alias milvus mck run [flags] Milvus data consistency check. Tips: The flags are optional. [flags] -etcdIp '' Ip to connect the etcd server. -etcdRootPath '' The root path of operating the etcd data. -minioAddress '' Address to connect the minio server. -minioUsername '' The username to login the minio server. -minioPassword '' The password to login the minio server. -minioUseSSL 'false' Whether to use the ssl to connect the minio server. -minioBucketName '' The bucket to operate the data in it milvus mck cleanTrash [flags] Clean the back inconsistent data Tips: The flags is the same as its of the 'milvus mck [flags]' [server type] querycoord querynode indexnode datacoord datanode standalone rootcoord proxy mixture
