Wednesday, October 22, 2014

Installing LXDE+VNC desktop environment on your Ubuntu/Debian

Refer
  • http://www.vandorp.biz/2012/01/installing-a-lightweight-lxdevnc-desktop-environment-on-your-ubuntudebian-vps/#.VEf7DhC7Kl0
  • http://linuxpluse.wordpress.com/2013/01/13/remote-server-access-lxde-vnc/
Related
  • http://juuier.blogspot.com/2013/11/tunnelling-vnc-remote-over-ssh-on.html
Configuring TightVNC
  • Make sure Debian is the latest and greatest
apt-get update
apt-get upgrade
apt-get dist-upgrade
  • Install X, LXDE, VPN programs
apt-get install xorg lxde-core lxde-icon-theme tightvncserver
  • Start VNC to create config file (this command it show prompt for input new password vnc)
tightvncserver :1
  • Then stop VNC
tightvncserver -kill :1
  • Edit config file to start session with LXDE:
nano ~/.vnc/xstartup
  • Add this at the bottom of the file:
lxterminal & /usr/bin/lxsession -s LXDE &
  • If we want to change password again for vnc remote with this command
vncpasswd
  • Restart VNC
tightvncserver :1
  • You then connect using the VNC viewer of your choice on your local computer. I use the "VNC Free Edition Viewer for Windows Stand-Alone Viewer" at: http://www.realvnc.com Configure the viewer to access your VPS at: xxx.xxx.xxx.xxx:5901.
Run tightvncserver at startup
nano /etc/init.d/tightvncserver
  • add content :
#!/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
  • และเพิ่มให้เค้ารันตอนบูตระบบด้วยคำสั่งประมาณนี้
sudo chmod 775 /etc/init.d/tightvncserver
sudo update-rc.d tightvncserver defaults
  • Now next time you boot it will automatically runs tighvncserver
Update: To run application in LXDE as startup app, copy your application.desktop file (usually its in your desktop, otherwise make one by going to menu and right click on application and “add to desktop”) to [user]/.config/autostart
Tunnelling through SSH (make sure tunneling is allowed in ssh config) 
ssh -l user -p [ssh port usually 22] -L5901:localhost:5901 serverIp 
Example (in client terminal) :  
ssh -l root -p 22 -L5901:localhost:5901 10.10.0.1
goto vnc client and put localhost:5901

No comments:

Post a Comment