amuck-landowner

Running a lightweight GUI on your vps

wlanboy

Content Contributer
Even on a low RAM vps you are able to run a desktop environment.

If you do have a lot of free RAM you can even run desktop apps and IDEs like Eclipse on your vps.

I use my KVM vps to have a portable and accessable Ruby and Java development environment.

One of the desktop managers that do have a small footprint is xfce4. So this tutorial is based on that peace of software.

1. Install xfce and a browser (I take iceweasel - well Firefox - due to the Debian Free Software Guidelines)


sudo apt-get install xfce4 xfce4-clipman xfce4-goodies vnc4server iceweasel

2. Configure vnc4server

First of all run vnc4server to generate the configs and to setup the password:


vnc4server

Type in your password twice and kill the vnc instance:


vncserver -kill :1

Vnc is about virtual displays. Like any x-based system it counts the displays. So ":1" stands for the first display.

Now we change the x windows manager to xfc4:


nano ~/.vnc/xstartup

Exchange "x-window-manager" with "startxfce4":


#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
startxfce4 &

3. Run it

You can start the vnc instance with following command:


vnc4server :1 -geometry 1280x960 -depth 16 -screen scrn 1280x960x16 &

We use "&" to background the process.

Some words to the parameters (manpage):


-geometry widthxheight
Specify the size of the desktop to be created. Default is
1024x768.

-depth depth
Specify the pixel depth in bits of the desktop to be created.
Default is 16, other possible values are 8, 15 and 24 - anything
else is likely to cause strange behaviour by applications.

So why the "-screen" parameter?

Well to do everything twice - or (better idea) to keep my scripts compatible to the package vncserver.

4. Keep it running

One thing that annoys me about this way to startup the vnc server is that it does not survive restarts.

One dirty simple way is to use rc.local


sudo nano /etc/rc.local

With following content:


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
vncserver -kill :1
su - wlanboy -c "cd /home/wlanboy && vnc4server :1 -geometry 1280x960 -depth 16 -screen scrn 1280x960x16" 2>/dev/null &
exit 0


So what do we do?

  • Stop a allready running vncserver instance on disply 1
  • Run a given command (-c) using the user "wlanboy"
  • The command itself switches to the home direcoty and runs the vnc4server command
You can copy the commands to start additional vnc instances.

Just double check that you alter the display numbers.

vnc4.jpg

One note:

Please deactivate the screen saver because most of them are quite cpu consuming.

Things to change if you want to run openbox:

1. Install openbox


apt-get install openbox obconf obmenu menu conky nitrogen

So what are we installing?

  1. openbox - the GUI itself
  2. obconf - the configuration manager of openbox
  3. obmenu - well the menu (right click) of openbox
  4. conky - a nice system monitor
  5. nitrogen - a lightweight desktop background browser
  6. tint2 - a lightweight window manager for openbox
2. Change vnc config


nano ~/.vnc/xstartup

Code:
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
openbox-session &
Just the last line has to be modified.
 
Last edited by a moderator:

nunim

VPS Junkie
You should look into NX, I prefer the NoMachine version but FreeNX isn't bad.  They just discontinued their 3.5.x series to try and push their newer 4.x which I think is crap, it gobbles way more resources but it does have an Android client coming "Soon"..  One of the good things about NX is that you can copy/paste across it, which is something I've never had much luck with in VNC.  I feel that NX is just like RDP, except it seems slightly faster.

I used to have a guide for it on my blog but I haven't bothered to put it back up, I managed to snag copies of all the most recent NX binaries and I have a script to install NoMachine+LXDE or XFCE, if anyone's interested. I prefer LXDE if you're trying to use it in a low memory environment as it uses less resources, I had a desktop running on a SecureDragon 128 for awhile, you really don't need anything fancy :)

For Fran (it would be lighter with LXDE and without IceWeasel eating 60% of the ram):

xfce_nx_freem.png
 
You should look into NX, I prefer the NoMachine version but FreeNX isn't bad.  They just discontinued their 3.5.x series to try and push their newer 4.x which I think is crap, it gobbles way more resources but it does have an Android client coming "Soon"..  One of the good things about NX is that you can copy/paste across it, which is something I've never had much luck with in VNC.  I feel that NX is just like RDP, except it seems slightly faster.

I used to have a guide for it on my blog but I haven't bothered to put it back up, I managed to snag copies of all the most recent NX binaries and I have a script to install NoMachine+LXDE or XFCE, if anyone's interested. I prefer LXDE if you're trying to use it in a low memory environment as it uses less resources, I had a desktop running on a SecureDragon 128 for awhile, you really don't need anything fancy :)

For Fran (it would be lighter with LXDE and without IceWeasel eating 60% of the ram):

xfce_nx_freem.png
 
How did you manage to grab 3.5? Is there any way that this script could be updated or if you would kindly send me the link? http://lowendtalk.com/discussion/3603/remote-desktop-vps     :(
 
Last edited by a moderator:
Updated to what?

I have all the 3.5.x binaries saved, for Linux, Mac & Win.  If I have time tomorrow I'll double check the support for newer Ubuntus and post it.
Couldn't edit out the "updated" bit. But yes, it would be amazing if you by any chance could get it up pllleeeeeeeeaaaaaseeeeeee 
 

bauhaus

