環境:ubuntu-16.04.6-desktop-amd64
第一步,獲取安裝文件
sudo apt-get install vnc4server
第二步,修改VNC Password
vncpasswd
第三步,檢查防火牆
查看端口開啓
sudo ufw status
如未打開端口5901,在使用防火牆的情況下來連接到一個遠程系統,需要打開端口5901.
sudo ufw allow 5901
然後重啓iptables服務.
/sbin/service iptables restart
第四步,啓動VNC server
vncserver -kill :1
vncserver :1
解決客戶端灰白界面
**1.**下載圖形化工具
apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal
**2.**修改~/.vnc/xstartup文件,添加如下內容:
vim ~/.vnc/xstartup
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
gnome-panel &
gnmoe-settings-daemon &
metacity &
nautilus &
gnome-terminal &
注:
1.停止某個vnc服務
vncserver -kill :端口號
2.客戶端連接
ip:1
xstartup文件參考
vim ~/.vnc/xstartup
#!/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-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &