Ubuntu 14.04 Mirror

Creating an Ubuntu mirror is useful if you have a network with multiple Ubuntu clients and you don't want each client to go out to the Internet for updates. This tutorial covers creating a full Ubuntu mirror, which will require approximately 750GB of disk space.

First, install Apache:

sudo apt-get install apache2

Create a folder to contain the mirror contents:

sudo mkdir /path/to/mirror/contents

Symlink the mirror contents folder to the Apache website folder. The following command will make a shortcut called "ubuntu" in the /var/www/html directory which points to the mirror contents:

ln -s /path/to/mirror/contents /var/www/html/ubuntu

Now use rsync to pull the mirror contents. The delete and progress modifiers shown below delete old content and show the sync progress:

rsync -a --delete --progress rsync://[your favorite official ubuntu mirror]/ubuntu/ /path/to/mirror/contents/

Optional Rsync Settings

The new mirror can be used as an upstream mirror for other mirrors. To do this, rsync must be set to run as a daemon. Edit /etc/default/rsync:

RSYNC_ENABLE=true

A daemonized rsync requires the file /etc/rsyncd.conf:

[ubuntu]

path = /var/www/mirror/ubuntu

read only = yes

list = yes

uid = nobody

gid = nogroup