• Linux
  • FreeBSD
  • Networking
  • Python
  • AWS
  • WebDev
  • About Us

How to create a custom apt-repository in Ubuntu

Written by
Linux Leave a Comment

First you need apache webserver for this :

apt-get install apache2

Then create a folder in web root

mkdir /var/www/repo

Now you need the dpkg-dev packages:

apt install dpkg-dev

Now copy all the required .deb files to /var/www/repo/ and then run the command:

dpkg-scanpackages -m . | gzip -c > Packages.gz

So everytime you add a new .deb file to this location , you need to run the above command to add it to the pakages.

Now to get it working locally, you need to edit the file:

/etc/apt/sources.list

Add the following line to the above file :

deb [trusted=yes] file:///var/www/repo/ ./

The Trusted=Yes will instruct the apt to treat packages as authenticated . So if you want to share it over a remote client , you need to get it over the webserver:

deb https://www.yourserverdomain.com/repo/ ./

To get it working over https , you need to install and configure the https package .

© Copyright 2020.TechieNix. All Rights Reserved.