How to Install VNC on Centos 6 (VPS)
Well, I usually don’t make these tutorials because there are often tons out there already available. However, I found the existing ones incomplete or inadequate to complete the task. So, this is meant to start from the very very fresh starting point.
First, let’s install essentials to run a VNC – the desktop.
You can choose any desktop environment you like, but this tutorial is going to focus with XFCE. (Who can afford to install Gnome/KDE on a VPS anyway?)
CentOS 6 min (version that usually comes with vps) by default does not come with specific desktop environment package information, so, we need to add that first if you plan to use any other than default.
For example we’ll use XFCE (desktop environment).
First, we need the source to install XFCE from since default centos repos do not carry it. So, install epel. Also, instead of giving you a direct link, which is bound to be wrong in time, go to this page:
http://download.fedoraproject.org/pub/epel/6/i386/
now find “epel-release-X-X.noarch.rpm”. The X-X should be the newest version they have.
1 2 | wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-X-X.noarch.rpm rpm -ivh epel-release-X-X.noarch.rpm |
Now you should have the package info for xfce4 and you can confirm this by doing either of below
3 4 | yum search xfce4 yum groupinfo Xfce |
Next, install the desktop environment along with necessary parts for it.
5 | yum groupinstall Desktop Fonts Xfce |
That will take a while…
Next, we move onto installing the actual VNC. In centos 6, the vncserver is called “tigervnc-server” as opposed to the previous name “vncserver”.
6 | yum install -y tigervnc-server |
We also need users to run the VNC environment since we don’t want to run it under root.
7 8 | useradd testuser passwd testuser |
now login to testuser via new SSH connection… or if you’re lazy…
9 | su -l testuser |
Now create a password for your VNC
10 | vncpasswd |
You should now be able to confirm that the vnc password file has been created
11 12 | cd .vnc ls |
should have ‘passwd’ in there.
Back on root now!! (type “exit” if you used su)
You should now edit the VNC server configurations
13 | nano /etc/sysconfig/vncservers |
If you don’t have nano, you can use any other editor or install nano as well.
14 15 | VNCSERVERS="1:testuser" VNCSERVERARGS[1]="-geometry 1024x786" |
This will allow the vncserver to start with a resolution of 1024×786 with testuser on :1. The “1” not only defines its identification number, it is also the port that it will use (in vncs: 1, in raw: 5901).
Now start your VNC as root
16 | service vncserver start |
It will run each vncservers you defined in the above file.
To stop/restart, you can…
17 18 | service vncserver stop service vncserver restart |
If you’d like your VNC to start at boot:
19 | /sbin/chkconfig vncserver on |
And that’s it!
Please be warned that this is an unsecured line to your VNC. If you suspect that someone’s snooping on your traffic, be sure to secure it by having an SSH tunnel or similar methods. But I’m going to end my tutorial here.
~Grumpy
———————————————
———————————————
———————————————
With that done… You probably want to install some essentials to use the VNC. And bunch of really useful ones are in RPM Forge.
Below are two links for RPM Forge for 32bit and 64bit relatively.
1 2 | i686 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm |
You’ll need to download that and install it.
1 2 | wget [above link] rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm |
You can test that RPM forge is working by installing something like..
1 | yum install htop |
Firefox
1 | yum install firefox |
Flash Plugin
1 | yum install flash-plugin |
etc…
Very helpful and easy, much easier than other tutorials.
I can’t stop saying Thanks to you.
hey, this is all that shows on my desktop
http://imgur.com/y2GwI
the centos6 background screen and the mouse, which can just move around
nevermind – i accidentally typed “Dekstop” instead of “Desktop” 😉
Thank you so much for ending my hours of pain. I was following other tutorials that involved modifying iptables and they were both frustrating and confusing. This was so much simpler and worked a treat. Cheers
I use your method and install that successfully. I translate this post to chinese, the url is http://jpuyy.com/2012/12/centos6-x64-vncserver-installation.html .
great post! great alternative as linux dont have rdp
I’d like to know about multi loggins for vnc, i have 3 people, that need to use different :# and their login
If you need three different users, make multiple servers in the vncserver configuration (/etc/sysconfig/vncservers). My example above has only 1 user. You can add as many as you like.
The second one can be with ID of 2, third with ID of 3, etc.