Home > DIY, Software, ubuntu > Local network Ubuntu repository

Local network Ubuntu repository

If I would have realized how easy this is to do, I would have done it a long time ago. For the price of ~12 GB of disk space, you can easily keep your own mirror of the ubuntu repositories. That takes a significant load off your Internet connection, and greatly speeds up software installations.

This is adapted from here, and here. Replace any reference to “username” with your username.

sudo aptitude install debmirror

Create a directory for the repository:

mkdir /home/username/repos
sudo gedit /bin/repoupdate

Insert the following:

#!/bin/bash -x

/usr/bin/debmirror –nosource -m –passive –host=archive.ubuntulinux.org \
–root=ubuntu/ –method=ftp –progress –dist=dapper \
–ignore-release-gpg –section=main,multiverse,universe,restricted \
–arch=i386 /backups/ubuntu/

Save and close it, then make it executable:

sudo chmod +x /bin/repoupdate

Kick off your update by doing:

sudo repoupdate

It takes a long time to download all the files.

Now you can access it on the same machine by modifying your apt sources.list:

sudo gedit /etc/apt/sources.list

replace:

deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

with:

#deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

deb file:///home/username/repos/repos dapper main universe multiverse restricted

To use it for other machine on the LAN, you’ll need to make it accessible to Apache. Make a symbolic link in the web server directory to your user folder:

cd /var/www/
sudo ln -s /home/username/repos repos

Modify the privs of the user folder:

cd /home/
sudo chgrp www-data username
chmod 770 username

Now you should be able to browse to the directory from http://<ip of computer>/repos

Now you can access it by modifying your apt sources.list:

sudo gedit /etc/apt/sources.list

replace:

deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

with:

#deb http://archive.ubuntu.com/ubuntu/ dapper universe multiverse main restricted

deb http://<ip address>/repos/repos/ dapper main universe multiverse restricted

If you ever mess up your sources.list or just want to start fresh, source-o-matic is a great tool for building a new file.

About these ads
Categories: DIY, Software, ubuntu
You must be logged in to post a comment.
Follow

Get every new post delivered to your Inbox.

%d bloggers like this: