Befehl: sudo apt update
Befehl: sudo apt install python3.12-dev


Befehl: curl -LsSf https://astral.sh/uv/install.sh | sh
Befehl: uv venv --python 3.12 --seed 
Befehl: source .venv/bin/activate 
Befehl: uv pip install vllm --torch-backend=auto 
Befehl: uv pip install nvidia-cuda-runtime-cu12 nvidia-cudnn-cu12


Befehl: mkdir vllm
Befehl: cd vllm
Befehl: nano start_vllm.sh


#!/bin/bash
VENV_PATH="/home/[Ihr Benutzername]/[InstallationsVerzeichnis]/.venv"
source "$VENV_PATH/bin/activate"
# Pfad zu den via uv installierten CUDA-Bibliotheken
export LD_LIBRARY_PATH="$VENV_PATH/lib/python3.12/site-packages/nvidia/cuda_runtime/lib:$LD_LIBRARY_PATH"
# vLLM Start mit Stabilitäts-Flags für die A6000
exec python -m vllm.entrypoints.openai.api_server \
    --model Qwen/Qwen2.5-1.5B-Instruct \
    --host 0.0.0.0 \
    --port 8000 \
    --gpu-memory-utilization 0.80 \
    --max-model-len 16384 \
    --enforce-eager


Befehl: sudo chmod +x start_vllm.sh


Befehl: sudo nano /etc/systemd/system/vllm.service


[Unit]
Description=vLLM OpenAI-Compatible Service
After=network.target

[Service]
Type=simple
User=ingmar # [Ihr Benutzername]
Group=ingmar # [Ihre Gruppe]
WorkingDirectory=/home/[Ihr Benutzername]
ExecStart=/home/[Ihr Benutzername]/start_vllm.sh
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target


Befehl: sudo systemctl daemon-reload 
Befehl: sudo systemctl restart vllm

Befehl: sudo systemctl status vllm


Befehl: journalctl -u vllm.service -f


# Modell-Management

#!/bin/bash
# Pfad zur virtuellen Umgebung
VENV_PATH="/home/[Ihr Benutzername]/[Installationpfad]/.venv"
source "$VENV_PATH/bin/activate"

# DEFINIEREN SIE HIER IHREN MODELL-PFAD (Beispiel: /mnt/data/vllm_models)
# Dieser Pfad speichert alle heruntergeladenen Modelle persistent.
export HF_HOME="/[Ihr Wunschpfad]/models"

# Pfad zu den via uv installierten CUDA-Bibliotheken
export LD_LIBRARY_PATH="$VENV_PATH/lib/python3.12/site-packages/nvidia/cuda_runtime/lib:$LD_LIBRARY_PATH"

# vLLM Start mit Stabilitäts-Flags für die A6000
exec python -m vllm.entrypoints.openai.api_server \
    --model Qwen/Qwen2.5-1.5B-Instruct \
    --host 0.0.0.0 \
    --port 8000 \
    --gpu-memory-utilization 0.80 \
    --max-model-len 16384 \
    --enforce-eager





# API Call
curl http://192.168.178.153:8000/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "Qwen/Qwen2.5-1.5B-Instruct",
        "messages": [
            {"role": "user", "content": " What are the advantages of local AI?"}
        ]
    }'
