安装GNOME桌面环境
yum groupinstall "X Window System" "Desktop"
CentOS安装Xfce桌面环境,可选
yum groupinstall Xfce
安装tigervnc
yum install tigervnc-server tigervnc
设置远程登陆到gnome桌面的配置,再最后面加入如下两行:
vim /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -alwaysshared -depth 24"
修改远程桌面显示配置文件:修改为以下内容并保存
vim /root/.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" &
gnome-session & #set starting GNOME desktop
#startkde & #kde desktop
#twm & #Text interface
#/usr/bin/startxfce4
#exec /usr/bin/fluxbox
新建服务,执行多次则建多个服务,依次为 :1 :2 :3,每一次启动时会提示设置密码
vncserver
关闭具体的vncserver命令
vncserver -kill :1
vncserver -kill :2
开机启动
chkconfig vncserver on