Linux – Setting up VNC Server

Below is a short guide to set up a VNC server within Linux.

INSTALL

Install the package by running the following commands,

  • Ubuntu/Debian – apt-get install vnc4server xinetd
  • Fedora/Redhat – yum install vnc-server

PASSWORD

Set the password for vnc by running the command vncpasswd

START VNC

Start the vnc server by running the command vncserver.
You should now be able to connect to you machine usng VNC.

STARTUP

To configure VNC to start at boot up edit the /etc/rc.local file and add the following line just before the line that reads exit 0:

su – <username> -c “/usr/bin/vnc4server :1 -geometry 1024×768 -depth 16 > /tmp/vncserver.log 2>&1 &” &

ISSUES

When you connect your presented with a blank grey screen. This is down to a configuration issue within the file /root/.vnc/xstartup. Further details on how to fix this can be found here.

Rick Donato

Want to become a Linux expert?

Here is our hand-picked selection of the best courses you can find online:
Linux Mastery course
Linux Administration Bootcamp
and our recommended certification practice exams:
AlphaPrep Practice Tests - Free Trial