Account Links: Cart | Register | Log In

Skip to content

Red Hat Knowledgebase
Red Hat Knowledgebase Search
Article translations:
Currently Being Moderated

如何设置VNC使之在启动时运行GNOME或KDE?

Article ID: 11362 - Created on: Jul 22, 2008 6:00 PM - Last Modified:  Jun 5, 2009 5:04 AM

[英文原文] How do I configure VNC to start GNOME or KDE by default in Red Hat Enterprise Linux version 2.1?

相关版本:Red Hat Enterprise Linux 3,Red Hat Enterprise Linux 4,Red Hat Enterprise Linux 5

VNC xstartup程序中默认的设定值是启动twm,而不是GNOME或KDE。

默认的配置文件在第一次启动vncserver之前,运行vncpasswd命令创建密码的时候生成在用户的家目录中:


${HOME}/.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或者KDE,先去掉“unset SESSION_MANAGER“和”exec /etc/X11/xinit/xinitrc“这两行的注释,然后将twm&注释掉,最后添加“gnome-start”,其设置如下:


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

类似的,如果要启动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 &

修改配置文件后,关闭所有客户端vncviewer连接,然后重启动VNC,GNOME或KDE即已做为默认桌面。


service vncserver restart
Feedback from users like yourself is a critical factor in helping us make the Red Hat Knowledgebase as useful as possible.

More Like This

  • Retrieving data ...