2025-08-01 10:55:55 -04:00
First, install the recommended compiler. We recommend using `gcc/g++ >= 12.3.0` as the default compiler to avoid potential problems. For example, on Ubuntu 22.4, you can run:
2025-01-13 12:27:36 +00:00
2025-06-23 18:59:09 +01:00
```bash
2025-01-13 12:27:36 +00:00
sudo apt-get update -y
2025-07-10 01:28:30 +08:00
sudo apt-get install -y --no-install-recommends ccache git curl wget ca-certificates gcc-12 g++-12 libtcmalloc-minimal4 libnuma-dev ffmpeg libsm6 libxext6 libgl1 jq lsof
2025-01-13 12:27:36 +00:00
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 10 --slave /usr/bin/g++ g++ /usr/bin/g++-12
```
2025-08-01 10:55:55 -04:00
Second, clone the vLLM project:
2025-03-02 18:59:50 +08:00
2025-06-23 18:59:09 +01:00
```bash
2025-03-02 18:59:50 +08:00
git clone https://github.com/vllm-project/vllm.git vllm_source
cd vllm_source
```
2025-08-01 10:55:55 -04:00
Third, install required dependencies:
2025-01-13 12:27:36 +00:00
2025-06-23 18:59:09 +01:00
```bash
2025-09-01 18:34:52 +08:00
uv pip install -r requirements/cpu-build.txt --torch-backend cpu
uv pip install -r requirements/cpu.txt --torch-backend cpu
2025-01-13 12:27:36 +00:00
```
2025-08-01 10:55:55 -04:00
??? console "pip"
```bash
pip install --upgrade pip
pip install -v -r requirements/cpu-build.txt --extra-index-url https://download.pytorch.org/whl/cpu
pip install -v -r requirements/cpu.txt --extra-index-url https://download.pytorch.org/whl/cpu
```
Finally, build and install vLLM:
2025-01-13 12:27:36 +00:00
2025-06-23 18:59:09 +01:00
```bash
2025-01-13 12:27:36 +00:00
VLLM_TARGET_DEVICE=cpu python setup.py install
```
2025-04-21 13:45:51 -04:00
2025-08-01 10:55:55 -04:00
If you want to develop vLLM, install it in editable mode instead.
2025-04-21 13:45:51 -04:00
2025-06-23 18:59:09 +01:00
```bash
2025-04-21 13:45:51 -04:00
VLLM_TARGET_DEVICE=cpu python setup.py develop
```
2025-05-23 11:09:53 +02:00
2025-07-10 01:28:30 +08:00
!!! note
If you are building vLLM from source and not using the pre-built images, remember to set `LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4:$LD_PRELOAD"` on x86 machines before running vLLM.
2025-05-23 11:09:53 +02:00
# --8<-- [end:extra-information]