From f568e43362366e3b96fe25d5b8a4cce30812acce Mon Sep 17 00:00:00 2001 From: Jota Odiceu Date: Tue, 28 Jul 2026 15:07:14 -0300 Subject: [PATCH] feat(llama.cpp): add llama.cpp comprehensive recipes Covers building, installing, running models with llama-server, and complete uninstallation of llama.cpp. --- recipes/llama.cpp/01_install-llama-cpp.md | 77 +++++++++++++++ .../llama.cpp/02_run-models-on-llama-cpp.md | 94 +++++++++++++++++++ recipes/llama.cpp/03_uninstall-llama-cpp.md | 55 +++++++++++ 3 files changed, 226 insertions(+) create mode 100644 recipes/llama.cpp/01_install-llama-cpp.md create mode 100644 recipes/llama.cpp/02_run-models-on-llama-cpp.md create mode 100644 recipes/llama.cpp/03_uninstall-llama-cpp.md diff --git a/recipes/llama.cpp/01_install-llama-cpp.md b/recipes/llama.cpp/01_install-llama-cpp.md new file mode 100644 index 0000000..b6a4e6f --- /dev/null +++ b/recipes/llama.cpp/01_install-llama-cpp.md @@ -0,0 +1,77 @@ +# Install llama.cpp + +This recipe builds and installs llama.cpp from source on Debian/Ubuntu, including build dependencies and the `llama-server` binary. + +## Install Build Dependencies + +```bash +sudo apt update +sudo apt install -y build-essential cmake git libcurl4-openssl-dev +``` + +## Clone Repository + +```bash +git clone https://github.com/ggml-org/llama.cpp +cd llama.cpp +``` + +## Build Project + +```bash +cmake -B build +cmake --build build --config Release -j $(nproc) +``` + +## Install Binaries + +```bash +sudo cmake --install build +sudo ldconfig +``` + +## Verify Installation + +```bash +llama-server --version +``` + +Expected output: + +```text +version: xxxx (xxxxxxxx) +``` + +## Verify Binary Location + +```bash +which llama-server +``` + +Expected output: + +```text +/usr/local/bin/llama-server +``` + +## Troubleshooting + +### Command not found + +Verify that the binary was installed. + +```bash +ls /usr/local/bin/llama-server +``` + +If it is missing, repeat the build and install steps. + +### Build fails with missing dependency + +Verify the build dependencies are installed. + +```bash +dpkg -l | grep -E "build-essential|cmake|libcurl4-openssl-dev" +``` + +If any are missing, repeat the dependency installation step. diff --git a/recipes/llama.cpp/02_run-models-on-llama-cpp.md b/recipes/llama.cpp/02_run-models-on-llama-cpp.md new file mode 100644 index 0000000..eceb69e --- /dev/null +++ b/recipes/llama.cpp/02_run-models-on-llama-cpp.md @@ -0,0 +1,94 @@ +# Run Models on llama.cpp + +This recipe runs a model with `llama-server` inside a persistent `tmux` session, downloading it directly from Hugging Face. + +## Install tmux + +```bash +sudo apt install -y tmux +``` + +## Start a tmux Session + +```bash +tmux new -s llama +``` + +## Run the Model Server + +Replace: + +- `` with the Hugging Face model repo (e.g. `deepreinforce-ai/Ornith-1.0-9B-GGUF`) +- `` by default `0.0.0.0` hear all network interfaces +- `` with the port to serve on (e.g. `8000`) +- `` with the context window size (e.g. `262144`) + +```bash +llama-server -hf --host --port -c +``` + +## Detach from the Session + +Press: + +```text +Ctrl+B, D +``` + +## List tmux Sessions + +```bash +tmux ls +``` + +Expected output: + +```text +llama: 1 windows (created ...) +``` + +## Reattach to the Session + +```bash +tmux attach -t llama +``` + +## Verify Server is Running + +Replace `` with the configured port. + +```bash +curl http://localhost:/health +``` + +Expected output: + +```json +{"status":"ok"} +``` + +## Troubleshooting + +### Port already in use + +Verify that no other process is bound to the port. + +```bash +sudo ss -tulpn | grep +``` + +### Session not found + +List active sessions and verify the name. + +```bash +tmux ls +``` + +### Server not responding + +Reattach to the session and check the server logs. + +```bash +tmux attach -t llama +``` diff --git a/recipes/llama.cpp/03_uninstall-llama-cpp.md b/recipes/llama.cpp/03_uninstall-llama-cpp.md new file mode 100644 index 0000000..d3f3c83 --- /dev/null +++ b/recipes/llama.cpp/03_uninstall-llama-cpp.md @@ -0,0 +1,55 @@ +# Uninstall llama.cpp + +This recipe completely removes llama.cpp from Ubuntu, including installed binaries, libraries, and the cloned source repository. + +## Stop Running Sessions + +```bash +tmux kill-session -t llama +``` + +## Remove Installed Binaries + +```bash +sudo rm -f /usr/local/bin/llama* +``` + +## Remove Installed Libraries + +```bash +sudo rm -f /usr/local/lib/libllama* +sudo rm -f /usr/local/lib/libggml* +sudo rm -rf /usr/local/include/llama.h /usr/local/include/ggml* +sudo ldconfig +``` + +## Remove Cloned Repository + +Replace `` with the path where the repository was cloned (e.g. `~/llama.cpp`). + +```bash +rm -rf +``` + +## Remove Build Dependencies (Optional) + +Only run this if the packages are not needed by other projects. + +```bash +sudo apt purge -y build-essential cmake libcurl4-openssl-dev +sudo apt autoremove -y +``` + +## Verify Removal + +Check that the binary is no longer available. + +```bash +which llama +``` + +Expected output: + +```text +(no output) +```