Lazy configure Ubuntu minimal desktop and VNC 
            
                        This script automates the installation of a minimal desktop environment (LXDE) and tightvncserver.
Tested on Ubuntu 16.04 LTS.
#!/bin/bash
set -xe
# Run this script as a user with sudo rights
# Password for the vnc server
PASSWORD="Passw0rd" # please change this password before you run
VNC_STATE_FOLDER="$HOME/.vnc"
# Install minimal desktop and tightvnc
sudo apt update
sudo apt install xorg lxde-core tightvncserver \
    firefox chromium-browser -y
mkdir -p "${VNC_STATE_FOLDER}"
echo $PASSWORD | vncpasswd -f > "${VNC_STATE_FOLDER}/passwd"
chmod 0600 "${VNC_STATE_FOLDER}/passwd"
cat << EOF >> ${VNC_STATE_FOLDER}/xstartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession
lxterminal &
/usr/bin/lxsession -s LXDE &
EOF
chmod 777 ${VNC_STATE_FOLDER}/xstartup
tightvncserver  :1
                    
                    That's all, folks!
Tweet