INSTALL.md 3.9 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)
5
- [Troubleshooting](#troubleshooting)
6

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

### Requirements
J
jielinxu 已提交
10 11

- Ubuntu 18.04 or higher
12

J
jielinxu 已提交
13
  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.
14
  
15
- GCC 7.0 or higher to support C++17
16 17
- CMake 3.12 or higher

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

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

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

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

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

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

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

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

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

J
jielinxu 已提交
51 52
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 已提交
53
### Launch Milvus server
J
jielinxu 已提交
54 55 56 57 58 59 60

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

Add `lib/` directory to `LD_LIBRARY_PATH`

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

Then start Milvus server:

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

To stop Milvus server, run:

```shell
$ ./stop_server.sh
```
77

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

valerianian's avatar
valerianian 已提交
80
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 need to install [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker/) first.
J
jielinxu 已提交
81

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

Pull CPU-only image:

```shell
valerianian's avatar
valerianian 已提交
87
$ docker pull milvusdb/milvus-cpu-build-env:latest
J
jielinxu 已提交
88 89 90 91 92
```

Pull GPU-enabled image:

```shell
valerianian's avatar
valerianian 已提交
93
$ docker pull milvusdb/milvus-gpu-build-env:latest
J
jielinxu 已提交
94
```
J
jielinxu 已提交
95
### Step 2 Start the Docker container
J
jielinxu 已提交
96 97 98 99

Start a CPU-only container:

```shell
valerianian's avatar
valerianian 已提交
100
$ docker run -it -p 19530:19530 -d milvusdb/milvus-cpu-build-env:latest
J
jielinxu 已提交
101 102 103 104 105
```

Start a GPU container:

```shell
valerianian's avatar
valerianian 已提交
106
$ docker run --runtime=nvidia -it -p 19530:19530 -d milvusdb/milvus-gpu-build-env:latest
J
jielinxu 已提交
107 108 109 110
```
To enter the container:

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

valerianian's avatar
valerianian 已提交
115
Download latest Milvus source code:
J
jielinxu 已提交
116 117 118

```shell
$ cd /home
valerianian's avatar
valerianian 已提交
119
$ git clone https://github.com/milvus-io/milvus
J
jielinxu 已提交
120 121
```

valerianian's avatar
valerianian 已提交
122
To enter its core directory:
J
jielinxu 已提交
123 124

```shell
valerianian's avatar
valerianian 已提交
125
$ cd ./milvus/core
J
jielinxu 已提交
126 127
```

J
jielinxu 已提交
128
### Step 4 Compile Milvus in the container
J
jielinxu 已提交
129 130

If you are using a CPU-only image, compile it like this:
valerianian's avatar
valerianian 已提交
131

J
jielinxu 已提交
132 133 134 135
```shell
$ ./build.sh -t Release
```

J
jielinxu 已提交
136
If you are using a GPU-enabled image, you need to add a `-g` parameter:
valerianian's avatar
valerianian 已提交
137

J
jielinxu 已提交
138 139 140 141 142
```shell
$ ./build.sh -g -t Release
```

Then start Milvus server:
valerianian's avatar
valerianian 已提交
143

J
jielinxu 已提交
144 145 146 147
```shell
$ ./start_server.sh
```

148
## Troubleshooting
149

150 151 152
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.
153
Then try reinstalling the latest CMake from source with `--system-curl` option:
J
jielinxu 已提交
154 155 156 157 158 159

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

162 163 164 165 166 167 168 169 170 171 172 173 174 175
2. If you encounter the following error when compiling in a Docker image: `internal compiler error`. Try increasing the memory allocated to docker first.

3. If you encounter the following error during compilation:

    ```
    .../bin/milvus_server: error while loading shared libraries: libmysqlpp.so.3: cannot open shared object file: No such file or directory
    ```
    
    Try the following solutions:
    
    1. Check whether `libmysqlpp.so.3` is correctly installed;
    2. If `libmysqlpp.so.3` is installed, check whether it is added to `LD_LIBRARY_PATH`.