[ start | index | login ]
start > knowledgebase > linux > remote server desktop with vnc

remote server desktop with vnc

Created by retep. Last edited by glenn, 5 years and 82 days ago. Viewed 8,150 times. #4
[diff] [history] [edit] [rdf]
labels
attachments

GUI Anyone?

People usually access their Linux server via the command line. e.g. using tools like SSH or FTP.

If you really prefer a GUI to command line tools, e.g. for file editing, then a tool like WinSCP (which lets you edit files via your PC's editor) may do the trick.

For people that are not comfortable with the command line there is a web based control panel option. e.g. Plesk, or webmin

Some people like to access their server via a GUI. Like they would their Linux-based PC. This howto is for them.

Installing a UI

To run a GUI you'll need to have your server setup with a few base 'X' tools. Then you can run VNC to let yourself connect to the desktop remotely.

Under Ubuntu, it may be as simple as running

apt-get install vncserver kde-base

Instead of KDE you might chose Gnome, or some other desktop environment. Wikipedia has a good description of several options at >>http://en.wikipedia.org/wiki/Comparison_of_X_Window_System_desktop_environments.

The apt-get program should pull in any other programs you need to get up and running.

On RedHat you could run something like this:

if [ -e /etc/redhat-release ]; then

if grep -qai ' 3' /etc/redhat-release; then # rhel3 version apt-get install vnc-server control-center fontilus kdebase xterm XFree86-base-fonts XFree86-twm else # rhel3 version apt-get install vnc-server control-center xterm xorg-x11-twm fonts-xorg-base control-center fi fi

(And maybe also packages like: gnome-applets gnome-icon-theme gnome-panel gnome-session gnome-terminal gnome-themes nautilus gnome-desktop xterm XFree86-base-fonts XFree86-twm)

echo "DESKTOP=KDE" > /etc/sysconfig/desktop

Un-comment the unset SESSION_MANAGER and exec /etc/X11/xinit/xinitrc lines in ~/.vnc/xstartup (else you'll get a vnc console with just a plain old xterm, cf. a flash gnome UI).

# run this then set a password when prompted
vncserver :1

ps axf shows this: 6681 pts/1 S 0:00 Xvnc :1 -desktop X -httpd /usr/share/vnc/classes -aut

So connect with your VNC client using this: yourserverip:1

Also, you may want to try this (from your PC):

# 5901 is 5900 plus the VNC screen number
ssh -C -N -L 5901:localhost:5901 root@yourserverip

Then VNC to localhost:5901

With this latter option your VNC traffic will be compressed, and from the local port 5901 to the localhost on the remote machine at port 5901 (which is what vnc is listening on for the :1 connection). And yourtraffic is encrypted.

Prevent the server using up all the CPU on the host server when the screen saver comes on: RedHat Icon | Preferences | ScreenSaver. Under Mode, change it to Disable Screen Saver

To stop the server: vncserver -kill :1

Please stop the X server whenever you are not using it. As it consumes valuable CPU and memory resources.

X itself will use a minimum of 64MB of memory. So only do this if your plan has 128MB of memory or more. Sample memory usage: Xvnc 8% gnome-panel 13% nautilus 26% nautilus-throbber 10%

Note when you log out the vnc session can close. If you restart it you may get an error like:

Warning: yourvpsip:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X yourvpsip:1
A VNC server is already running as :1

Just rm that file.

Please login to post a comment.
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.