温馨提示×

怎样卸载Ubuntu VNC

小樊
37
2026-07-27 04:12:40
栏目: 智能运维

在 Ubuntu 上卸载 VNC,主要取决于你安装的是哪一种 VNC。下面按常见情况给你完整步骤(含清理配置)。


一、先确认你安装的是哪种 VNC

先查看已安装的 VNC 相关包:

dpkg -l | grep vnc

常见类型:

  • TightVNC
  • TigerVNC
  • x11vnc
  • RealVNC
  • Ubuntu 桌面自带的“屏幕共享”

二、卸载常见 VNC(选对应的一项)

✅ 1. 卸载 TightVNC

sudo apt remove --purge tightvncserver
sudo apt autoremove

如果还装了客户端:

sudo apt remove --purge xtightvncviewer

✅ 2. 卸载 TigerVNC

sudo apt remove --purge tigervnc-standalone-server tigervnc-common
sudo apt autoremove

✅ 3. 卸载 x11vnc

sudo apt remove --purge x11vnc
sudo apt autoremove

✅ 4. 卸载 RealVNC(官方 .deb 安装)

sudo apt remove --purge realvnc-vnc-server realvnc-vnc-viewer
sudo apt autoremove

三、停止并禁用 VNC 服务(很重要)

如果你之前设置过 systemd 服务:

sudo systemctl stop vncserver@1.service
sudo systemctl disable vncserver@1.service

:1 可能不同,用 systemctl list-units | grep vnc 查看)

删除服务文件(如有):

sudo rm /etc/systemd/system/vncserver@.service
sudo systemctl daemon-reload

四、清理 VNC 配置和数据(可选)

删除用户 VNC 配置

rm -rf ~/.vnc

里面通常包含:

  • passwd
  • xstartup
  • 日志文件

五、如果你用的是 Ubuntu 桌面“屏幕共享”

这是 内置 VNC(基于 Vino),不是单独安装的:

sudo apt remove --purge vino

或在桌面设置中:

设置 → 共享 → 屏幕共享 → 关闭


六、确认是否卸载干净

vncserver --version

which vncserver

如果提示 command not found,说明已卸载成功 ✅


七、需要我帮你判断是哪一种吗?

你可以直接把下面命令的输出发给我:

dpkg -l | grep vnc

我可以精确告诉你该执行哪几条命令,避免误删。

0