---
# System prepended metadata

title: ENV setup for llama.cpp
tags: [llama, WSL]

---

# Install packages for llama.cpp build

**Script.sh**
```
#!/bin/bash 

# package
sudo apt update 
sudo apt install build-essential libtool autoconf unzip wget -y
sudo apt-get install libssl-dev -y
sudo apt install make g++ -y

sudo apt install nvidia-cuda-toolkit -y

# cmake
version=3.27
build=7
## don't modify from here
mkdir ~/temp && cd ~/temp
wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
tar -xzvf cmake-$version.$build.tar.gz
cd cmake-$version.$build/

./bootstrap
make -j$(nproc)
sudo make install
```

## 1. Install packages
```
sudo apt update 
sudo apt install build-essential libtool autoconf unzip wget -y
sudo apt-get install libssl-dev -y
sudo apt install make g++ -y
```

### CMake
**CMake 3.17 or higher is required. You are running version 3.16.3**

1. Uninstall the default version of CMake provided by Ubuntu's package manager and configuration by using:
    ```
    sudo apt purge --auto-remove cmake

    sudo apt update
    sudo apt install build-essential libtool autoconf unzip wget
    sudo apt-get install libssl-dev
    ```

2. Download and extract the latest version. 
    Go to the [Official CMake webpage](https://cmake.org/download)
    -or-
    `wget https://github.com/Kitware/CMake/releases/download/v3.28.0-rc5/cmake-3.28.0-rc5.tar.gz`

    Update the `version` and `build` variables in the following command to get the desired version:
    ```
    version=3.27
    build=7
    ## don't modify from here
    mkdir ~/temp && cd ~/temp
    wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz
    tar -xzvf cmake-$version.$build.tar.gz
    cd cmake-$version.$build/
    ```
    ![image](https://hackmd.io/_uploads/Syr9obJBp.png)

3. Install the extracted source by running:
    ```
    ./bootstrap
    make -j$(nproc)
    sudo make install
    ```
    ![image](https://hackmd.io/_uploads/rk44hb1S6.png)


4. Test your new cmake version.
    `cmake --version`
    ![image](https://hackmd.io/_uploads/SkZr2ZkHp.png)
