在Red Hat Enterprise Linux4下,默认的窗口管理器是metacity。不过有时候从Unix移植下来的程序为了与原Unix程序尽可能的相似,比如从HP Unix下移植下来的程序。那就需要变更窗口管理器,其中使用比较多的就是motif窗口管理器了。
启动xwindow有3种方式,第一种就是在/etc/inittab文件level设置为5的时候,开机就会自动运行xdm,当用户输入用户名和密码后,xwindow就启动。这种方式启动何种桌面由$HOME/.xsession配置文件决定,如果文件不存在,就由共通设定。所以这种启动方式下只要修.Xsession文件就可以了。示例文件如下
#
!
/
bin
/
sh
. / etc / X11 / xinit / xinitrc-common
/ usr / bin / X11 / kinput2 -canna&
/ usr / bin / gnome-panel&
/ usr / bin / gnome-terminal&
exec / usr / X11R6 / bin / mwm
. / etc / X11 / xinit / xinitrc-common
/ usr / bin / X11 / kinput2 -canna&
/ usr / bin / gnome-panel&
/ usr / bin / gnome-terminal&
exec / usr / X11R6 / bin / mwm
第二种启动方式就是用startx或者xinit命令启动。其中startx只是比xinit多做了一些环境设定工作,最后还是调用xinit。所以需要修改$HOME/.xinit文件,让其启动motif窗口管理器。示例文件如下
#
!
/
bin
/
sh
. / etc / X11 / xinit / xinitrc-common
/ usr / bin / X11 / kinput2 -canna&
/ usr / bin / gnome-panel&
/ usr / bin / gnome-terminal&
exec / usr / X11R6 / bin / mwm
. / etc / X11 / xinit / xinitrc-common
/ usr / bin / X11 / kinput2 -canna&
/ usr / bin / gnome-panel&
/ usr / bin / gnome-terminal&
exec / usr / X11R6 / bin / mwm
第三种方式就是利用vnc来进行画面的启动,在Linux中开启VNC Server,然后在别的Linux或者Windows中启动VNC Viewer。这种方式其实最终还是需要启动xinit文件,不过需要在$HOME/.vnc/xstarup文件中稍微做修改,不要指向默认的那个xinit系统共通文件,而是引用自己HOME下的xinit文件。如下所示
#
!
/
bin
/
sh
unset SESSION_MANAGER
exec $ HOME /. xinitrc
[ -x / etc / vnc / xstartup ] && exec / etc / vnc / xstartup
[ -r $ HOME /. Xresources ] && xrdb $ HOME /. Xresources
xsetroot -solid grey
vncconfig -iconic &
xset + fp unix / : 7100
xset fp rehash
startx &
unset SESSION_MANAGER
exec $ HOME /. xinitrc
[ -x / etc / vnc / xstartup ] && exec / etc / vnc / xstartup
[ -r $ HOME /. Xresources ] && xrdb $ HOME /. Xresources
xsetroot -solid grey
vncconfig -iconic &
xset + fp unix / : 7100
xset fp rehash
startx &