496 lines
5.6 KiB
Markdown
496 lines
5.6 KiB
Markdown
# Supermicro X9DRW-iF AI Coding Server
|
|
## Guida Completa Setup Produzione CPU-Only
|
|
|
|
## Hardware
|
|
|
|
### Server
|
|
- Supermicro X9DRW-iF
|
|
- 2x Intel Xeon E5-2680 v2
|
|
- 256GB ECC DDR3
|
|
|
|
### Storage
|
|
- SSD SATA 128GB
|
|
- HDD WD Red 2TB
|
|
|
|
### Obiettivo
|
|
Server AI locale per:
|
|
- coding assistant
|
|
- repository analysis
|
|
- RAG
|
|
- AI agent
|
|
- inferenza locale CPU-only
|
|
- accesso web LAN
|
|
|
|
---
|
|
|
|
# Architettura Finale
|
|
|
|
## SSD 128GB
|
|
Sistema operativo + runtime AI
|
|
|
|
Contiene:
|
|
- Debian
|
|
- Ollama
|
|
- Open WebUI
|
|
- cache runtime
|
|
- modello attivo
|
|
|
|
---
|
|
|
|
## HDD 2TB
|
|
Storage AI
|
|
|
|
Contiene:
|
|
- modelli GGUF
|
|
- repository Git
|
|
- vector database
|
|
- dataset
|
|
- backup
|
|
|
|
---
|
|
|
|
# 1. Installazione Debian
|
|
|
|
## ISO consigliata
|
|
|
|
Debian 12 minimal netinstall
|
|
|
|
Sito:
|
|
https://www.debian.org/download
|
|
|
|
---
|
|
|
|
## Durante installazione
|
|
|
|
### Selezionare:
|
|
- SSH Server
|
|
- Standard system utilities
|
|
|
|
### NON selezionare:
|
|
- Desktop Environment
|
|
- GNOME
|
|
- KDE
|
|
- print server
|
|
- web server
|
|
|
|
---
|
|
|
|
# 2. Configurazione dischi
|
|
|
|
## SSD 128GB
|
|
|
|
### Partizionamento
|
|
|
|
| Mount | Size |
|
|
|---|---|
|
|
| / | 100GB |
|
|
| swap | 8-16GB |
|
|
|
|
Filesystem:
|
|
- ext4
|
|
|
|
---
|
|
|
|
## HDD 2TB
|
|
|
|
Filesystem:
|
|
- ext4
|
|
|
|
Mount point:
|
|
|
|
```bash
|
|
/mnt/ai-data
|
|
```
|
|
|
|
---
|
|
|
|
# 3. Primo avvio
|
|
|
|
Aggiornare sistema:
|
|
|
|
```bash
|
|
sudo apt update && sudo apt upgrade -y
|
|
```
|
|
|
|
Installare utility:
|
|
|
|
```bash
|
|
sudo apt install -y \
|
|
git curl wget htop btop tmux nano \
|
|
build-essential cmake python3 python3-pip \
|
|
nvme-cli unzip
|
|
```
|
|
|
|
---
|
|
|
|
# 4. Configurazione HDD
|
|
|
|
## Identificare UUID
|
|
|
|
```bash
|
|
sudo blkid
|
|
```
|
|
|
|
## Creare mountpoint
|
|
|
|
```bash
|
|
sudo mkdir -p /mnt/ai-data
|
|
```
|
|
|
|
## Modificare fstab
|
|
|
|
```bash
|
|
sudo nano /etc/fstab
|
|
```
|
|
|
|
Aggiungere:
|
|
|
|
```fstab
|
|
UUID=INSERISCI_UUID /mnt/ai-data ext4 defaults,noatime 0 2
|
|
```
|
|
|
|
## Test mount
|
|
|
|
```bash
|
|
sudo mount -a
|
|
```
|
|
|
|
Verifica:
|
|
|
|
```bash
|
|
df -h
|
|
```
|
|
|
|
---
|
|
|
|
# 5. Ottimizzazioni CPU
|
|
|
|
## Installare cpupower
|
|
|
|
```bash
|
|
sudo apt install linux-cpupower -y
|
|
```
|
|
|
|
## Impostare governor performance
|
|
|
|
```bash
|
|
sudo cpupower frequency-set -g performance
|
|
```
|
|
|
|
Verifica:
|
|
|
|
```bash
|
|
cpupower frequency-info
|
|
```
|
|
|
|
---
|
|
|
|
# 6. Installazione Ollama
|
|
|
|
```bash
|
|
curl -fsSL https://ollama.com/install.sh | sh
|
|
```
|
|
|
|
Verifica:
|
|
|
|
```bash
|
|
ollama --version
|
|
```
|
|
|
|
---
|
|
|
|
# 7. Spostare storage modelli su HDD
|
|
|
|
```bash
|
|
sudo mkdir -p /mnt/ai-data/ollama
|
|
sudo systemctl stop ollama
|
|
sudo mv /usr/share/ollama/* /mnt/ai-data/ollama/
|
|
sudo rm -rf /usr/share/ollama
|
|
sudo ln -s /mnt/ai-data/ollama /usr/share/ollama
|
|
sudo systemctl start ollama
|
|
```
|
|
|
|
---
|
|
|
|
# 8. Ottimizzazione Ollama
|
|
|
|
```bash
|
|
sudo mkdir -p /etc/systemd/system/ollama.service.d
|
|
sudo nano /etc/systemd/system/ollama.service.d/override.conf
|
|
```
|
|
|
|
Contenuto:
|
|
|
|
```ini
|
|
[Service]
|
|
Environment="OLLAMA_NUM_PARALLEL=1"
|
|
Environment="OLLAMA_MAX_LOADED_MODELS=1"
|
|
Environment="OLLAMA_KEEP_ALIVE=24h"
|
|
Environment="OLLAMA_HOST=0.0.0.0:11434"
|
|
```
|
|
|
|
Reload:
|
|
|
|
```bash
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl restart ollama
|
|
```
|
|
|
|
---
|
|
|
|
# 9. Installazione Docker
|
|
|
|
```bash
|
|
curl -fsSL https://get.docker.com | sh
|
|
sudo usermod -aG docker $USER
|
|
```
|
|
|
|
Logout/login richiesto.
|
|
|
|
---
|
|
|
|
# 10. Installazione Open WebUI
|
|
|
|
```bash
|
|
docker run -d \
|
|
-p 3000:8080 \
|
|
-v open-webui:/app/backend/data \
|
|
--name open-webui \
|
|
--restart always \
|
|
ghcr.io/open-webui/open-webui:main
|
|
```
|
|
|
|
---
|
|
|
|
# 11. Accesso WebUI
|
|
|
|
```text
|
|
http://IP_SERVER:3000
|
|
```
|
|
|
|
---
|
|
|
|
# 12. Installazione modelli
|
|
|
|
## Qwen2.5 Coder 7B
|
|
|
|
```bash
|
|
ollama pull qwen2.5-coder:7b
|
|
```
|
|
|
|
## Qwen2.5 Coder 14B
|
|
|
|
```bash
|
|
ollama pull qwen2.5-coder:14b
|
|
```
|
|
|
|
## DeepSeek Coder
|
|
|
|
```bash
|
|
ollama pull deepseek-coder:6.7b
|
|
```
|
|
|
|
---
|
|
|
|
# 13. Prestazioni attese
|
|
|
|
| Modello | Velocità |
|
|
|---|---|
|
|
| 7B Q4 | 6-15 tok/s |
|
|
| 14B | 3-7 tok/s |
|
|
| 32B | 1-3 tok/s |
|
|
|
|
---
|
|
|
|
# 14. Integrazione VSCode
|
|
|
|
VSCode:
|
|
https://code.visualstudio.com/
|
|
|
|
Continue:
|
|
https://continue.dev/
|
|
|
|
Config esempio:
|
|
|
|
```yaml
|
|
name: Smart Local Router
|
|
version: 1.0.0
|
|
schema: v1
|
|
|
|
models:
|
|
# 🧠 CODING MODEL (DEFAULT)
|
|
- name: DeepSeek Coder
|
|
provider: ollama
|
|
model: deepseek-coder-v2:16b
|
|
apiBase: http://192.168.1.250:11434
|
|
roles:
|
|
- chat
|
|
- edit
|
|
- apply
|
|
|
|
# 🤖 AGENT MODEL
|
|
- name: Qwen Agent
|
|
provider: ollama
|
|
model: qwen2.5-coder:14b
|
|
apiBase: http://192.168.1.250:11434
|
|
roles:
|
|
- chat
|
|
- edit
|
|
- apply
|
|
|
|
context:
|
|
- provider: code
|
|
- provider: diff
|
|
- provider: terminal
|
|
- provider: problems
|
|
- provider: folder
|
|
- provider: repo-map
|
|
- provider: os
|
|
```
|
|
|
|
---
|
|
|
|
# 15. Installazione Aider
|
|
|
|
```bash
|
|
pip install aider-chat
|
|
```
|
|
|
|
Uso:
|
|
|
|
```bash
|
|
cd progetto
|
|
aider
|
|
```
|
|
|
|
Esempi:
|
|
- Refactor this class
|
|
- Add JWT authentication
|
|
- Write unit tests
|
|
|
|
---
|
|
|
|
# 16. Struttura consigliata
|
|
|
|
```text
|
|
/mnt/ai-data/
|
|
├── models/
|
|
├── repos/
|
|
├── embeddings/
|
|
├── vector-db/
|
|
├── backups/
|
|
└── datasets/
|
|
```
|
|
|
|
---
|
|
|
|
# 17. Monitoring
|
|
|
|
```bash
|
|
htop
|
|
btop
|
|
```
|
|
|
|
Temperature:
|
|
|
|
```bash
|
|
sudo apt install lm-sensors
|
|
sudo sensors-detect
|
|
sensors
|
|
```
|
|
|
|
---
|
|
|
|
# 18. Firewall
|
|
|
|
```bash
|
|
sudo apt install ufw
|
|
sudo ufw allow ssh
|
|
sudo ufw allow 3000/tcp
|
|
sudo ufw allow 11434/tcp
|
|
sudo ufw enable
|
|
```
|
|
|
|
---
|
|
|
|
# 19. Accesso SSH
|
|
|
|
```bash
|
|
ssh utente@IP_SERVER
|
|
```
|
|
|
|
---
|
|
|
|
# 20. Upgrade futuri
|
|
|
|
1. SSD più grande
|
|
2. RTX 3090
|
|
3. NVMe PCIe adapter
|
|
4. Più storage
|
|
|
|
---
|
|
|
|
# 21. Workflow consigliato
|
|
|
|
1. VSCode + Continue
|
|
2. Ollama locale
|
|
3. Aider per refactor
|
|
4. Open WebUI per chat
|
|
5. Repository indicizzati
|
|
|
|
---
|
|
|
|
# 22. Comandi utili
|
|
|
|
Lista modelli:
|
|
|
|
```bash
|
|
ollama list
|
|
```
|
|
|
|
Eseguire modello:
|
|
|
|
```bash
|
|
ollama run qwen2.5-coder:7b
|
|
```
|
|
|
|
Eliminare modello:
|
|
|
|
```bash
|
|
ollama rm nome-modello
|
|
```
|
|
|
|
Stato servizio:
|
|
|
|
```bash
|
|
systemctl status ollama
|
|
```
|
|
|
|
---
|
|
|
|
# Fine
|
|
|
|
Configurazione attuale:
|
|
|
|
# Skynet.lbs.farm
|
|
|
|
### Utente
|
|
```
|
|
user lbsadmin
|
|
pwd <solita>
|
|
```
|
|
|
|
### Per monitorare le risorse
|
|
|
|
```bash
|
|
bashtop
|
|
```
|
|
|
|
### Modello usato
|
|
|
|
```bash
|
|
ollama pull deepseek-coder-v2:16b
|
|
ollama pull qwen2.5-coder:14b
|
|
```
|
|
|