参考:http://blog.csdn.net/vbskj/article/details/52129757
http://blog.csdn.net/vbskj/article/details/52129757
VNC server的安装不用多说。但问题是,安装完成后,只能看到terminal,看不到桌面与菜单。原因是VNC默认是不启动桌面环境的。
虽然linuxer们坚持认为一个terminal就够了,但这不是我的菜,还是要搞出桌面才够爽。
vnc server启动时,会调用“~/.vnc/xstartup”进行初始化,我们的任务就是在这里启动桌面环境。
ubuntu支持两种桌面环境:unity与gnome,(unity是对gnome的一种深度定制)
还写以选择安装一种轻量级桌面环境,xfce4。
原来计划搞定三种桌面环境,最终却没搞定ubuntu 14.04上默认支持的unity :(
不管怎么,三种方式都放到下面的脚本中了,unity仅作参考了。
安装gnome环境相关,sudo apt-get install ubuntu-desktopgnome-panel gnome-settings-daemon Metacity nautilus gnome-terminal
点击(此处)折叠或打开
- #!/bin/sh
-
- # DESK_TYPE=xfce
- DESK_TYPE=gnome
- # DESK_TYPE=unity
-
- # Uncomment the following two lines for normal desktop:
- unset SESSION_MANAGER
- unset DBUS_SESSION_BUS_ADDRESS
- # 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 &
-
- echo $DESK_TYPE
- # xfce desktop
- if test $DESK_TYPE = xfce; then
- x-terminal-emulator -geometry 80x24"$VNCDESKTOP Desktop"&
- x-session=-manager &
- xfdesktop & xfce4-panel &
- xfce4-menu-plugin &
- xfsettingsd &
- xfconfd i&
- xfwm4&
- fi
-
- # gnome desktop
- if test $DESK_TYPE = gnome; then
- gnome-session &
- gnome-panel &
- gnome-settings-daemon &
- Metacity &
- nautilus -n &
- gnome-terminal &
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings panel-main-menu"['F1']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings maximize"['KP_5']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings unmaximize"['F5']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings show-desktop"['d']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings switch-applications"['Tab']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings switch-group"['Above_Tab']"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings switch-input-source"[]"
- /usr/bin/gsettings set org.gnome.desktop.wm.keybindings switch-input-source-backward"[]"
- /usr/bin/gsettings set org.gnome.settings-daemon.plugins.media-keys terminal"['t']"
- fi
-
- # unity desktop
- if test $DESK_TYPE = unity; then
- export DESKTOP_SESSION=ubuntu
- export GDMSESSION=ubuntu
- export STARTUP="/usr/bin/gnome-session --session=ubuntu"
- $STARTUP &
- fi
vnc配置好后,如果希望开机启动,可以建立文件“/etc/vncserver/vncservers.conf”用来配置需要启动的server
点击(此处)折叠或打开
VNCSERVERS="1:hao-64 11:hao-64 12:hao-64 13:hao-64 14:hao-64 15:hao-64"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[11]="-geometry 1680x1050"
VNCSERVERARGS[12]="-geometry 1366x768"
VNCSERVERARGS[13]="-geometry 1280x1024"
VNCSERVERARGS[14]="-geometry 1024x768"
VNCSERVERARGS[15]="-geometry 800x600"