Using a local APT Repository for your Student VM

Watch out! This tutorial is over 6 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.
Tutorial Difficulty Level    

Advanced Package Tool, or APT, is a free software user interface that works with core libraries to handle the installation and removal of software on Debian, Ubuntu and other Linux distributions. APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code.

Say you wanted to install postfix, normally you would first run

sudo apt-get update

which updates the local package lists for upgrades to packages (that need upgrading), as well as new packages that have just come to the repositories. Now when you run

sudo apt-get install postfix

your server knows what the latest version is and where to pull it from (usually at your nearest archive mirror). Our Ubuntu packages usually come from HEAnet’s mirror in Dublin, which is really fast. But what is this is really busy, or even down?! Surely a mirror inside DkIT would be better still? Well, now we have one (internal only). And here are the changes to make to your Ubuntu 16.04 or Ubuntu 18.04 Virtual Server (or REAL machine) repository list, found at /etc/apt/sources.list on both distro versions (note that the Ubuntu 16.04 Quick Instance and Ubuntu 18.04 Quick Instance have been modified to use this going forward).

Here is the new file contents on 16.04:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial main restricted
#deb-src [ arch=amd64] ftp://apt.comp.dkit.ie/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates main restricted
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial universe
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial universe
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates universe
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial multiverse
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial multiverse
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates multiverse
deb-src [arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ xenial-updates multiverse

deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security main restricted
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security main restricted
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security universe
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security universe
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security multiverse
#deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu xenial-security multiverse

and on 18.04:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic main restricted
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-updates main restricted
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic universe
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic universe
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-updates universe
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic multiverse
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic multiverse
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-updates multiverse
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-backports main restricted universe multiverse
# deb-src http://ie.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu bionic partner
# deb-src http://archive.canonical.com/ubuntu bionic partner

deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-security main restricted
# deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu/ bionic-security universe
# deb-src http://security.ubuntu.com/ubuntu bionic-security universe
deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/ubuntu bionic-security multiverse
# deb-src http://security.ubuntu.com/ubuntu bionic-security multiverse

Be sure to run

sudo apt-get update

afterwards, and even run

sudo apt-get dist-upgrade

which will get all available updates for your current setup.

For the moment we are only supporting Ubuntu LTS releases still inside the 3 year support window. The  repo mirror also has files for the current Debian stable release, but if you are a Debian user you likely don’t need an explanation of what to do! The config is even simpler than Ubuntu:

#deb cdrom:[Debian GNU/Linux 9.4.0 _Stretch_ - Official amd64 DVD Binary-1 20180310-11:21]/ stretch contrib main

deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/debian/ stretch main contrib non-free
deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/debian/ stretch main contrib non-free

deb [ arch=amd64 ] ftp://apt.comp.dkit.ie/debian/ stretch-updates main contrib non-free
deb-src [ arch=amd64 ] ftp://apt.comp.dkit.ie/debian/ stretch-updates main contrib non-free

# all Debian security updates are fed DIRECTLY from this repo, always
deb http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ stretch/updates main contrib non-free

Restoring Original Configuration

Should you find you ever need to put back the original contents of sources.list, the below will suffice.

For Ubuntu 18.04:

deb http://archive.ubuntu.com/ubuntu/ bionic main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ bionic universe
deb http://archive.ubuntu.com/ubuntu/ bionic-updates universe
deb http://archive.ubuntu.com/ubuntu/ bionic multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

and for the earlier Ubuntu 16:04:

deb http://archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://archive.ubuntu.com/ubuntu/ xenial universe
deb http://archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse