How to Install and Configure X11 with Remote VNC Access on Centos 5

The instructions below will walk you through the process of installing the X window system, GNOME desktop environment, and configuring VNC so that you can access it remotely.

yum -y upgrade
yum -y groupinstall "GNOME Desktop Environment"
yum -y install vnc-server

As a general rule of thumb you should never run X windows as root. In this example we will add a system user with the username ‘wkst’ and configure X windows to run under that user.

adduser vncuser

Next you need to set a password for the user vncuser:

passwd vncuser

Next we will drop down to the system user ‘vncuser’ using su and configure VNC. When running the vncserver binary you will again be asked to set a password. This will be the password you use in your VNC client.

su vncuser

Next you need to edit /home/vncuser/.vnc/xstartup and uncomment the following two lines:

exec /etc/X11/xinit/xinitrc

Next we want to restart VNC so the changes take affect

vncserver -kill :1

That’s it, you can now connect to your server using the server IP address with a :1 (the display port) at the end of it using your VNC client.

About NhocConan

A super lazy guy who tries to write tech blog entries in English.He is lazy, so he can only write when he is in a good mood or when he is tired of coding.

Leave a comment

Your email address will not be published. Required fields are marked *