In this howto we look at creating a local software repository for Ubuntu 12.04, the suite name precise. We are starting with a fresh install of Ubuntu Server and I have added in an extra 20GB drive mounted to the /repo directory of the server. To start we add in the apt-mirror package
sudo apt-get install apt-mirror
With the installed we need to edit the configuration file /etc/apt/mirror.list. I will un-comment the line to set the base path and for my server I use:
set base_path /repo/apt-mirror
Next I choose only the 32 but packages by using deb-i386 in-place of deb. For 64 bit we could use deb-amd64. I also set the mirror server to be gb.archive.ubuntu.com. You can use your own two letter country code in place of gb. At the end of the line I choose to replicate only the main repository. The line reads:
deb-i386 http://gb.archive.ubuntu.com/ubuntu precise main
I can add more in but for the moment this is all that is required and keeps the space requirements down. On my system 9.8GB was downloaded and of course the time is dependent on your connection to the internet and your mirror speed. It took and hour on my system.
When downloaded we can then connect the local client, the server itself to the repository. Removing all other entries from the /etc/apt/sources.list file. I leave only the local repo pointing to.
deb file:///repo/apt-mirror/mirror/gb.archive.ubuntu.com/ubuntu precise main
Note that the suite name precise and the repository main are not part of the delimited path. This will be for the moment just using the file protocol and there are 3 forward slashes. In a later video will will add the web server and make this an HTTP repo for other machines.
With the client file in plave we can run the update to re-read the repo
sudo apt-get update
and a simple test to see it working by adding in the port scanner nmap
sudo apt-get install nmap