, , , , ,


Debian Linux (6)

    1. Run the following commands respectively.
apt-get update
apt-get upgrade
apt-get dist-upgrade
    1. Reboot the OS.
    1. Install the GNOME desktop.
apt-get install gnome-desktop-environment
      • If “apt-get install gnome-desktop-environment” says the packages are missing then ensure “deb http://ftp.us.debian.org/debian squeeze main contrib non-free” is added to the list file.
      • adding the link to sources.list
nano /etc/apt/sources.list

Paste “deb http://ftp.us.debian.org/debian squeeze main contrib non-free” without quotes.

    1. Install required fonts for the VNC server GNOME session.
apt-get install xfonts-100dpi
apt-get install xfonts-100dpi-transcoded
apt-get install xfonts-75dpi
apt-get install xfonts-75dpi-transcoded
apt-get install xfonts-base
    1. Install VNC.
apt-get install vnc4server
    1. Run VNC server manually and set up a password.
    1. Making VNC server start at system start up.
      • Run the following command to create the vncserver file.
nano /etc/init.d/vncserver
    1. Copy the following script, paste, and save.
      • Replace “my-vnc-server” with the hostname and keep with quotes. (Optional)
#-----Beginning of the script-------------------------------------------

#!/bin/sh -e
# Provides:          vncserver
# Required-Start:    networking
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6


# The Username:Group that will run VNC
export USER="root"

# The display that VNC will use
# Color depth (between 8 and 32)
# The Desktop geometry to use.
# The name that the VNC Desktop will have.

OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}"

. /lib/lsb/init-functions 

case "$1" in 
log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver ${OPTIONS}"

log_action_begin_msg "Stopping vncserver for user '${USER}' on localhost:${DISPLAY}"
su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}"

$0 stop
$0 start

exit 0
#-----End of the script-------------------------------------------------
    1. Grant permissions for everyone to execute the file.
chmod +x /etc/init.d/vncserver
    1. Register the VNCServer service to run at startup.
update-rc.d vncserver defaults
    1. If VNC login shows a gray screen, then run the following command to set permissions for XInit.
chmod 755 /etc/X11/xinit/xinitrc

Solaris 10

Solaris (10)

  1. Download the latest VNC package for Solaris from http://www.realvnc.com/products/download.html
    1. Go to the download location of the file in the terminal and run the following commands.
gunzip vnc-4_1_3-sparc_solaris.pkg.gz
pkgadd –d vnc-4_1_3-sparc_solaris.pkg
    • Solaris 10 is shipped with a basic VNC service mostly configured. This is the procedure to enable it.
    1. Find the VNC service.
svcs -a | grep -i vnc

disabled 13:47:12 svc:/application/x11/xvnc-inetd:default
    1. Enable VNC service.
svcadm enable svc:/application/x11/xvnc-inetd:default
    1. Note that the VNC is broken by default, some changes will be required.
svcs svc:/application/x11/xvnc-inetd:default

maintenance 14:22:41 svc:/application/x11/xvnc-inetd:default
    1. Append VNC to the /etc/services.
echo "vnc-root\t5900/tcp\t\t\t# Xvnc" >>/etc/services
    1. Check /etc/services.
tail /etc/services

snmpd 161/udp snmp # SMA snmp daemon
vnc-root 5900/tcp # Xvnc
    1. Note, the GNU display manager is not customized yet, and needs correction.
ls -al /etc/X11/gdm/custom.conf

/etc/X11/gdm/custom.conf: No such file or directory
    1. Enable and configure GNU display manager for VNC.
cat >/etc/X11/gdm/custom.conf <<!--
    1. Check the customization configuration file.
ls -al /etc/X11/gdm/custom.conf

-rw-r--r-- 1 root root 85 Dec 19 14:43 /etc/X11/gdm/custom.conf
    1. Disable and re-enable, and validate the VNC service.
svcadm disable svc:/application/x11/xvnc-inetd:default

disabled 14:46:29 svc:/application/x11/xvnc-inetd:default

svcadm enable svc:/application/x11/xvnc-inetd:default

svcs svc:/application/x11/xvnc-inetd:default

online 14:46:43 svc:/application/x11/xvnc-inetd:default
    1. Edit /etc/default/login and comment out the following line to permit log on as Root.
# CONSOLE=/dev/console


RHEL (Red Hat Enterprise Linux)

If the RHEL installation is licensed then this is not difficult at all. You just need to run

yum install tigervnc-server -y

at a terminal. However this gets complicated when the installation of RHEL is not licensed.

After a considerable number of disappointing hours of searching, testing, and some research I finally found a solution to this. Here I am going to use TigerVNC as the VNC server and RealVNC viewer as the client (you can use any VNC viewer you prefer).

  1. Navigate to the TigerVNC downloads which at the moment of this blog post is hosted as a SourceForge project here  and download the latest build corresponding to the bit version of your Linux installation.
  1. Extract the contents into a suitable location.
  1. Within the extracted contents a folder named bin exists and it contains all the binaries required for the sound operation of VNC server (except the one which as they say is obsolete now). Locate this folder and copy the contents of it to /bin directory in Linux. The following files need to be copied.
    • vncconfig
    • vncpasswd
    • vncserver
    • Xvnc
    1. Execute the command vncsever at a terminal.
    • This will require you to set a password for logging in remotely using VNC.
    • This will also create the necessary files required to start a xsession for a particular user when logging in using VNC.
  1. Usually after the above step you are good to go but in some cases you might end up with an error Connection timed out(1006) at the VNC viewer when you try to log in. This is because the host in which the VNC server runs is blocking the VNC communication, i.e. it’s blocking the VNC port 5900. Here you have to allow the port 5900 at the firewall as a trusted port or if security is not a big issue with the Red Hat host then you can simply disable it.