Install GNOME on CentOS and setup vnc server

# yum -y groupinstall “Desktop” “Desktop Platform” “X Window System” “Fonts”

You can also install the following optional GUI packages.

# yum -y groupinstall “Graphical Administration Tools”
# yum -y groupinstall “Internet Browser”
# yum -y groupinstall “General Purpose Desktop”
# yum -y groupinstall “Office Suite and Productivity”
# yum -y groupinstall “Graphics Creation Tools”
Finally, if you wanted to add the K Desktop Environment (KDE).
# yum -y groupinstall kde-desktop

When using yum groupinstall, the groupinstall option only installs default and mandatory packages from the group. There are times when you also want to include optional packages within a group. I have not figured out (yet) how to control which package types to install (group package “policy”) from the command-line using yum. The only method I know of to also include optional packages is to edit the /etc/yum.conf file and add the following to the [main] section:
group_package_types=default mandatory optional
The reason I mention this is because I wanted to install “Terminal emulator for the X Window System” (xterm) which is under the group “Legacy X Window System compatibility”. xterm happens to be an optional package and did not get installed until I added group_package_types=default mandatory optional to /etc/yum.conf.

# yum -y groupinstall “Legacy X Window System compatibility”

I did find a plug-in for yum that allows users to specify which package types within a package group should be installed when using yum groupinstall.
http://projects.robinbowes.com/yum-grouppackagetypes/trac

Enable GNOME

Since the server was previously running on CLI mode, we need to change the initialization process for the machine to boot up in GUI mode.

Open /etc/inittab using a text editor and change following line:

id:3:initdefault:
To:
id:5:initdefault:
After making the change, reboot the machine.

# init 6
Note that you can switch from GUI to CLI mode manually by using following method:

GUI to CLI: Ctrl + Alt + F6
CLI to GUI: Ctrl + Alt + F1

Installing Additional Applications
After logging in to the GNOME Desktop, you can now go to System > Administration > Add/Remove Software to manage application in CentOS.

After installing gnome packages .Issue the below command to install VNC package along with dependencies

yum -y install tigervnc-server pixman pixman-devel libXfont
Create user name and password.
[root@567ss.com ~]# adduser user1
[root@567ss.com ~]# adduser user2
[root@567ss.com ~]# passwd user1
[root@567ss.com ~]# passwd user2

Create VNC passwords for the Users created.
[root@567ss.com ~]# su – user1
[user1@567ss.com ~]$ vncpasswd
Password:
Verify:
[user1@567ss.com ~]$ logout
[root@567ss.com ~]# su – user2
[user2@567ss.com ~]$ vncpasswd
Password:
Verify:
[user2@567ss.com ~]$ logout

Now open /etc/sysconfig/vncservers file and add the following lines at the end of the file( Edit as per your usernames ).
VNCSERVERS=”1:user1 2:user2″
VNCSERVERARGS[1]=”-geometry 1024×768″
VNCSERVERARGS[2]=”-geometry 800×600″

Here we have configured session 1 with 640×480 resolution for the user “user1” and session 2 with 800×600 resolution for the user “user2”.
Start vnc service
[root@567ss.com ~]# service vncserver start

and issue this command to start vnc service automatically during startup.
[root@567ss.com ~]# chkconfig –levels 235 vncsever on

Now in remote machine, start vncviewer type the IP and session as below to view their respective sessions.
192.168.1.10:1 for user1
192.168.1.10:2 for user2

or:
[root@567ss.com ~]# netstat -anlp|grep vnc
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 1374/Xvnc

vnc server
vnc server

Troubleshooting
» Check the iptables in the server, if you are not able to connect the sessions.
Issue the below command to stop iptables service.
[root@567ss.com ~]# service iptables stop

try again.
» you might receive the below error while starting the vnc service.
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids
/usr/bin/Xvnc: symbol lookup error: /usr/bin/Xvnc: undefined symbol: pixman_composite_trapezoids

[FAILED]

Issue the below command to install pixman,pixman-devel and libXfont packages.
[root@567ss.com ~]# yum -y pixman pixman-devel libXfont

[or]
This command will update everything .
[root@567ss.com ~]# yum update

and restart the VNC service and try again.