2007年2月2日星期五

Building KDE environment in vncserver

1. Install packages
# apt-get install kdebase (Install KDE)
PS: you will install all necessary packages when install "kdebase"

# apt-get install vncserver
# apt-get install vncviewer (install vnc client & server)

2. create a user for KDE environment
To avoid to disturb your own working environment, I suggest you to add a user for KDE environment
# adduser kde

3. setup for user "kde"
# su kde
$ cd
(change to home directory)
$ cp /etc/vnc.conf .vncrc
$ vi .vncrc (configure vnc server)

configurations I defined in my own machine:
$vncUserDir = "$ENV{HOME}/.vnc";

# $vncPasswdFile contains the filename of the password file for Xvnc.
$vncPasswdFile = $vncUserDir . "/passwd";

# $vncStartup points to a script that will be started at the very beginning.
$vncStartup = "$ENV{HOME}/.vnc/kde";

# $xauthorityFile should be the path to the authority file that should be used
# by your vnc X server.
$xauthorityFile = "$ENV{HOME}/.Xauthority";

# $defaultDesktopName should be set to the default name of the desktop.
# This can be changed at the command line with -name.
$defaultDesktopName = "KDE";

# $geometry sets framebuffer width & height. Default will be calculated if
# server is started from within a running X servers. Can be changed at
# the commandline (-geometry). A fixed default will be used if
# vncserver is not invoked in a running X session.
# Example: $geometry ="640x480";
$geometry ="1024x768"
# $depth sets the framebuffer color depth. Must be between 8 and 32.
# $pixelformat sets the default pixelformat.
# The default will be calculated if none of both is specified
# and when vncserver is called from within a running X servers.
# Can be changed at the command line with option -depth.
# A fixed default value will be used if vncserver is not
# invoked in a running X session.
# Example: $depth = "16";
# $pixelformat = "rgb565";
$depth = "16"
$pixelformat = "rgb565"


PS: pay attention to "$vncStartup", we will define it later


$ mkdir .vnc (create the directory we defined in .vncrc, $vncUserDir, it's the default value)
$ cd .vnc
$ echo "startkde &" > kde (the file name is defined in "$vncStartup", it's the startup script for vncserver.)
(Use startkde & for KDE, gnome-session & for GNOME or fvwm2 & for FVWM2.)
$ vncpasswd (set password for vnc authentication, it will create a file with name defined in "$vncPasswdFile")

4. Start VNCServer
There's two ways to start vncserver:
1) setup crontab with kde user
#su kde
$ crontab -e
add following line in the crontab list:
@reboot vncserver -alwaysshared > /dev/null
It means: starting vncserver when machine startup. You can remove the "-alwaysshared" option if you don't want to share vncserver with multi-users. But only one connection is allowed if you disable the option.

2) start vncserver manually
To start the vncserver manually, you have to log in the 'kde' user in console. I have met a weird thing here: the vncserver doesn't work well in following steps:
open a Gnome Terminal in my own user
sudo su kde
vncserver

But if I log in 'kde' in tty1 (press Ctrl+Alt+F1), the vncserver works well.

For more details please read manual of vncserver.


5. Connect to VNCServer
$ vncviewer localhost:1 (1 means the display#, you should change it if the vncserver is using other display)
PS: run the command in your own user desktop.
Then you can enjoy your own KDE:)

6. Stop VNCServer
$ vncserver -kill :1 (stop the vncserver in display 1)

References:
http://www.linuxjournal.com/article/5499
http://perso.netplus.ch/FCorthay/InstallGentoo/Shortforms/gentoo-kde-2.6.html

没有评论: