I'm using my mirror as the example for this tutorial and assuming your mirror will be used internally, not offered as an official mirror.
Start by installing apt-mirror and apache2:
System – Administration – Synaptic Package Manager.
Searching for apt-mirror then apache2 will give you the packages you need.
If you prefer to install using the terminal:
Code:
apt-get install apt-mirror apache2
Code:
sudo cp /etc/apt/mirror.list /etc/apt/mirror.list.orig sudo cp /etc/apt/sources.list /etc/apt/sources.list.orig sudo cp /etc/cron/apt-mirror /etc/cron/apt-mirror.orig sudo cp /var/spool/apt-mirror/var/postmirror.sh /var/spool/apt-mirror/var/postmirror.sh.orig
Now edit the files. The examples use nano, but gedit can also be used by invoking it within a terminal using gksudo.
Starting with mirror.list:
Code:
sudo nano /etc/atp/mirror.list
For the most part, the repositories section should be okay with its default entries as well. You might want to add the partner repository by adding this line:
Code:
deb http://archive.canonical.com/ubuntu lucid partner
Code:
deb http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
Add a couple of lines to the “clean” section to clean up the extra repositories if you added or modified them as above:
Code:
clean http://archive.ubuntu.com/ubuntu clean http://security.ubuntu.com/ubuntu clean http://archive.canonical.com/ubuntu
Code:
sudo su apt-mirror apt-mirror
Once the mirror is populated, link the repository to the web server:
Code:
sudo ln -s /var/spool/apt-mirror/mirror/archive.ubuntu.com/ubuntu /var/www/ubuntu sudo ln -s /var/spool/apt-mirror/mirror/security.ubuntu.com/ubuntu /var/www/security sudo ln -s /var/spool/apt-mirror/mirror/archive.canonical.com/ubuntu/ var/www/canonical
Now edit postmirror.sh to invoke the clean script:
Code:
sudo nano /var/spool/apt-mirror/var/postmirror.sh
Code:
/var/spool/apt-mirror/var/clean.sh
Code:
sudo chmod u+x /var/spool/apt-mirror/var/clean.sh sudo chmod u+x /var/spool/apt-mirror/var/postmirror.sh
Code:
sudo nano /etc/cron.d/apt-mirror
Moving to the client side:
Edit the sources.list file that will be used to access the mirror.
Code:
sudo nano /etc/apt/sources.list
Code:
deb http://127.0.0.1/ubuntu lucid main restricted universe multiverse deb http://127.0.0.1/ubuntu lucid-updates main restricted universe multiverse deb http://127.0.0.1/ubuntu lucid-backports main restricted universe multiverse deb http://127.0.0.1/ubuntu lucid-proposed main restricted universe multiverse deb http://127.0.0.1/security lucid-security main restricted universe multiverse deb http://127.0.0.1/canonical lucid partner
Code:
deb http://security.ubuntu.com/ubuntu lucid-security main restricted universe multiverse
2 comments:
This is a helpful article! I wanted to mention that you might consider revising the layout to make it more readable. Most of the pre-formatted code blocks are cutoff in the browsers I tried (IE, Safari, Firefox and Chrome). But I was able to read it by looking at the page source.
Thanks!
Hi, I hope this comment reaches you. regarding your post on the ubuntu repo. Have you got this system working well now?
I followed the instructions to the letter. When I run apt-get update on a client it states that some of the links are missing. Do I need to wait for the download of the repo to fully complete?
Also I checked one of the directories for an application to test install. libnotify for example. I saw the package there but when I issue apt-get install libnotify it states that the package cannot be found. Any ideas?
Post a Comment