VNC Server (Ubuntu 16.04.3 GNOME)

时间:2021-04-12 00:32:54

1. 安装VNC服务

sudo apt-get install vnc4server -y

2. 启动VNC服务

vncserver :1

3. 此时客户端连上后你会发现灰屏,原因出在~/.vnc/xstart这个配置文件,在最后加上如下参数即可:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager & gnome-session & gnome-panel & gnmoe-settings-daemon & metacity & nautilus & gnome-terminal &

4. 再连,你会发现只有nautilus文件浏览器。

5. 安装gnome-panel

sudo apt-get install gnome-panel -y

6. 设置开机启动,crontab -e中加入以下行:

@reboot /usr/bin/vncserver :1