VNC HOWTO

From openSUSE

This article is in need of attention!

This article currently does not meet the standard expected on the OpenSUSE Wiki.
You are welcome to help improve this article. For more information see the Wiki Team


Contents

install VNC

yast -i vnc vnc-server xinetd

or

yast -i tightvnc xinetd (tightvnc is the default VNC Server for OpenSuSE 10.2)

create a startup file

  • I don't know why this was not created when yast installed the components, but create /etc/init.d/vnc with your favorite editor and copy the following into it:
#! /bin/sh
 
. /etc/rc.status
rc_reset

case "$1" in
    start)
        echo -n "Starting VNC Server "
        /bin/su - root -c "/usr/bin/vncserver -geometry 1024x768 -depth 16 :1"
        # vncserver -geometry 1024x768 -depth 16 :1
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down VNC Server "
        /bin/su - root -c "/usr/bin/vncserver -kill :1"
        # vncserver -kill :1
        rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        rc_status
        ;;
    status)
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
        ;;
esac
rc_exit
  • Use the following line to start the server:
vncserver :1
  • You don't need to do this as root – you just do this as your normal user, that will work without problems.
  • It will ask you for a password, which is not going to add too much to the security of the communication, but it's just a way to authenticate on a very weak level.
  • You'll see some startup messages, you will see something about how it's creating a hidden directory in your home directory called .vnc, and it's creating a little script in there called xstartup.
  • 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 compile Fluxbox with the extra option:
./compile --enable-kde

or

./compile --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 if this service is going to automaticaly start in both runlevel: 3-text mode and 5-grafical interface mode, start yast / sysetem / system services(runlevel). Go to the expert mode tab, find 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 wanted to start it in the command line because if there are any errors, will be displayed.

VNC Client and Server


See Also

References


This article needs to be expanded. If you can help please do so in line with the openSUSE Style Guide.

If you are looking for something to do, see the other articles that need expanding


Other Links