INSTALL.md 3.6 KB
Newer Older
J
jielinxu 已提交
1 2
# Install Milvus from Source Code

J
jielinxu 已提交
3 4
- [Build from source](#build-from-source)
- [Compile Milvus on Docker](#compile-milvus-on-docker)
J
jielinxu 已提交
5

6 7
If you encounter any problems/issues compiling Milvus from source, please refer to [Troubleshooting](#troubleshooting).

J
jielinxu 已提交
8 9 10
## Build from source

### Requirements
J
jielinxu 已提交
11 12

- Ubuntu 18.04 or higher
13

J
jielinxu 已提交
14
  If your operating system is not Ubuntu 18.04 or higher, we recommend you to pull a [docker image of Ubuntu 18.04](https://docs.docker.com/install/linux/docker-ce/ubuntu/) as your compilation environment.
15
  
16
- GCC 7.0 or higher to support C++17
17 18
- CMake 3.12 or higher

J
jielinxu 已提交
19
##### For GPU-enabled version, you will also need:
20

J
jielinxu 已提交
21 22 23
- CUDA 10.0 or higher
- NVIDIA driver 418 or higher

J
jielinxu 已提交
24
### Compilation
J
jielinxu 已提交
25

J
jielinxu 已提交
26
#### Step 1 Install dependencies
J
jielinxu 已提交
27 28

```shell
29
$ cd [Milvus root path]/core
J
jielinxu 已提交
30 31 32
$ ./ubuntu_build_deps.sh
```

J
jielinxu 已提交
33
#### Step 2 Build
J
jielinxu 已提交
34 35

```shell
36
$ cd [Milvus root path]/core
J
jielinxu 已提交
37 38 39
$ ./build.sh -t Debug
or 
$ ./build.sh -t Release
Z
Zhiru Zhu 已提交
40
```
41

J
jielinxu 已提交
42
By default, it will build CPU-only version. To build GPU version, add `-g` option
Z
Zhiru Zhu 已提交
43
```shell
44
$ ./build.sh -g
J
jielinxu 已提交
45 46
```

Z
Zhiru Zhu 已提交
47 48 49 50 51
If you want to know the complete build options, run
```shell
$./build.sh -h
```

J
jielinxu 已提交
52 53
When the build is completed, all the stuff that you need in order to run Milvus will be installed under `[Milvus root path]/core/milvus`.

J
jielinxu 已提交
54
### Launch Milvus server
J
jielinxu 已提交
55 56 57 58 59 60 61

```shell
$ cd [Milvus root path]/core/milvus
```

Add `lib/` directory to `LD_LIBRARY_PATH`

Z
Zhiru Zhu 已提交
62
```shell
63
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:[Milvus root path]/core/milvus/lib
J
jielinxu 已提交
64 65 66 67
```

Then start Milvus server:

Z
Zhiru Zhu 已提交
68
```shell
J
jielinxu 已提交
69 70 71 72 73 74 75 76 77
$ cd scripts
$ ./start_server.sh
```

To stop Milvus server, run:

```shell
$ ./stop_server.sh
```
78

J
jielinxu 已提交
79 80
## Compile Milvus on Docker

J
jielinxu 已提交
81
With the following Docker images, you should be able to compile Milvus on any Linux platform that run Docker. To build a GPU supported Milvus, you neeed to install [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker/) first.
J
jielinxu 已提交
82

J
jielinxu 已提交
83
### Step 1 Pull Milvus Docker images
J
jielinxu 已提交
84 85 86 87

Pull CPU-only image:

```shell
J
jielinxu 已提交
88
$ docker pull milvusdb/milvus-cpu-build-env:v0.6.0-ubuntu18.04
J
jielinxu 已提交
89 90 91 92 93
```

Pull GPU-enabled image:

```shell
J
jielinxu 已提交
94
$ docker pull milvusdb/milvus-gpu-build-env:v0.6.0-ubuntu18.04
J
jielinxu 已提交
95
```
J
jielinxu 已提交
96
### Step 2 Start the Docker container
J
jielinxu 已提交
97 98 99 100

Start a CPU-only container:

```shell
J
jielinxu 已提交
101
$ docker run -it -p 19530:19530 -d milvusdb/milvus-cpu-build-env:v0.6.0-ubuntu18.04
J
jielinxu 已提交
102 103 104 105 106
```

Start a GPU container:

```shell
J
jielinxu 已提交
107
$ docker run --runtime=nvidia -it -p 19530:19530 -d milvusdb/milvus-gpu-build-env:v0.6.0-ubuntu18.04
J
jielinxu 已提交
108 109 110 111
```
To enter the container:

```shell
J
jielinxu 已提交
112
$ docker exec -it [container_id] bash
J
jielinxu 已提交
113
```
J
jielinxu 已提交
114
### Step 3 Download Milvus source code
J
jielinxu 已提交
115 116 117 118 119

Download Milvus source code:

```shell
$ cd /home
J
jielinxu 已提交
120
$ wget https://github.com/milvus-io/milvus/archive/0.6.0.tar.gz
J
jielinxu 已提交
121 122
```

J
jielinxu 已提交
123
Extract the source package:
J
jielinxu 已提交
124 125

```shell
J
jielinxu 已提交
126
$ tar xvf ./v0.6.0.tar.gz
J
jielinxu 已提交
127 128
```

J
jielinxu 已提交
129 130 131 132 133
The source code is extracted into a folder called `milvus-0.6.0`. To enter its core directory:

```shell
$ cd ./milvus-0.6.0/core
```
J
jielinxu 已提交
134
### Step 4 Compile Milvus in the container
J
jielinxu 已提交
135 136 137 138 139 140

If you are using a CPU-only image, compile it like this:
```shell
$ ./build.sh -t Release
```

J
jielinxu 已提交
141
If you are using a GPU-enabled image, you need to add a `-g` parameter:
J
jielinxu 已提交
142 143 144 145 146 147 148 149 150
```shell
$ ./build.sh -g -t Release
```

Then start Milvus server:
```shell
$ ./start_server.sh
```

151 152 153 154
## Troubleshooting
1. If you encounter the following error when compiling: 
`protocol https not supported or disabled in libcurl`.
First, make sure you have `libcurl4-openssl-dev` installed in your system.
155
Then try reinstalling the latest CMake from source with `--system-curl` option:
J
jielinxu 已提交
156 157 158 159 160 161

   ```shell
   $ ./bootstrap --system-curl 
   $ make 
   $ sudo make install
   ```
J
jielinxu 已提交
162
If the `--system-curl` command doesn't work, you can also reinstall CMake in **Ubuntu Software** on your local computer.