Ai Install Hermes In Incus: Difference between revisions
Jump to navigation
Jump to search
(Created page with "= راهنمای جامع صفر تا صد: نصب Incus، راهاندازی کانتینر Ubuntu و داشبورد وب Hermes Agent = == بخش اول: نصب و راهاندازی Incus روی سرور اصلی (Host) == # ۱. نصب پیشنیازها و افزودن مخزن رسمی Zabbly sudo apt-get update sudo apt-get install -y curl gpg sudo mkdir -p /etc/apt/keyrings/ curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc sud...") |
No edit summary |
||
| Line 1: | Line 1: | ||
= راهنمای جامع صفر تا صد: نصب Incus، | = راهنمای جامع صفر تا صد: نصب Incus، کانتینر Ubuntu و داشبورد وب Hermes Agent = | ||
== بخش اول: | == بخش اول: راهاندازی Incus و کانتینر روی سرور اصلی (Host) == | ||
'''۱. نصب پیشنیازها و افزودن مخزن رسمی Zabbly:''' | |||
<pre> | |||
sudo apt-get update | sudo apt-get update | ||
sudo apt-get install -y curl gpg | sudo apt-get install -y curl gpg | ||
| Line 18: | Line 19: | ||
Signed-By: /etc/apt/keyrings/zabbly.asc | Signed-By: /etc/apt/keyrings/zabbly.asc | ||
EOF' | EOF' | ||
</pre> | |||
'''۲. نصب پکیجهای Incus و مقداردهی اولیه:''' | |||
<pre> | |||
sudo apt-get update | sudo apt-get update | ||
sudo apt-get install -y incus incus-ui-canonical | sudo apt-get install -y incus incus-ui-canonical | ||
| Line 25: | Line 28: | ||
newgrp incus-admin | newgrp incus-admin | ||
incus admin init --auto | incus admin init --auto | ||
</pre> | |||
'''۳. ساخت کانتینر Ubuntu 24.04 و ورود به آن:''' | |||
<pre> | |||
incus launch images:ubuntu/24.04 incus-ubuntu-hermes | incus launch images:ubuntu/24.04 incus-ubuntu-hermes | ||
incus list | incus list | ||
incus exec incus-ubuntu-hermes -- bash | incus exec incus-ubuntu-hermes -- bash | ||
</pre> | |||
== بخش دوم: تنظیمات و نصب داشبورد داخل کانتینر == | |||
'''۱. بهروزرسانی و نصب Hermes Agent:''' | |||
<pre> | |||
apt update && apt install -y curl git tar xz-utils socat python3 nano | apt update && apt install -y curl git tar xz-utils socat python3 nano | ||
curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash | curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash | ||
source ~/.bashrc | source ~/.bashrc | ||
</pre> | |||
'''۲. تولید هش امن رمز عبور (scrypt):''' | |||
<pre> | |||
HASH=$(/root/.hermes/bin/uv run python - << 'EOF' | HASH=$(/root/.hermes/bin/uv run python - << 'EOF' | ||
import sys | import sys | ||
sys.path.insert(0, '/usr/local/lib/hermes-agent') | sys.path.insert(0, '/usr/local/lib/hermes-agent') | ||
from plugins.dashboard_auth.basic import hash_password | from plugins.dashboard_auth.basic import hash_password | ||
print(hash_password(" | print(hash_password("TestPass@2026")) | ||
EOF | EOF | ||
) | ) | ||
</pre> | |||
'''۳. تنظیم دامنه و احراز هویت در config.yaml:''' | |||
<pre> | |||
mkdir -p /root/.hermes | mkdir -p /root/.hermes | ||
sed -i '/^dashboard:/,$d' /root/.hermes/config.yaml | sed -i '/^dashboard:/,$d' /root/.hermes/config.yaml | ||
| Line 66: | Line 68: | ||
public_url: "http://s5.sovi.ir:9119" | public_url: "http://s5.sovi.ir:9119" | ||
basic_auth: | basic_auth: | ||
username: " | username: "admin" | ||
password_hash: "$HASH" | password_hash: "$HASH" | ||
EOF | EOF | ||
</pre> | |||
'''۴. ساخت سرویس systemd داشبورد Hermes:''' | |||
<pre> | |||
cat << 'EOF' > /etc/systemd/system/hermes-dashboard.service | cat << 'EOF' > /etc/systemd/system/hermes-dashboard.service | ||
[Unit] | [Unit] | ||
| Line 90: | Line 94: | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
EOF | EOF | ||
</pre> | |||
'''۵. ساخت سرویس فورواردر پورت socat:''' | |||
<pre> | |||
cat << 'EOF' > /etc/systemd/system/hermes-proxy.service | cat << 'EOF' > /etc/systemd/system/hermes-proxy.service | ||
[Unit] | [Unit] | ||
| Line 106: | Line 112: | ||
WantedBy=multi-user.target | WantedBy=multi-user.target | ||
EOF | EOF | ||
</pre> | |||
'''۶. فعالسازی و راهاندازی سرویسها:''' | |||
<pre> | |||
systemctl daemon-reload | systemctl daemon-reload | ||
systemctl enable --now hermes-dashboard hermes-proxy | systemctl enable --now hermes-dashboard hermes-proxy | ||
exit | exit | ||
</pre> | |||
== بخش سوم: فوروارد پورت روی سرور اصلی (Host) == | |||
'''اتصال پورت به اینترنت از طریق Incus Proxy:''' | |||
<pre> | |||
incus config device add incus-ubuntu-hermes hermes-web-port proxy listen=tcp:0.0.0.0:9119 connect=tcp:127.0.0.1:9120 | incus config device add incus-ubuntu-hermes hermes-web-port proxy listen=tcp:0.0.0.0:9119 connect=tcp:127.0.0.1:9120 | ||
ss -tulpn | grep 9119 | ss -tulpn | grep 9119 | ||
</pre> | |||
== بخش چهارم: مشخصات ورود و دستورات مدیریتی == | |||
= | {| class="wikitable" | ||
! پارامتر !! مقدار | |||
|- | |||
| آدرس در مرورگر || <code>http://s5.sovi.ir:9119</code> | |||
|- | |||
| نام کاربری (Username) || <code>admin</code> | |||
|- | |||
| رمز عبور تستی (Password) || <code>TestPass@2026</code> | |||
|} | |||
=== دستورات | === دستورات کاربردی مدیریت: === | ||
{| class="wikitable" | |||
! عملیات !! دستور | |||
|- | |||
| ورود به ترمینال کانتینر || <code>incus exec incus-ubuntu-hermes -- bash</code> | |||
|- | |||
| مشاهده لاگ زنده || <code>journalctl -u hermes-dashboard -f</code> | |||
|- | |||
| ریستارت داشبورد || <code>systemctl restart hermes-dashboard</code> | |||
|- | |||
| خاموش / روشن کردن || <code>incus stop incus-ubuntu-hermes</code> / <code>incus start incus-ubuntu-hermes</code> | |||
|} | |||
Revision as of 21:29, 27 August 2026
راهنمای جامع صفر تا صد: نصب Incus، کانتینر Ubuntu و داشبورد وب Hermes Agent
بخش اول: راهاندازی Incus و کانتینر روی سرور اصلی (Host)
۱. نصب پیشنیازها و افزودن مخزن رسمی Zabbly:
sudo apt-get update
sudo apt-get install -y curl gpg
sudo mkdir -p /etc/apt/keyrings/
curl -fsSL https://pkgs.zabbly.com/key.asc -o /etc/apt/keyrings/zabbly.asc
sudo sh -c 'cat <<EOF > /etc/apt/sources.list.d/zabbly-incus-stable.sources
Enabled: yes
Types: deb
URIs: https://pkgs.zabbly.com/incus/stable
Suites: $(. /etc/os-release && echo ${VERSION_CODENAME})
Components: main
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/zabbly.asc
EOF'
۲. نصب پکیجهای Incus و مقداردهی اولیه:
sudo apt-get update sudo apt-get install -y incus incus-ui-canonical sudo usermod -aG incus-admin $USER newgrp incus-admin incus admin init --auto
۳. ساخت کانتینر Ubuntu 24.04 و ورود به آن:
incus launch images:ubuntu/24.04 incus-ubuntu-hermes incus list incus exec incus-ubuntu-hermes -- bash
بخش دوم: تنظیمات و نصب داشبورد داخل کانتینر
۱. بهروزرسانی و نصب Hermes Agent:
apt update && apt install -y curl git tar xz-utils socat python3 nano curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash source ~/.bashrc
۲. تولید هش امن رمز عبور (scrypt):
HASH=$(/root/.hermes/bin/uv run python - << 'EOF'
import sys
sys.path.insert(0, '/usr/local/lib/hermes-agent')
from plugins.dashboard_auth.basic import hash_password
print(hash_password("TestPass@2026"))
EOF
)
۳. تنظیم دامنه و احراز هویت در config.yaml:
mkdir -p /root/.hermes
sed -i '/^dashboard:/,$d' /root/.hermes/config.yaml
cat << EOF >> /root/.hermes/config.yaml
dashboard:
public_url: "http://s5.sovi.ir:9119"
basic_auth:
username: "admin"
password_hash: "$HASH"
EOF
۴. ساخت سرویس systemd داشبورد Hermes:
cat << 'EOF' > /etc/systemd/system/hermes-dashboard.service [Unit] Description=Hermes Agent Web Dashboard After=network.target [Service] Type=simple User=root WorkingDirectory=/root Environment="PATH=/usr/local/bin:/root/.hermes/bin:/usr/local/share/uv/bin:/usr/bin:/bin" ExecStart=/usr/local/bin/hermes dashboard --host 127.0.0.1 --port 9119 --no-open --skip-build Restart=always RestartSec=5 StandardOutput=journal StandardError=journal [Install] WantedBy=multi-user.target EOF
۵. ساخت سرویس فورواردر پورت socat:
cat << 'EOF' > /etc/systemd/system/hermes-proxy.service [Unit] Description=Expose Hermes Dashboard to Network After=hermes-dashboard.service [Service] Type=simple ExecStart=/usr/bin/socat TCP4-LISTEN:9120,fork,reuseaddr TCP4:127.0.0.1:9119 Restart=always RestartSec=3 [Install] WantedBy=multi-user.target EOF
۶. فعالسازی و راهاندازی سرویسها:
systemctl daemon-reload systemctl enable --now hermes-dashboard hermes-proxy exit
بخش سوم: فوروارد پورت روی سرور اصلی (Host)
اتصال پورت به اینترنت از طریق Incus Proxy:
incus config device add incus-ubuntu-hermes hermes-web-port proxy listen=tcp:0.0.0.0:9119 connect=tcp:127.0.0.1:9120 ss -tulpn | grep 9119
بخش چهارم: مشخصات ورود و دستورات مدیریتی
| پارامتر | مقدار |
|---|---|
| آدرس در مرورگر | http://s5.sovi.ir:9119
|
| نام کاربری (Username) | admin
|
| رمز عبور تستی (Password) | TestPass@2026
|
دستورات کاربردی مدیریت:
| عملیات | دستور |
|---|---|
| ورود به ترمینال کانتینر | incus exec incus-ubuntu-hermes -- bash
|
| مشاهده لاگ زنده | journalctl -u hermes-dashboard -f
|
| ریستارت داشبورد | systemctl restart hermes-dashboard
|
| خاموش / روشن کردن | incus stop incus-ubuntu-hermes / incus start incus-ubuntu-hermes
|