Ubuntu 16.04 构建 Headless VNC 服务器

终于放弃 Vino 了, 稳定性太低了。

而且,拔了显示器之后,总出现分辨率不对的问题。 

于是,构建了一个 xfce4 + tightvnc 的 解决方案。

1) 把Vino相关的自启动都关了。 (vino-preference里)

2 )  默认的 graphical.target 会占用 DISPLAY :0 的, 所以改成别的Target

sudo systemctl set-default multi-user.target

3)安装 xfce

    sudo apt-get update
    sudo apt install xfce4 xfce4-goodies tightvncserver

 4 ) 修改 ~/.vnc/xstartup

#!/bin/bash
xrdb $HOME/.Xresources
. /etc/X11/Xsession startxfce4 &

5 ) 在 rc.local 里启动 tightvnc

su oracle  -c "vncserver -geometry 1600x900 -alwaysshared :0 "

6 ) 在客户端连接

#只有DISPLAY >= :1 的情况下,才需要 ::5901
<hostname>::5901

https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-16-04

https://help.ubuntu.com/community/VNC/Servers

已知问题(别尝试解决,试过环境变量,无效),virtualbox的键位错乱:

https://unix.stackexchange.com/questions/346107/keyboard-mapping-wrong-only-in-specific-applications-under-tightvnc

原文地址:https://www.cnblogs.com/johnsonshu/p/8426332.html