Installing a lightweight LXDE+VNC desktop environment on your Debian VPS

LXDE Desktop + VNC For Remote Server Access – Debian

First Make sure Debian is up to date …

apt-get update
apt-get upgrade
apt-get dist-upgrade

Then install X, LXDE and VNC …

apt-get install xorg lxde-core tightvncserver

If you want to use another user than root to connect your VNC then add a VNC-User and set his password:

adduser -G users,ssh vncuser
passwd vncuser

Now start the vnc server to create a config file:

vncserver :1

 

now let’s kill the vnc server to configure his xstartup file

vncserver -kill :1

use your favorit editor (vi) to add an extra line in the xstartup file

vi ~/.vnc/xstartup

Add this line at the end of the file and save and exit

lxterminal & /usr/bin/lxsession -s LXDE &

Now you can run the VNC Server again:

tightvncserver :1

Now you can connect to your VPS:

[server ip]:5901

Now it should ask you password and taadaa you are using VNC now

Install SSH-Server

apt-get install openssh-server

 

Additional: Run vncserver at startup

nano /etc/init.d/tightvncserver

And copy following code and past it or  download the code (remove .doc  tightvncserver) and change root to the user account that you are using to run tightvncserver

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see:
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER=’root‘
### End customization required

eval cd ~$USER

case "$1" in
 start)
 su $USER -c '/usr/bin/tightvncserver :1'
 echo "Starting TightVNC server for $USER "
 ;;
 stop)
 pkill Xtightvnc
 echo "Tightvncserver stopped"
 ;;
 *)
 echo "Usage: /etc/init.d/tightvncserver {start|stop}"
 exit 1
 ;;
esac
exit 0

or this ….

#!/bin/sh
### BEGIN INIT INFO
# Provides: tightvncserver
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/stop tightvncserver
### END INIT INFO

# More details see:
# http://www.penguintutor.com/linux/tightvnc

### Customize this entry
# Set the USER variable to the name of the user to start tightvncserver under
export USER=’vncuser‘
### End customization required

eval cd ~$USER

case "$1" in
 start)
 su $USER -c '/usr/bin/tightvncserver :1'
 echo "Starting TightVNC server for $USER "
 ;;
 stop)
 pkill Xtightvnc
 echo "Tightvncserver stopped"
 ;;
 *)
 echo "Usage: /etc/init.d/tightvncserver {start|stop}"
 exit 1
 ;;
restart)
$0 stop
$0 start
;;
esac
exit 0

 

After this run you
sudo chmod 775 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults

.

Edit 2019-10-28