First, install the desktop environment. I chose xfce, lightweight desktop, which is small and practical and does not occupy too much memory. (in terms of memory usage, xfce is less than KDE and KDE is less than gnome ).
Install xfce Desktop
At first, I thought that third-party software sources, such as rpmforge, should contain xfce desktops. As a result, it was a little surprising that they were included.
Open the corresponding link based on the system version:
Centos 5 32: http://download.fedoraproject.org/pub/epel/5/i386/
Centos 5 64-bit: http://download.fedoraproject.org/pub/epel/5/x86_64/
Centos 6 32: http://download.fedoraproject.org/pub/epel/6/i386/
Centos 6 64-bit: http://download.fedoraproject.org/pub/epel/6/x86_64/
Look for epel and you should find a epel-release-X-X.noarch.rpm package. Download and install it.
[[Email protected] ~] # Yum groupinstall xfce [[email protected] ~] # Yum groupinstall fonts (optional)
Install vncserver
[[Email protected] ~] # Yum install VNC-server (applicable to centos 5) [[email protected] ~] # Yum install tigervnc-server (applicable to centos 6)
Start vncserver
The first time you start vncserver, you need to enter the password twice.
[[email protected] mnt]# vncserverYou will require a password to access your desktops.Password:Verify:New ‘centos6.xman.org:1 (root)‘ desktop is centos6.xman.org:1Creating default startup script /root/.vnc/xstartupStarting applications specified in /root/.vnc/xstartupLog file is /root/.vnc/centos6.xman.org:1.log
Configure vncserver
Kill the VNC service and start configuring VNC
vncserver -kill :1
Modify the/etc/sysconfig/vncservers file.
VNCSERVERS="1:root"VNCSERVERARGS[1]="-geometry 800x600"
Resolution can be adjusted based on actual conditions. Generally, 1024x768 (XP), 1366X768 (win7)
Note that this item must be manually modified. If you only use vncserver to start the instance, you cannot add a boot item.
To set multiple users, use the following format:
VNCSERVERS="1:one 2:two 3:three"VNCSERVERARGS[1]="-geometry 800×600"VNCSERVERARGS[2]="-geometry 800×600"VNCSERVERARGS[3]="-geometry 800×600"
Configure VNC Desktop
Modify the/root/. VNC/xstartup file and replace the file with the following:
#!/bin/sh/usr/bin/startxfce4
After saving, add the execution permission to xstartup:
chmod +x ~/.vnc/xstartup
After configuration, start vncserver:
vncserver
Run the following command to check whether port 5901 is Enabled:
netstat -lptn
Note that if the port is opened but cannot be connected, you must set firewall rules. Otherwise, the port 59xx cannot be connected.
Then, set the vncserver to automatically start upon startup. Enter the following:
chkconfig vncserver on
How to install Firefox in centos:
yum install firefox
In this way, the desktop can be accessed through vncviewer, reminding you that the server address of vncviewer is: IP: 1
Install xfce + VNC in centos