Setting up a Debian repo in LAN

It was really a nice experience going to MES College Of Engineering, Kuttippuram last week to attend Debian Mini Conf 2011. Met friends, made new friendships and learned many new things from there. Thanks to Jishnu ettan, for giving me a 50GB Debian repo that contains all the packages of squeeze of both i686 and amd64 architectures. Today, I will explain how to set up a Debian repo (squeeze) so that it be can shared over LAN.

First, run terminal and switch to root user.

$su

If you have the repo as an ISO image file, we need to mount it to a directory. The following command does that:

#mount <path-to-iso> <path-to-mount> -o loop

Edit /etc/apt/source.lst and add the repo we mounted. Append the following line to the file:

deb file:///<mounted-path> squeeze main

Update the package list:

#apt-get update

We are going to share the files using http, hence we need a webserver. To install apache:

#apt-get install apache2

Make a symbolic link of <mounted-path> in /var/www

#ln -s /var/www/repo <mounted-path>

Done! Now add this machine as a repository in other Debian systems in LAN, edit /etc/apt/source.lst to:

deb http://<ip-of-server>/repo squeeze main

The same can be done using a FTP server. All you have to do is to make the symbolic link in FTP's configured path and use ftp:// instead of http:// in /etc/apt/source.lst. Thank you :)

Leave a Comment