Ubuntu 无显示器情况下的远程控制


一、安装vnc4server

服务器安装:sudo apt-get install vnc4server

安装后执行vncserver会让你输入vnc客户端登录时输入的帐号和密码

安装后vncserver 会在HOME/.vnc下生成xstartup文件

修改该文件,把默认VNC启动的twm改成希望启动的gnome

修改方法是把文件后面的三行文字全部注释掉, 然后在最后面加上gnome-session & 我的文件内容是

#!/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 &

二、重新启动后再进入

sudo reboot

vncserver 启动服务

另添加的一块不知道是不是有用,我也没有去验证,如果上面的没有你可以添加或编译该文件

sudo vi /etc/X11/xorg.conf
内容如下,建议直接copy
Section "Device" Identifier "VNC Device" Driver "vesa" EndSection   Section "Screen" Identifier "VNC Screen" Device "VNC Device" Monitor "VNC Monitor" SubSection "Display" Modes "1024x768" EndSubSection EndSection   Section "Monitor" Identifier "VNC Monitor" HorizSync 30-70 VertRefresh 50-75 EndSection
三、把vncserver添加到自启动项中

相关内容