VNC HOWTO

From openSUSE

This article is in need of attention!
You are welcome to improve this article. Refer to this article's discussion page for more information.


Contents

What is VNC?

VNC stands for Virtual Network Computing. VNC allows you to interact with a remote pc over a network as if you were sitting right in front of the host machine. A typical VNC installation consists of a server and one or more client PCs. The VNC server is installed on the host machine and clients connect to it using VNC client software. There are various software packages available for linux.

Install VNC

Install Tight VNC

If you are building from source, make sure you have all the necessary package dependencies installed

  • zlib
  • libjpeg

Install by invoking the following command as root

/sbin/yast -i zlib libjpeg

download the source tarball from the TightVNC download page as of this writing, the latest version is 1.3.9

Unzip the tarball by invoking the following command

tar -xvf tightvnc-1.3.9_unixsrc.tar.bz2

compile and install using the following commands as root

cd tightvnc-1.3.9_unixsrc.tar.bz2
./configure
make
make install

Alternatively, you can install TightVNC with YAST using the following commands (as root)

yast -i tightvnc

Start and Configure VNC

Log into the console as the user who will "own" the VNC desktop and invoke the following command to start the server:

vncserver

since this is the first time this user has executed the vncserver command, you will be prompted for a password.

After you enter a password and it has been accepted, vncserver will create startup and configuration files in your home directory under $HOME/.vnc/

When the server has been sucessfully started, you will be prompted with a message like: "VNC server started sucessfully. New VNC desktop is [your computer's hostname]:N (where N is a number)

  • This $HOME/.vnc/xstartup script is kind of the equivalent of .xinitrc (the hidden script that has a list of stuff that will run before X is started when you do startx). This is where you are going to specify what window manager you want to run when you're running the VNC server. It defaults to TWM.
  • You can have multiple desktops, meaning multiple servers running at the same time, and these will need to use different listener ports – 5900 and up, so :1 means it's going to be listening on port 5901.
  • Before we do anything on the client side, let's stop the server:
vncserver -kill :1
  • Now, let's go into that hidden .vnc directory on the server and edit the xstartup file. At the very bottom you should see what window manager is set to run by default. Like I said, you might see an entry for TWM. You want to comment this line by putting a hash mark at the beginning:
#twm&
  • Add a new line right below it, and pick a window manager. Let's say you have FluxBox – I would pick something lightweight, so maybe install FluxBox if you don't already have it ( http://fluxbox.sourceforge.net/ ). It is necessary to install the following dependencies:
yast -i gcc gcc-c++ libstdc++
  • If you want to enable Gnome or KDE desktop, you'll have to configure Fluxbox with the extra option:
./configure --enable-kde

or

./configure --enable-gnome
  • then put on this line underneath that one with "#twm&" :
exec fluxbox
  • Save that file, then go back out and now run the server again:
vncserver :1
  • Before trying to establish a VNC connection between you VNC client an server, make sure you've opened the "590x" port in your firewall (x in our case is "1"). To do that, start yast / security and users / firewall. at the "allowed services" tab, click advanced and write your port at TCP (our case 5901).
  • Start your VNC client and connect to your server eg:
vncviewer 192.168.1.234:1
  • don't forget to put ":1" and to enter the security password you had chosen a few steps before.
  • if you want to start the KDE or the Gnome interface, just right-clic on the background and choose settings / window / KDE - i'm not shure of that, but you can find it very easy in that menu.

startup service and autostart

  • To add this service to autostart at boot time:
chkconfig --add vnc
  • If you want to be sure that this service is going to automaticaly start in both runlevel: 3-text mode and 5-graphical interface mode, start YaST / System / System Services (Runlevel). Go to the Expert Mode tab, find the VNC service and enable runlevel 3 and 5 then click finish. Don't start the service right now because you'll do that in the command line.
  • Exit yast and start the VNC server:
service vnc start
  • I started it in the command line because if there were any errors, they would be displayed.

VNC Client and Server


See Also

References

External links