优化 CentOS 上的 VNC(Virtual Network Computing)速度,核心在于减少带宽占用、降低延迟、提升编码效率。以下从服务端配置、客户端配置、系统层面、网络四个维度给你一套实用优化方案(适用于 TigerVNC / RealVNC / x11vnc 等常见实现)。
推荐:TigerVNC
yum install tigervnc-server
TigerVNC 对图像压缩和带宽优化明显优于老版本 VNC。
编辑 VNC 启动参数或 ~/.vnc/config:
# ~/.vnc/config
geometry=1920x1080
depth=16
SecurityTypes=vncauth
推荐参数:
depth=16(比 24/32 位快很多)⚠️ 不建议使用 depth=32,除非必须真彩色。
GNOME / KDE 的动画会严重拖慢 VNC。
gsettings set org.gnome.desktop.interface enable-animations false
或切换到轻量桌面:
yum groupinstall "Xfce"
启动 VNC 时指定:
vncserver :1 -geometry 1920x1080 -depth 16 -xstartup /usr/bin/startxfce4
✅ Xfce / MATE 比 GNOME 快 2–5 倍
x11vnc(局域网推荐)如果你只是远程控制已有桌面:
x11vnc -display :0 -noxdamage -ncache 10
优点:
在 RealVNC / TigerVNC Viewer 中:
Tight 或 ZRLEMedium 或 LowAuto select
✅ Compress
❌ 关闭 Use default display settingsvncserver -geometry 1366x768
比 1920×1080 快很多。
systemctl disable bluetooth
systemctl disable cups
echo "net.ipv4.tcp_window_scaling = 1" >> /etc/sysctl.conf
echo "net.core.rmem_max = 8388608" >> /etc/sysctl.conf
echo "net.core.wmem_max = 8388608" >> /etc/sysctl.conf
sysctl -p
ssh -L 5901:localhost:5901 user@centos_ip
然后连接:
localhost:1
✅ 减少丢包、避免 VNC 被运营商限速
| 场景 | 建议 |
|---|---|
| 局域网 | VNC / x11vnc |
| 公网 | VNC + SSH |
| 超慢网络 | 换 X2Go / NoMachine |
如果 VNC 仍不理想,建议:
| 工具 | 说明 |
|---|---|
| X2Go | 基于 SSH,速度极快 |
| NoMachine | 商业级远程桌面 |
| RDP (xrdp) | Windows 风格,比 VNC 流畅 |
✅ CentOS + TigerVNC + Xfce + Tight 编码 + SSH
如果你愿意,可以告诉我:
我可以给你一套完全定制的 VNC 优化配置。