How to create your own local Ubuntu Repository part 1

28 Nov


I find this tremendously useful to have my own repositories on a local drive, as I do most of my development offline or in a place where there’s no Internet. Also, it speeds downloads faster. But it’s very cool to say to people that you have 26,000 programs on a disk that pops in your pockets.

These are all the tools necessary (probably too many but some are there to create DVD based respoitories)…

In a terminal copy/paste this…
sudo apt-get install debmirror liblockfile-simple-perl liblog-agent-perl ruby mkisofs dpkg-dev libdigest-sha1-perl libruby libzlib-ruby

Now you need to find a mirror that ain’t gonna bust ya download limit – cos it will – cos these download are huge! Unless ya got unlimited then who cares. But many larger ISPs will have their own free download server. And many times it’ll have a Linux folder. I’m with iinet and I did a search on Google… “iinet ftp” – this’ll bring up a result with “Index of /” – BINGO!

Click it – click the pub folder – see if there’s a ubuntu folder – click on that – then if you see a list of folders with dist indices pool project …. then BINGO! … again.

So the host is
and the root is ubuntu/ … this’ll make sense in a tick. You need to find your own free download server from your ISP.

I prefer a USB Hard drive cos for $80 u can get 500GBs. Reformat it to ext3 (ext4 is better but older distros can’t use ext4) using gparted. And now you’ve got a large blank Hard drive ready.

Make sure that’s it’s mounted before starting the next step. See what the path is to the USB Hard Drive by looking in your File Manager – mine’s /media/disk

Using my ISP free Server…
In a terminal copy/paste this:
debmirror –source -m –passive – –root=ubuntu/ –method=http –progress –dist=lucid,lucid-security,lucid-updates,lucid-backports,lucid-proposed –section=main,restricted,universe,multiverse –arch=i386 /media/disk/Lucid/LucidRepos –ignore-release-gpg –timeout=seconds -t 240
This is a 80GBs download!

arch means the type of versions: eg: i386 is the normal 32bit version – yo can change that to amd64 for amd 64bit processors.

Occasionally it will timeout due to a server reset/update or something similar. Just restart the download and it will restart where it last left off.

Warning: If you accidentally mistype the destination (eg: /media/disk/Lucid/LucidRepos) it’ll wipe all that directory. I’ll give an example that I was stupid enough to do. I was getting a smaller PPA repository and the destination was /home/martin/hardy/PPA; I forgot to finish that line as I went back to make another correction and I had only typed /home/martin. That wiped my entire home folder – clever! Luckily I had a backup from the previous day.

Your ISP may not have uploaded the latest security update from Ubuntu so once the download has finished check your repository with this:

copy/paste into a Terminal:
debmirror –source -m –passive – –root=ubuntu/ –method=http –progress –dist=lucid,lucid-security,lucid-updates,lucid-backports,lucid-proposed –section=main,restricted,universe,multiverse –arch=i386 /media/disk/Lucid/LucidRepos –ignore-release-gpg –timeout=seconds -t 240

This is the official Ubuntu Server. To keep this up-to-date I update my mirror every 2 weeks using the official server. Probably a 1-2gb download.

How to point to the local drive instead of online:

In a terminal copy/paste this:
sudo gedit /etc/apt/sources.list

everything that points to the server needs to be changed from to file:///media/disk/Lucid/LucidRepos (don’t change anything else on that line and remember that the desitination make be named differently) – save and close

In Terminal type:
sudo apt-get update


Any error means that you’ve pointed it wrong to the wrong place.

I will copy and example of my source.list file in the comments section.

Next I will show you all the extra repositories you can accumulate.


PS: If you don’t want the source code where it says –source change that to –nosource (smaller download)


Posted by on November 28, 2011 in TLC CE Linux


3 responses to “How to create your own local Ubuntu Repository part 1

  1. toowoombalinux

    November 28, 2011 at 8:38 pm

    NOTE: This creates a repository for Ubuntu Lucid Lynx – if you want to create a Repository for Ubuntu 11.04 then you change lucid with natty – I think you get the drift

  2. chrisgu

    April 27, 2013 at 9:43 pm

    I have to say that with all the jibba jabba you guide was extremely hard to follow. Generally people need step by step with commands highlighted. I look forward to take two

    • toowoombalinux

      June 9, 2013 at 11:42 am

      Hey Chrisgu – creating your own repository isn’t for the beginner and does require some pre-knowledge of commandline and apt configuration – that being said I am an advocate for making things understandable to all n sundry – a quick look through my posts will confirm this – if I get time I will endeavour to make a more step-by-step guide – cheers Martin


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: