157 lines
3.8 KiB
Markdown
157 lines
3.8 KiB
Markdown
```
|
|
__________ .___ _____ .___
|
|
\______ \_____ __| _/ / _ \ | |
|
|
| | _/\__ \ / __ | / /_\ \| |
|
|
| | \ / __ \_/ /_/ | / | \ |
|
|
|______ /(____ /\____ | \____|__ /___|
|
|
\/ \/ \/ \/
|
|
|
|
B A D A I - H O S T ( D E B I A N , A M D G P U )
|
|
```
|
|
|
|
### Installazione
|
|
|
|
Infrastruttura AI containerizzata con Podman rootless su Ubuntu con GPU AMD.
|
|
|
|
|
|
|
|
##### Prerequisiti
|
|
|
|
- Debian 13 o superiore
|
|
- Utente non-root con privilegi sudo
|
|
- GPU AMD (opzionale, per ottimizzazioni)
|
|
|
|
|
|
##### 1. Aggiornare il sistema
|
|
|
|
```bash
|
|
sudo apt update && sudo apt upgrade -y
|
|
```
|
|
|
|
##### 2. Aggiungere l'utente ai gruppi render e video
|
|
|
|
```bash
|
|
sudo usermod -a -G render,video $LOGNAME
|
|
sudo loginctl enable-linger $USER
|
|
echo 'net.ipv4.ip_unprivileged_port_start=80' | sudo tee /etc/sysctl.d/99-rootless-ports.conf
|
|
sudo sysctl --system
|
|
```
|
|
|
|
##### 3. Installare Podman e strumenti utili
|
|
|
|
```bash
|
|
sudo apt install -y podman htop radeontop curl
|
|
```
|
|
|
|
##### 4. Creare cartelle per systemd containers
|
|
|
|
```bash
|
|
mkdir -p ~/.config/containers/systemd
|
|
```
|
|
|
|
##### 5. Creare internal.network
|
|
|
|
Crea il file `internal.network` nella directory systemd:
|
|
|
|
```bash
|
|
tee ~/.config/containers/systemd/internal.network <<'EOF'
|
|
[Unit]
|
|
Description=Internal network for containers
|
|
After=network-online.target
|
|
|
|
[Network]
|
|
NetworkName=internal
|
|
Subnet=10.10.0.0/24
|
|
Gateway=10.10.0.1
|
|
DNS=9.9.9.9
|
|
|
|
[Install]
|
|
WantedBy=default.target
|
|
EOF
|
|
```
|
|
|
|
##### 6. Aggiungere registri a /etc/containers/registries.conf
|
|
|
|
```bash
|
|
printf "[registries.search]\nregistries = [\"docker.io\", \"quay.io\", \"ghcr.io\"]\n" | sudo tee -a /etc/containers/registries.conf > /dev/null
|
|
```
|
|
|
|
##### 7. Creare /srv/containers e assegnare permessi
|
|
|
|
```bash
|
|
sudo mkdir -p /srv/containers
|
|
sudo chown -R $LOGNAME /srv/containers
|
|
```
|
|
|
|
##### 8. Banner SSH
|
|
|
|
Per installare il banner SSH, crea il file `/etc/issue` e copia il banner al suo interno:
|
|
|
|
```bash
|
|
sudo tee /etc/issue <<'EOF'
|
|
__________ .___ _____ .___
|
|
\______ \_____ __| _/ / _ \ | |
|
|
| | _/\__ \ / __ | / /_\ \| |
|
|
| | \ / __ \_/ /_/ | / | \ |
|
|
|______ /(____ /\____ | \____|__ /___|
|
|
\/ \/ \/ \/
|
|
|
|
B A D A I - H O S T ( D E B I A N , A M D G P U )
|
|
EOF
|
|
```
|
|
|
|
Se vuoi disabilitare altri script MOTD:
|
|
|
|
```bash
|
|
sudo bash -c 'for f in /etc/update-motd.d/*; do if [ -f "$f" ]; then mv "$f" "${f}.disabled"; fi; done'
|
|
```
|
|
|
|
Visualizza il banner con:
|
|
|
|
```bash
|
|
cat /etc/issue
|
|
```
|
|
|
|
##### 9. Configurare GRUB per GPU AMD
|
|
|
|
Se hai una GPU AMD, configura GRUB con i parametri appropriati:
|
|
|
|
```bash
|
|
# Seleziona la quantità di RAM disponibile: 16, 24, 32 o 48 GB
|
|
# Esempio per 32GB:
|
|
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="amdgpu.gttsize=32768 amdttm.pages_limit=36864000"/' /etc/default/grub
|
|
sudo update-grub
|
|
sudo reboot
|
|
```
|
|
|
|
**Valori di riferimento per GPU AMD:**
|
|
- 64 GB RAM: `amd_iommu=off amdgpu.gttsize=61440 ttm.pages_limit=15728640`
|
|
- 96 GB RAM: `amd_iommu=off amdgpu.gttsize=94208 ttm.pages_limit=24117248`
|
|
- 128 GB RAM: `amd_iommu=off amdgpu.gttsize=126976 ttm.pages_limit=32505856`
|
|
|
|
##### 10. Scaricare file container specifici
|
|
|
|
```bash
|
|
REPO_URL="https://code.badstorm.xyz/SRV/bdi_podman_serverconf/raw/main"
|
|
curl -fsSL $REPO_URL/containers/llamacpp/llamacpp.container -o ~/.config/containers/systemd/llamacpp.container
|
|
curl -fsSL $REPO_URL/containers/nginx/nginx.container -o ~/.config/containers/systemd/nginx.container
|
|
```
|
|
|
|
##### 11. Avviare i servizi
|
|
|
|
```bash
|
|
systemctl --user daemon-reload
|
|
systemctl --user start internal.network
|
|
systemctl --user start llamacpp nginx
|
|
```
|
|
|
|
##### 12. Utilizzo
|
|
|
|
Dopo l'installazione, i servizi container possono essere gestiti con:
|
|
|
|
```bash
|
|
podman ps # Elencare container attivi
|
|
podman logs <name> # Visualizzare log
|
|
systemctl --user status <service> # Verificare lo stato
|
|
systemctl --user restart <service> # Riavviare un servizio
|
|
``` |