install.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. # install.sh — Installation manuelle de Konan (sans Docker)
  3. set -e
  4. echo "=== Installation de Konan ==="
  5. # 1. Dependances systeme
  6. echo "[1/5] Installation des dependances systeme..."
  7. sudo apt-get update -q
  8. sudo apt-get install -y ffmpeg libportaudio2 git wget python3 python3-venv alsa-utils
  9. # 2. Environnement Python
  10. echo "[2/5] Creation de l'environnement Python..."
  11. python3 -m venv ~/agent/venv
  12. ~/agent/venv/bin/pip install --upgrade pip -q
  13. ~/agent/venv/bin/pip install -r requirements.txt -q
  14. # 3. Voix Piper (masculine francaise)
  15. echo "[3/5] Telechargement de la voix Piper (fr_FR-tom-medium)..."
  16. mkdir -p ~/agent/voices
  17. BASE_URL="https://huggingface.co/rhasspy/piper-voices/resolve/main/fr/fr_FR/tom/medium"
  18. wget -q --show-progress -O ~/agent/voices/fr_FR-tom-medium.onnx "$BASE_URL/fr_FR-tom-medium.onnx"
  19. wget -q -O ~/agent/voices/fr_FR-tom-medium.onnx.json "$BASE_URL/fr_FR-tom-medium.onnx.json"
  20. # 4. Ollama
  21. echo "[4/5] Installation de Ollama..."
  22. if ! command -v ollama &> /dev/null; then
  23. curl -fsSL https://ollama.ai/install.sh | sh
  24. fi
  25. echo "Telechargement des modeles LLM (peut prendre plusieurs minutes)..."
  26. ollama pull qwen2.5:3b
  27. ollama pull qwen2.5-coder:3b
  28. # 5. Service systemd
  29. echo "[5/5] Configuration du service systemd..."
  30. sudo tee /etc/systemd/system/agent-bot.service > /dev/null << EOF
  31. [Unit]
  32. Description=Konan AI Assistant
  33. After=network.target ollama.service
  34. [Service]
  35. Type=simple
  36. User=$USER
  37. WorkingDirectory=$HOME/agent
  38. ExecStart=$HOME/agent/venv/bin/python3 $HOME/agent/bot.py
  39. Restart=always
  40. RestartSec=10
  41. StandardOutput=journal
  42. StandardError=journal
  43. [Install]
  44. WantedBy=multi-user.target
  45. EOF
  46. sudo systemctl daemon-reload
  47. sudo systemctl enable agent-bot
  48. sudo systemctl start agent-bot
  49. echo ""
  50. echo "=== Konan installe avec succes ! ==="
  51. echo ""
  52. echo "Commandes utiles :"
  53. echo " sudo systemctl status agent-bot # etat du bot"
  54. echo " journalctl -u agent-bot -f # logs en direct"
  55. echo " python3 ~/agent/konan_voice.py # interface vocale"
  56. echo ""
  57. echo "N'oublie pas de copier tes fichiers :"
  58. echo " - google_credentials.json -> ~/agent/"
  59. echo " - google_token.json -> ~/agent/ (si deja authentifie)"