- Create swap space. If RAM ~ 1G, 4G would be an overkill in most cases and should be replaced with 2G.
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
- Update official repo & packages. Install modules for gnome-desktop. Install VNCServer.
sudo apt update && sudo apt upgrade
sudo apt install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal gnome-core tightvncserver -y
- Run VNC server. First run would trigger VNC config. Configure VNC startup script to initialize desktop env on VNC startup and restart daemon.
vncserver
sudo echo "gnome-panel & gnome-settings-daemon & metacity & nautilus &" >> .vnc/xstartup
vncserver -kill :1
vncserver
VNC ports are usually in the 5900 range. So our server should be accessible at :5901. Check startup logs if this doesn't work.
(sudo fallocate -l 4G /swapfile && sudo chmod 600 /swapfile && sudo mkswap /swapfile && sudo swapon /swapfile && sudo echo "/swapfile swap swap defaults 0 0" >> /etc/fstab); sudo apt-get update; sudo apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal gnome-core tightvncserver -y && vncserver && sudo echo "gnome-panel & gnome-settings-daemon & metacity & nautilus &" >> .vnc/xstartup && vncserver -kill :1 && vncserver
This script vs Snapshots: Depends on your provider. Snaps are cheap but still incur a monthly bill. This script can replace a VNC setup snapshot given your cloud account has enough bandwidth sitting around to cover installation.