« HOWTO get a Packard Bell scanner working.HOWTO: Setup read/write access to local NTFS drives. »

VNC Server Installation and Usage

22/07/08

Permalink 02:17:48 pm, by richard Email , 1529 words   English (GB)
Categories: Ubuntu Linux, Network and Connectivity, Installation and Configuration

VNC Server Installation and Usage

VNC From The Command Line

With VNC, you can see the desktop of a remote machine and control it with your local mouse and keyboard, just like you would do it sitting in the front of that computer. To run a vncserver on your host is not that difficult but there were a few gotchers I came across that took some working out.

...

Software Installation

Install command
sudo apt-get install vnc4server

Once that is all installed you need to create one file and you are all done. The file is used by vncserver so that it knows what you want to run. So assuming you want to run the usual gnome session. Make the following directory and then create the file with the contents shown below.

Example xstartup file

cd                    <<-- make sure you are in your $HOME directory  


mkdir .vnc  
gedit .vnc/xstartup 

#!/bin/sh  


unset SESSION_MANAGER  
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources  
xsetroot -solid grey  
vncconfig -nowin &  
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &  
/usr/bin/gnome-session & 
Note
For KDE you can use startkde & as the last line.

When you run the the vncserver command the first time it will ask you for a password. This is the password you will enter when you or anyone else wants to use the vncviewer to see your vncserver sessions.

The server command line I use for my wide screen 1680x1050 is as follows. I have included the output when I ran this on my kvm guest machine called kvmhardy.

vncserver command line

$ vncserver -geometry 1640x970  


New 'kvmhardy:1 (richard)' desktop is kvmhardy:1  
Starting applications specified in /home/richard/.vnc/xstartup  
Log file is /home/richard/.vnc/kvmhardy:1.log 

To see your new session you will need to run vncviewer. Looking at the output above, you already know that the server was run on the host machine called kvmhardy. The :1 at the end of the name tells you that the server is using DISPLAY 1. This is needed one the vncviewer line. If we are running the viewer on the same host in our case running on kvmhardy we can also use a host name of localhost.

vncviewer kvmhardy:1

Pages: 1· 2· 3

No feedback yet

Here are a collection of Mini-HOWTOs some of which are too short even for that grand title. I keep them around as it is easier to remember where to look these up that to remember the content of the mini-HOWTO

Search

Contents

powered by b2evolution