Google
 

1/28/08

Config VNC on debian (Sarge).

What VNC can do for you?

I have been using Linux for a long time. I cannot do anything without it. However, there are situations where I only have Windows or Mac. In my case I have a Mac laptop. I still want to work using my favorite Linux. What can I do? I can use ssh, but I don't have the GUI desktop. I want to have the GUI desktop. That is exactly what VNC can provide you. Look at the picture. This is the VNC on my Mac laptop. I can work JUST like in front of my Linux machine.

I can start my favorite editor, my Gimp etc. So your Linux machine is with you everywhere you go!

Cool! But how can I set up my VNC?


This is a two step process. First you need to set up your Linux machine. Second, you need a client to run on either you Windows or you Mac. Here I explain step by step.

Setup VNC server on your Linux machine

1. Install VNC server.
On Debian, if you use aptitude, you will see that you have vncserver, vnc-common, but also vnc4server and vnc4-common. Install vnc4server. This one seems to be easier to config, at least for me.
You can also use the following to install vnc4server ( you need to be root).
#apt-get install vnc4server

2. Set up the password for the first time and start the server.
Choose your desired window size and color depth, then, as an ordinary user, open a terminal and type (you don't need to be root):

$Vnc4server -geometry 1024x768 -depth 24

If this is your first time to use it, it will prompt you to create a password:

You will require a password to access your desktops.

Password:
Verify:

This will save a scrambled password in the file ~/.vnc/passwd.

Once that's been done you can create a new server by invoking:

$ vnc4server
This will start a new server and show you the "desktop" it is running upon. This is something that you'll need to know when connecting to the server. Please note the information it pops, something like the following message.

New 'X' desktop is debian:1

Starting applications specified in /etc/X11/Xsession
Log file is /home/test/.vnc/debian:1.log

Here you need to remember that this is desktip:1.

Open the VNC viewer on your remote machine (see instructions following), enter the hostname:screen and password (use a hostname or IP that your client machine understands), and your Linux desktop will open in a window!

To kill the server enter a command similar to this, using the appropriate settings:

$ vnc4server -kill :1

The default is Gnome desktop. But you can change it to your favorite KDE if you want by the following steps.
1). go to the directory
cd ~/.vnc
emacs xstartup
2). When you edit xstartup, you just comment anything there originally. Write the following to the file


#!/bin/sh
startkde&
3). Save the file. Stop the VNC server by: vnc4server -kill :1
4). Start the server again by: vns4server -geometry 1024x768 -depth 24

You can configure the geometry option accordingly. I used

xxx@xxx: vnc4server -geometry 1440x850 :2

The reason for me to use 1440x850 is that I am using a mac with 1440x900. :2 meaning I take this one as my second.

Setup VNC client on your Mac or Windows.

On my Mac, I use "Chicken of the VNC". You can google to find it. It is really easy to configure. It works perfectly. Make sure that you remember the combo key for full screen mode. The default is "ctrl_alt_apple_`" (4 keys together). On Windows, I am sure there are corresponding programs.





No comments: