I recently' had to switch from openSuse based system to a Debian/Ubuntu based system with a XFCE desktop environment.
Being used to remotely access my servers over VNC I had to find out how to implement and configure (tight)VNC server on this platform. Here's how I did it.
While using openSuse I had found that tightvnc (server) was the best documented environment to accomplish this and since Debian/Ubuntu has the opportunity to install this particular server I
Step 1. Installing TightVNCserver.
Simply install it with the following command: sudo apt-get install tightvncserver
This will install the version of tightVNCserver that is available in the repository of your Linux version.
Step 2. Activating VNC server.
Activating the server is quit easy, just run the command: vncserver
When prompted enter a vnc password (twice) and answer the question for a view only password with: no
During the process a file called: /.vnc/startkde has been created in the home folder. This file has to be modified now and another file will have to be added to /etc/init.d
Step 3. Modifying files.
.vnc/xstartup:
Open the file with a text editor and add the following line to the end of the file:
start xfce4 &
It should now look like:
#!/bin/sh
|
Save and close the file.
Create: /etc/init.d/vncserver
Create this file, set it to be executable and add the following text to it:
#!/bin/sh -e ### BEGIN INIT INFO # Provides: vncserver # Required-Start: networking # Default-Start: 3 4 5 # Default-Stop: 0 6 ### END INIT INFO PATH="$PATH:/usr/X11R6/bin/" # The Username:Group that will run VNC export USER="root" #${RUNAS} # The display that VNC will use DISPLAY="1" # Color depth (between 8 and 32) DEPTH="16" # The Desktop geometry to use. #GEOMETRY="<WIDTH>x<HEIGHT>" #GEOMETRY="800x600" GEOMETRY="1024x768" #GEOMETRY="1280x1024" # The name that the VNC Desktop will have. NAME="you-forgot-to-put-a-name-here" OPTIONS="-name ${NAME} -depth ${DEPTH} -geometry ${GEOMETRY} :${DISPLAY}" . /lib/lsb/init-functions case "$1" in start) log_action_begin_msg "Starting vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver ${OPTIONS}" ;; stop) log_action_begin_msg "Stoping vncserver for user '${USER}' on localhost:${DISPLAY}" su ${USER} -c "/usr/bin/vncserver -kill :${DISPLAY}" ;; restart) $0 stop $0 start ;; esac exit 0 |
Just to make sure that this file is executable enter the command: sudo chmod +x /etc/init.d/vncserver
Then, run: sudo update-rc.d vncserver defaults
This adds the appropriate symlinks to the vncserver script so that it is sent the start and stop commands at the appropriate time.
Stop vncserver by: vncserver -kill :1
and restart it by: vncserver :1
The server should now be remote accessible by any vnc client like eg. tightvnc viewer!