How to build custom repository server so that all client install packages from my machine.

what type of URL to add in /etc/apt/sources.list file on Client Machine. to fetch that particular package


1 Answer 1


Installing apache :

sudo apt-get install apache2

Creating needed directories

Create a directory inside the webroot /var/www/

let's say name it repo.

sudo mkdir /var/www/repo

Now under repo you should create a directory for each architecture you want to use if you want more than one architecture.

For here i'll use amd64 for my 64bit systems. So, let's create this directory:

sudo mkdir /var/www/repo/amd64

Creating Packages.gz file

use the command dpkg-scanpackages

cd /var/www/repo/
sudo dpkg-scanpackages amd64 | gzip -9c > amd64/Packages.gz

Add the new repo

sudo -H gedit /etc/apt/sources.list.d/custom-repo.list

then add the line:

deb http://Your_Systme_IP/repo/ amd64/

Finally, update sources list:

sudo apt-get update

Now whenever you try to install any app, if you have its debs in your local repo then you install from it else then going to install from Internet.

  • What if my server is Fedora and my client uses Ubuntu Machine . will it work. Will be my client able to fetch the deb file Jul 16, 2015 at 6:40
  • Ok !!! Thank you for your reply. will try and let you know Jul 16, 2015 at 6:45
  • Hey Not working Jul 16, 2015 at 8:40
  • W: Failed to fetch 404 Not Found Jul 16, 2015 at 8:49
  • I have added ip address and fedora does not contain dpkg-scanpackages and I have added i deb file in amd64 folder Jul 16, 2015 at 8:52

Not the answer you're looking for? Browse other questions tagged or ask your own question.