This article describes how to build and start Milvus Standalone and Cluster from source code.
-[Build from source](#build-from-source)
-[Prerequisites](#prerequisites)
-[Build Milvus](#build-milvus)
-[Start Milvus](#start-milvus)
- [Requirements](#requirements)
## Prerequisites
- [Compilation](#compilation)
Install the following before building Milvus from source code.
- [Launch Milvus server](#launch-milvus-server)
-[Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) for version control.
-[Golang](https://golang.org/doc/install) version 1.15 or higher and associated toolkits.
-[CMake](https://cmake.org/install/) version 3.14 or higher for compilation.
-[OpenBLAS](https://github.com/xianyi/OpenBLAS/wiki/Installation-Guide)(Basic Linear Algebra Subprograms) library version 0.3.9 or higher for matrix operations.
-[Compile Milvus on Docker](#compile-milvus-on-docker)
- [Error message: `error while loading shared libraries: libmysqlpp.so.3`](#error-message-error-while-loading-shared-libraries-libmysqlppso3)
- [CMake version is not supported](#cmake-version-is-not-supported)
<!-- /TOC -->
## Build from source
### Requirements
- Operating system
- Ubuntu 18.04 or higher
- CentOS 7
> Note: If your Linux operating system does not meet the requirements, we recommend that you pull a Docker image of [Ubuntu 18.04](https://docs.docker.com/install/linux/docker-ce/ubuntu/) or [CentOS 7](https://docs.docker.com/install/linux/docker-ce/centos/) as your compilation environment.
- GCC 7.0 or higher to support C++ 17
- CMake 3.14 or higher
- Git
For GPU-enabled version, you will also need:
- CUDA 10.x (10.0, 10.1, 10.2)
- NVIDIA driver 418 or higher
### Compilation
#### Step 1 Download Milvus source code and specify version
Download Milvus source code, change directory and specify version (for example, 0.10.3):
With the following Docker images, you should be able to compile Milvus on any Linux platform that runs Docker. To build a GPU supported Milvus, you need to install [NVIDIA Docker](https://github.com/NVIDIA/nvidia-docker/) first.
./bin/milvus run rootcoord > /tmp/rootcoord.log 2>&1 &
#start coord
./bin/milvus run datacoord > /tmp/datacoord.log 2>&1 &
./bin/milvus run indexcoord > /tmp/indexcoord.log 2>&1 &
./bin/milvus run querycoord > /tmp/querycoord.log 2>&1 &
#start node
./bin/milvus run proxy > /tmp/proxy.log 2>&1 &
./bin/milvus run datanode > /tmp/data_node.log 2>&1 &
./bin/milvus run indexnode > /tmp/index_node.log 2>&1 &
./bin/milvus run querynode > /tmp/query_node.log 2>&1 &
```
2. Add cuda binary path to `PATH`:
```shell
$ export PATH=/usr/local/cuda/bin:$PATH
```
3. Add a `-g` parameter to run `build.sh`:
```shell
$ ./build.sh -g-t Release
```
4. Start Milvus server:
```shell
$ ./start_server.sh
```
## Troubleshooting
### Error message: `protocol https not supported or disabled in libcurl`
Follow the steps below to solve this problem:
1. Make sure you have `libcurl4-openssl-dev` installed in your system.
2. Try reinstalling the latest CMake from source with `--system-curl` option:
```shell
$ ./bootstrap --system-curl
$ make
$ sudo make install
```
If the `--system-curl` command doesn't work, you can also reinstall CMake in **Ubuntu Software** on your local computer.
### Error message: `internal compiler error`
Try increasing the memory allocated to Docker. If this doesn't work, you can reduce the number of threads in CMake build in `[Milvus root path]/core/build.sh`.
```shell
make -j 8 install||exit 1 # The default number of threads is 8.
```
Note: You might also need to configure CMake build for faiss in `[Milvus root path]/core/src/index/thirdparty/faiss`.
### Error message: `error while loading shared libraries: libmysqlpp.so.3`
Follow the steps below to solve this problem:
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`.
### CMake version is not supported
Follow the steps below to install a supported version of CMake:
1. Remove the unsupported version of CMake.
2. Get CMake 3.14 or higher. Here we get CMake 3.14.