What is Ubuntu Repository?
It is the place where all software’s builds are stored for ubuntu. And when you make any install it downloads the package and install it.
Who should create a Repository?
If you have a lots of ubuntu machines and you want to update and install a lot of packages in all the machines,else you have a slow internet connections then this is for you.
How can you create a Repository?
There are many ways how you can create a Repository.
- apt-proxy
- apt-cacher
- apt-mirror
Here I am going to show you how to create using apt-mirror. And if the machine is connected to internet,with web configuration it can also be used as a mirror in internet to download from.
Process of Creating The Repository
First of all you need a fast internet connection(this is required only once) with about 80 GB space to get all the downloaded packages.
I am setting up a repository for maverick-meerkat and have also included third party softwares.If you want you can add to the repositories with new source link and also remove some if you don’t want some.It almost is about 63.9 GB but i have added another 20 GB for fail safe options.
So here we go.
Step1: First install apt-mirror
1 | sudo apt-get install apt-mirror |
now you have the apt-mirror installed,Lets configure it
Step2:
1 | gksudo gedit /etc/apt/mirror.list |
Here’s where you can enter the repositories that your local mirror will get all of it’s sources and debs from
Here’s what my mirror.list file looks like. Feel free to modify it to include or exclude what you will. Also, you may be able to find a closer and thus faster repository site i.e. in if you are in india you should look for an indian repository.
i have added all the repositories for maverick you can add according to your requirement.
step 3: Now we run it for the first time.Now its going to take a lot of time so you should devote a few hours for it.But in case you want to stop it and restart it from there the is no problem as it continues from there.so you can just run it when no one is using the connection.
1 | sudo apt-mirror /etc/apt/mirror.list |
step4: Phew once that’s done you’ll get some instructions on how to clean up unwanted files. Follow those.They’ll probably ask you to run below
command,but double check with your output.
1 | sudo /var/spool/apt-mirror/var/clean.sh |
step 5: Now once done with the download we can add it in the cron file so that it get updated every day.Run the command to edit the file
1 | gksudo gedit /etc/cron.d/apt-mirror |
just uncomment the # from the last line and it will be updated every day at 4:00 AM you can edit and also change the timing and interval.
step 6: Now lets see how to use this repository.The easiest way would be using a web server like apache.so install apache
1 | sudo apt-get install apache |
step 7:point the mirror to apache web directory
1 | ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu /var/www/ubuntu |
step 8: then add this repository in the machines you want to update.
for ex: if the machine can be accessed by ajatus.in then just add
1 | deb http://ajatus.in/ubuntu maverick main restricted universe multiverse. |
This is how you can set up your own repository for ubuntu.

