CentOS:Xfce+VNC安装
准备构建一个VirtualBox虚拟机模板,当然是CentOS了,当前最新为6.6x86_64.
1、安装minimal版本,不安装任何其他包,磁盘新建为50G动态划分,选用LVM默认创建的逻辑卷,网卡桥接,网络配置为静态IP
2、安装完成后进入系统,执行系统更新
yum upgrade
3、安装EPEL源
yum install wget wget http://mirrors.hustunique.com/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm
4、安装XFce桌面系统
yum grouplist | grep X yum groupinstall "X Window System" yum groupinstall Xfce
记得看看文件夹权限,将文件夹权限改一下,不然鼠标没办法用:
chown –R haldaemon.haldaemon /var/cache/hald
这一步完成之后,应该是可以启动桌面了
startxfce4
这时的界面为英文,桌面奇丑无比,修改locale后重启XFce会自动变成中文
vi /etc/prpfile export LANG=zh_CN.UTF-8
然后安装文泉驿字体,改一个桌面主题,大概会好看很多
yum search wqy yum install wqy*
5、安装VNC
yum install tigervnc tigervnc-server
配置VNC
vi /etc/sysconfig/vncservers VNCSERVERS="1:root" VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp " #如果配置多个用户 VNCSERVERS="1:root 2:linus" VNCSERVERARGS[1]="-geometry 800x600 -nolisten tcp " VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp "
设置vnc密码
vncpasswd
启动VNC
service vncserver start
这时候,连接ip:1或者ip:2还是会有问题,倒是能连上,不过呈现一副图片,啥都没有,需要修改启动脚本:
vi ~/.vnc/xstartup #!/bin/sh [ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n export LANG export SYSFONT vncconfig -iconic & # unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS OS=`uname -s` if [ $OS = 'Linux' ]; then case "$WINDOWMANAGER" in *gnome*) if [ -e /etc/SuSE-release ]; then PATH=$PATH:/opt/gnome/bin export PATH fi ;; esac fi # if [ -x /etc/X11/xinit/xinitrc ]; then # exec /etc/X11/xinit/xinitrc # fi # if [ -f /etc/X11/xinit/xinitrc ]; then # exec sh /etc/X11/xinit/xinitrc # fi [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & startxfce4 &
改成这样反正是能连上了,打完收工~
参考文章:
http://my.oschina.net/std/blog/117407
https://www.centos.org/forums/viewtopic.php?t=6539