您的位置:首页 > 其它

ubuntu14.04配置vnc4server

2017-07-20 13:41 393 查看
环境:

ubuntu14.04

今天花了一个上午终于理解了使用vnc4server搭建远程图形化server的方法:

其他步骤与网上的方法均大同小异,安装,开启,给权限:

sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal vnc4server
sudo chmod +x ~/.vnc/xstartup
开启:

vnc4server -geometry 1280x800 (此处分辨率可以自己设置)

要开启多个vncserver,只需要重复命令:

vnc4server
或者使用  :1 这种方式来指定端口:
vnc4server :1
vnc4servre :2
vnc4server :3
#...

关闭:

vnc4server -kill :1

不同之处在于

sudo gedit ~/.vnc/xstartup
的配置
,只有如下这样配置,我的远程机器登录时才能正常显示gnome桌面:


方案一:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

gnome-session &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &

方案二:

先安装

sudo apt-get update
sudo apt-get install xfce4


再修改

#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

#    x-session-manager &
#    xfdesktop & xfce4-panel &
#    xfce4-menu-plugin &
#    xfsettingsd &
#    xfconfd &
#    xfwm4 &

xrdb $HOME/.Xresources
startxfce4 &


添加开机启动:

按下Super键(也叫home键或者windows键,大多数键盘其实就是windows键)

在弹出来的搜索框里面搜索并打开startup applications

点击add

在弹出来的框里面填写以下内容:

Name: vnc4server

Command: vnc4server   :1

参考了以下文档,在此特别感谢各位 ๑乛◡乛๑:

http://blog.csdn.net/fisher_jiang/article/details/4192482
http://blog.163.com/thinki_cao/blog/static/83944875201303014531803/
http://www.cnblogs.com/lixigang/articles/5653405.html
http://blog.csdn.net/yangcs2009/article/details/9789845
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-ubuntu-14-04
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息