1# ------------------------------------------------------------------
2# Description: This script will install a virtual network server
3# on a remote machine (i.e. Amazon E2) and setup
4# TigerVNC as the forwarding server. You need to run
5# this script from the server you plan to access.
6#
7# Usage: > python setup-server
8#
9# Requirements: Ssh must already be setup between server and client.
10# Works on Ubuntu 18 and 20. Not tested on any other
11# OS.
12#
13# Author: William Li
14# Date: 12-14-2021
15# ------------------------------------------------------------------
16from os import system
17
18# update the package manager
19system("sudo apt update")
20
21# setup KDE Plasma (desktop environment)
22# Select the KDE’s default sddm display manager and hit the OK button.
23system("sudo apt install kubuntu-desktop")
24
25# if you want to uninstall use the following command:
26# system("sudo apt remove kubuntu-desktop --autoremove")
27
28# setup virtual network server
29system("sudo apt install tigervnc-standalone-server tigervnc-common")
30
31# setup the VNC server
32# you can choose to setup a password (can be empty)
33system("vncserver")
34
35# kill all opened ports by vncserver
36system("vncserver -kill :*")
37
38# copy the startup configuration file into .vnc directory
39system("mkdir $HOME/.vnc")
40system("cp xstartup $HOME/.vnc/")
41
42# startup VNC server with xstartup settings
43system("vncserver")