VNC server

From Oxxus Wiki

Jump to: navigation, search

VNC service provides a way of controlling a remote computer via remote session via Internet/Intranet network. Using Windows terminology, it's known as Remote desktop.

With Linux OS based server, you'll have to have X-windows, desktop manager and VNC services installed. For desktop computers those services are installed by default, which is not a case with VPS.

The tutorial below will show you how to create VNC server, and how to connect to it's desktop using any VNC client from remote destination.

Focus here is on Centos Linux distribution but steps are similar, if not the same, for other distributions.

VNC server installation

Once you receive VPS account activation email from Oxxus.net, you'll be able to access VPS through your domain name (if registered) or through your IP address.

Use Putty or any SSH capable client to connect to your VPS account and access to its shell prompt as root. Steps needed that are shown below are achieved on one of VPS accounts created for testing purposes.

At terminal shell prompt opened, execute command yum install vnc-server. Screen snapshot is show below.

[root@test-vnc /]# yum install vnc-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * addons: www.gtlib.gatech.edu
 * base: centos.mirrors.tds.net
 * extras: centos.corenetworks.net
 * rpmforge: apt.sw.be
 * updates: mirror.cogentco.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package vnc-server.i386 0:4.1.2-14.el5_5.4 set to be updated
--> Processing Dependency: libXtst.so.6 for package: vnc-server
--> Processing Dependency: xorg-x11-xauth for package: vnc-server
--> Running transaction check
---> Package libXtst.i386 0:1.0.1-3.1 set to be updated
---> Package xorg-x11-xauth.i386 1:1.0.1-2.1 set to be updated
--> Processing Dependency: libXmuu.so.1 for package: xorg-x11-xauth
--> Running transaction check
---> Package libXmu.i386 0:1.0.2-5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================
 Package                        Arch                 Version                          Repository               Size
==========================================================================================
Installing:
 vnc-server                     i386                 4.1.2-14.el5_5.4                 	updates                 2.0 M
Installing for dependencies:
 libXmu                         i386                 1.0.2-5                          	base                     62 k
 libXtst                        i386                 1.0.1-3.1                        	base                     15 k
 xorg-x11-xauth                 i386                 1:1.0.1-2.1                      	base                     31 k

Transaction Summary
========================================================================================
Install       4 Package(s)
Upgrade       0 Package(s)

Total download size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): libXtst-1.0.1-3.1.i386.rpm                                                            		|  15 kB     00:00
(2/4): xorg-x11-xauth-1.0.1-2.1.i386.rpm                               		               |  31 kB     00:00
(3/4): libXmu-1.0.2-5.i386.rpm                                                       		|  62 kB     00:00
(4/4): vnc-server-4.1.2-14.el5_5.4.i386.rpm                                                  |  	2.0 MB     00:00
--------------------------------------------------------------------------------------------------------------------
Total                                                                               			2.8 MB/s | 2.1 MB     00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : libXtst                                                                                      	1/4
  Installing     : libXmu                                                                                       	2/4
  Installing     : xorg-x11-xauth                                                                               	3/4
  Installing     : vnc-server                                                                                   	4/4

Installed:
  vnc-server.i386 0:4.1.2-14.el5_5.4

Dependency Installed:
  libXmu.i386 0:1.0.2-5             libXtst.i386 0:1.0.1-3.1             xorg-x11-xauth.i386 1:1.0.1-2.1

Complete!
[root@test-vnc /]#

With prompt released, you'll have VNC server installed, which needs configuration, shown below:

VNC server configuration

Edit file with command nano /etc/sysconfig/vncservers. Add following lines at the end of file and save changes with CTRL-O.

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768 -depth 16"

Define password for accessing server via vnc service with command

[root@test-vnc /]# vncpasswd
Password: xxxxxx
Verify: xxxxxx

Start server with command:

[root@test-vnc /]# service vncserver start

If everything goes well, you'll have VNC server started and ready to receive and serve remote desktop session at port :1.

It'll be accessible at server's ip address assigned to VPS account, via any VNC capable client.

At the moment, there won't be anything at the screen when you access server. This is because there is no graphical service nor dekstop windows manager installed. Installation and configuration steps are show below.

To install X-Windows server use command:

[root@test /]# yum -y install xorg*

It'll install X-Windows service with all features required. Now, the desktop window manager will be needed. Follow steps below to install KDE windows desktop manager service. Using same steps, you can install others if needed, like Gome.

Execute command as shown below and leave installation manager to take care of it for you:

[root@test /]# yum -y install kde*

Once done, all you have to do is to use installed X-Windows and KDE windows manger for incoming VNC session requests.

Edit file ~/.vnc/xstartup as shown:

[root@test /]# nano ~/.vnc/xstartup

Nano editor will open file with contents shown below:

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startkde &
#twm &

Comment twm & and make changes as above. Save changes. Stop vncsver with command service vnc server stop, and start it up again with service vnc server start.

Your VNC server with X-Windows and KDE desktop window manager is now fully installed and you can access it via VNC client application.

Contact About Us Support Network Servers Java Hosting Oxxus.net Order Now! Dedicated Servers VPS Hosting Tomcat Hosting Java Hosting Money Back Guarantee Privacy Policy Oxxus.net Terms of 
Service Contact About Us Servers Networks Support Domain Names SSL Certificates Java Wiki Tutorials E-learning 
Platforms