1.
用root帐户在命令行下执行vncserver
[root@tech ~]# vncserver
You will require a password to access your desktops.
Password:<输入密码>
Verify:<输入密码>
出现下面信息
New 'localhost.localdomain:1 (root)' desktop is localhost.localdomain:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost.localdomain:1.log
2.
首次创建 ~/.vnc/xstartup 时,指定的窗口管理器是 twm ,它是一个极小的窗口管理器,几乎每台 X Window 系统机器上都有 twm。twm 不具备完整“桌面管理器“
(象 KDE、GNOME或 WindowMaker)的大部分花哨功能。下面是修改过的示例(gnome):
[root@tech ~]# vi .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 &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
gnome-session & (这样改)
如果要启动KDE,需要修改为:
#!/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 &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &
startkde &
3.
编辑/etc/sysconfig/vncservers
[root@tech ~]# vi /etc/sysconfig/vncservers
找到如下类似的2行并改成下面那样
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768"
4.重启vncserver服务
[root@tech ~]# service vncserver restart
如果在浏览器中通过web方式访问VNC则 端口为:5801,如果通过VNC客户端(比如VNC Viewer)来访问VNC则端口为:5901
如有防火墙,开启5901 端口
阅读(1168) | 评论(0) | 转发(0) |