一键安装rustdesk脚本,Centos,,Rocky,Ubuntu
admin2025-07-03115360
#!/bin/bash
RUSTDESK_VERSION=1.1.14
#wget https://github.com/rustdesk/rustdesk-server/releases/download/$RUSTDESK_VERSION/rustdesk-server-linux-amd64.zip
unzip rustdesk-server-linux-amd64.zip -d /usr/local/
mv /usr/local/amd64/ /usr/local/rustdesk
cat >> /etc/systemd/system/hbbs.service << EOF
[Unit]
Description=RustDesk HBBS Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/usr/local/rustdesk
ExecStart=/usr/local/rustdesk/hbbs
Restart=always
RestartSec=5
User=root
[Install]
WantedBy=multi-user.target
EOF
cat >> /etc/systemd/system/hbbr.service << EOF
[Unit]
Description=RustDesk HBBR Relay Server
After=network.target
[Service]
Type=simple
WorkingDirectory=/usr/local/rustdesk
ExecStart=/usr/local/rustdesk/hbbr
Restart=always
RestartSec=5
User=root
[Install]
WantedBy=multi-user.target
EOF
#设置开机自启动
systemctl daemon-reload
systemctl enable hbbs --now
systemctl enable hbbr --now
# 提高文件描述符限制
echo "* soft nofile 1000000" | sudo tee -a /etc/security/limits.conf
echo "* hard nofile 1000000" | sudo tee -a /etc/security/limits.conf
# 优化网络参数
echo "net.core.rmem_max = 67108864" | sudo tee -a /etc/sysctl.conf
echo "net.core.wmem_max = 67108864" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
#查看KEY
cat /usr/local/rustdesk/id_ed25519.pub