Member
Your tuto is great as always @wlanboy, but LXDE or OpenBox are more lightweight than XFCE as window manager. Personally, I like the OpenBox+XFCE approach in this type of scenario.
 
Last edited by a moderator:

wlanboy

Content Contributer
You should look into NX, I prefer the NoMachine version but FreeNX isn't bad.  They just discontinued their 3.5.x series to try and push their newer 4.x which I think is crap, it gobbles way more resources but it does have an Android client coming "Soon"..  One of the good things about NX is that you can copy/paste across it, which is something I've never had much luck with in VNC.  I feel that NX is just like RDP, except it seems slightly faster.

I used to have a guide for it on my blog but I haven't bothered to put it back up, I managed to snag copies of all the most recent NX binaries and I have a script to install NoMachine+LXDE or XFCE, if anyone's interested. I prefer LXDE if you're trying to use it in a low memory environment as it uses less resources, I had a desktop running on a SecureDragon 128 for awhile, you really don't need anything fancy :)
Same with me - don't like 4.x and did not want to post an tutorial with following line:


"Please download binaries from my homepage..."

Updated to what?

I have all the 3.5.x binaries saved, for Linux, Mac & Win.  If I have time tomorrow I'll double check the support for newer Ubuntus and post it.
Looking forward to your post.

Your tuto is great as always @wlanboy, but LXDE or OpenBox are more lightweight than XFCE as window manager. Personally, I like the OpenBox+XFCE approach in this type of scenario.
Yup the old discussion of XFCE vs LXDE. I do prefer xfce4. Maybe my decission is based on Lubuntu and I have to look again at LXDE again because Linux Mint did a good job.


Maybe you can add some lines for the LXDE path?

Beside that I allready started to look into OpenBox:

lxc-containers.jpg

Post a free -m :D


Francisco
It is the "vnc" container running xfce4.
 
Tried XFCE and LXDE simply to see which one seemed to be less of a resource hog (this clearly wasn't an exhaustive test) than the other and it seemed like LXDE won that 'competition'.
 

bauhaus

Member
Yup the old discussion of XFCE vs LXDE. I do prefer xfce4. Maybe my decission is based on Lubuntu and I have to look again at LXDE again because Linux Mint did a good job.
I'm not a LXDE fan, I just mentioned because if you are using a Desktop Environment for you remote desktop, LXDE is more lightweight than XFCE. Now if you choose OpenBox as a Window Manager and keeping XFCE without xfwm4 that is a winning solution. Of course, the differences between xfwm4 and openbox are really more about choice, as always in linux world. Both are fast, small memory footprint, etc. But in my experience for a remote desktop openbox is better because is more efficient and less obtrusive. Good to see you are already checking it out.
 

nunim

VPS Junkie
I've been pretty busy, had a nasty bug to fix in Debian x64 before I could release this into the wild but here it is:

Tested on Debian 7 & Ubuntu 12-13


wget http://www.sonicboxes.com/nx/autolxde.sh
chmod 755 autolxde.sh
./autolxde.sh

For full tutorial & links to Clients for Win, Linux, OSX & Solaris, See - http://www.sonicboxes.com/lowmem-debian-lxde-nomachine-script/

I believe you can also use the OpenNX as their client is supposed to be a drop in replacement but I have not tested these and thus cannot offer any support  When I get some time I'll write up an actual VPSB tutorial for this, in the meantime enjoy the script..
 
Last edited by a moderator:

Alto

New Member
@nunim, I've been using that script whenever I needed a quick RDP setup for the last year or so, never realised it was yours, so thanks for putting it together; it's been a massive help to me on a number of occasions.

My only issue with NX 3.5 is that there's no way of getting it to play nice with iOS devices, but for desktop OS it's pretty much perfect IMO.
 

nunim

VPS Junkie
@nunim, I've been using that script whenever I needed a quick RDP setup for the last year or so, never realised it was yours, so thanks for putting it together; it's been a massive help to me on a number of occasions.

My only issue with NX 3.5 is that there's no way of getting it to play nice with iOS devices, but for desktop OS it's pretty much perfect IMO.
You're welcome :)  That's about my only complaint with NX, NoMachine is working on an iOS/Android client but it will likely be 4.x only when it is released. 
 
4.x currently just seems like such a pain in the arse to get up and running, thanks for the script @nunim, my lazy ass can't be bothered to spend so much time trying to get things functioning as desired.
 

ubayogi

New Member
I've been pretty busy, had a nasty bug to fix in Debian x64 before I could release this into the wild but here it is:

Tested on Debian 7 & Ubuntu 12-13


wget http://www.sonicboxes.com/nx/autolxde.sh
chmod 755 autolxde.sh
./autolxde.sh

For full tutorial & links to Clients for Win, Linux, OSX & Solaris, See - http://www.sonicboxes.com/lowmem-debian-lxde-nomachine-script/

I believe you can also use the OpenNX as their client is supposed to be a drop in replacement but I have not tested these and thus cannot offer any support  When I get some time I'll write up an actual VPSB tutorial for this, in the meantime enjoy the script..
Could you please restore the various download links referred by the script as well as the client download link provided in your tutorial. I used to use 3.5 on several Ubuntu LTS 12.04 amd64 machines last year. Worked fantastic. Now I don't have the binaries and NX 4 sucks. Spent a whole day & unable to get it working.
 
Top
amuck-landowner