Creating a Remote GNOME desktop with VNC on CentOS 6 for your VPS or Dedicated Server

You suffer from slow Internet speeds and need to do manage large file transfers. Perhaps you need a backup desktop that you can get to from anywhere. There are a host of reasons that you would want to run a remote desktop on a VPS or dedicated server, or even on a home server. The reason I did it is that sometimes I need to download modify, then re-upload huge file (1-10GB usually) and I need a web browser to do it (it can’t be done from command line- PHP session issues and the like) and my own internet connection is only 1.5mbps. But, I have a VPS that has a 100GB link to the Internet. So, by using VNC to connect to a GNOME desktop remotely, I can do all I need.



My own VPS uses CentoOS 6.4, but this will work on any version of CentOS 6. It would probably work with CentOS 5 too but some of the package names might be different.

First, you VPS should have at least 1GB of memory available and about 1GB of hard disk space to allocate. We’re going to assume that DNS is already set up and working. In my case, my VPS was already setup with cPanel and hosting websites. It sees light usage and so can handle the added load.

Login as root, and create a user for your desktop. It should not match a user that already exists on the server. We’re going to call our user “ryan” but you can use any name you want.

[~]# adduser ryan

and now set a password for ryan

[~]# passwd ryan

Now, we need to make sure all packages are up to date:

[~]# yum update

Now we’re going to install the desktop, remove Network Manager, and configure TigerVNC server.

[~]# yum groupinstall desktop
[~]# yum -y remove NetworkManager
[~]# yum install tigervnc-server

Copy and paste the following into your prompt to setup the vncserver.

[~]# echo ‘VNCSERVERS=”1:ryan”‘ >> /etc/sysconfig/vncservers
[~]# echo ‘VNCSERVERARGS[1]=”-geometry 1024×768″‘ >> /etc/sysconfig/vncservers

Keep in mind you’ll need to change the username and if you want a different resolution, now’s the time. You can always edit that later though.

Now we need to create a vnc password. It’s easy! Just login as the user via ssh (or use sudo) and type

[~]# vncpasswd

and to set the password.

You’ll need to allow port 5901 though your firewall, and then restart the service:

[~]# service vncserver restart

If you want yours to start every time your VPS boots, you can do

[~]# chkconfig vncserver on

Now you’ll need a VNC client for your computer. I use a free terminal software called MobaXterm. It isn’t perfect but its better than most! It has SSH, SFTP, Telnet, VNC, RDP, and many other protocols all rolled into one nice, portable package.

Here’s the results of my own setup at 1440×900, shown on a 1024×768 screen:

If you need a hand getting your remote desktop server going, leave a comment! I’ll be glad to help you get yours.

2 comments

1 pings

  1. I just tried your instructions for getting vncservers up and running on my Centos 6 box. I still get “Starting VNC server: no displays configured [FAILED]”. While I am continuing to learn and relearn the Linux O/S, I am not new to computers, servers, networks, etc. Actually, I am a Network Engineer with a wide skill set. I am hoping to, this time around, get a box running in production mode and stay focused on Linux enough to become proficient with it. However, I do need help. I and include you in a Team Viewer session to my box should you have the time and we have a complementing schedule.

    1. Hey Joe thanks for commenting! Glad you came and had a look at the article. I know you were trying to get it running before and I’ll bet that the old configuration is still giving you a bad time. Try this:

      mv /etc/sysconfig/vncservers /etc/sysconfig/vncservers.broken
      echo ‘VNCSERVERS=”1:ryan”‘ >> /etc/sysconfig/vncservers
      echo ‘VNCSERVERARGS[1]=”-geometry 1024×768″‘ >> /etc/sysconfig/vncservers

      That will get the broken configuration out of the way by renaming (mv) it and then create a new one. Give that a shot and let me know how it goes. 🙂

  1. […] B) I also use my VPS to browse remotely at times when I need to use a GUI to download a big file that can’t be gotten with a simple wget command (behind a session-based user/password, for example). For this I use a VNC server as outlined here. […]

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.