ubuntu安装vnc

ubuntu安装vnc


环境: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 &

你可能感兴趣的:(ubuntu)