Connect to your Virtual Machine

  • Connect to UNBC’s Virtual Desktop Infrastructure: https://www.unbc.ca/information-technology-services/virtual-desktop
  • Open up Windows Remote Desktop Connection, and enter the IP address provided to you in feed back from your fist assignment.
  • Once you press connect you will be given the login screen, log in as root, and use the password you submitted in the first assignment.

Create a new User account

Open a new terminal

adduser <username>

After the new user is created add it to the super users group

usermod -aG sudo <username>

Now logout

Update your virtual machine

sudo apt update #Updates the list of available software on your computer

sudo apt upgrade #Upgrades all your software to the newest version

Installing software

There is two ways to install software on debian one is to download software with the .deb file extension (This is the Debian equivelent to .exe on Windows), then install with the command

sudo gdebi <filename>.deb

Or we can install from the repositories we just updated using the command

sudo apt install <program_name>

Note at this point that you can add software repositiories (think of it like adding an additional app store on your cellphone) You can see the list of repos in your computer with the following command.

cat /etc/apt/sources.list	

There is a few things you will notice in the output of this command, first these virtual machines are being updated from the GIS servers, normally these would default us.debian.org, but why use internet when we can use our 40GBps connection in the server room.

Secondly you will notices that there are sources other than debian, such as Google Earth, QGIS, PostgreSQL, and Visual Studio code.

If you would like to learn more about how these repositories were added to the system take a look here https://www.qgis.org/en/site/forusers/alldownloads.html under the Ubuntu/Debian heading.

The software we need to install for the course are

  • postgresql
  • pgadmin4
  • postgis
  • qgis
  • qgis-server
  • python3
  • python3-pip
  • code (This is Microsoft Visual Studio Code)
  • nginx
  • git
  • ufw
  • fail2ban

We will likely need more software as we progress, but now we know how to install it, and it will be easy to add as we go.

Finally we are going to download PyCharm using the jet-brains tool box.

First lets download some files from git, and then running a script that will install all the needed files (Note: only run scripts from sources you trust! We are unfortunatly long past the days of linux being hard to infect with malware)

sudo apt update
sudo apt install curl

## If you have a previously failed install pre curl
sudo rm -r /opt/jetbrains-toolbox
sudo rm -r /usr/local/bin/jetbrains-toolbox
## End of clean up

git clone https://github.com/nagygergo/jetbrains-toolbox-install.git

cd jetbrains-toolbox-install #Change Directory to files we just cloned
./jetbrains-toolbox.sh #Exicute the shell script
jetbrains-toolbox #Launch the software we just installed

If you signed up for a jetbrains account in last weeks lab we will log into jet brains:

And then install PyCharm Professional

If you did not create a jetbrains acount simply install PyCharm Community

Configure the firewall

Before we turn on the firewall we are going to need to add some rules with the following commands

sudo ufw allow ssh #Allow SSH connections
sudo ufw allow 3389 #Allow Remote Desktop Connections
sudo ufw allow 3350 #Allow xrdp server
sudo ufw allow http #Allow port 80 traffic
sudo ufw allow https #Allow port 443 traffic
sudo ufw allow 5432 #PostgreSQL
sudo ufw allow 5050 #PGAdmin4

With these rules configured we can turn on the firewall, note that turning on the firewall before allowing access will break your remote connection.

sudo ufw enable

Change Default Python Version

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1

python --version #Should output "Python 3.7.3"

Configure PostgreSQL Authentication

Follow along the tutorial here: https://chartio.com/resources/tutorials/how-to-set-the-default-user-password-in-postgresql/ to update the password for postgresql, keep this password in a safe place as we will be refering back to it in a few weeks.