If you ever wanted to know how to host your own apt repository on Debian or Ubuntu then this article is for you. We’ve tested multiple solutions and have found that using Freight is by far the easiest way to get a private repository up and running quick. Freight is a modern take on Debian archive management. It is written and maintained by Richard Crowley and is available on GitHub. This article has been copied and slightly modified from Richard Crowley’s GitHub page. First we will want to setup the Freight archive in apt with the commands below.
# download the GPG key of the repository and add it to apt wget -O - https://swupdate.openvpn.net/repos/repo-public.gpg | sudo apt-key add - # create apt sources file for freight repo echo "deb http://build.openvpn.net/freight_team $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/freight.sources.list # update apt & install package apt-get update & apt-get -y install freight
Once Freight is installed, we will need to create the /etc/freight.conf
file by running the command below. Once you have created the config file, edit the GPG
variable with the email address you will use when creating your gpg key, also seen below.
# create freight.conf mv /etc/freight.conf.example /etc/freight.conf # update /etc/freight.conf nano /etc/freight.conf # set gpg email address GPG="mmarable@oitibs.com"
Now we have the base install of Freight complete and all that is left to do is create a gpg key for signing packages in your new apt repository. In order to create your key run the command below.
# create gpg key for freight repo gpg --gen-key
Adding Packages to Freight
Next, we will want to add a package to our newly created Freight repository using the commands below. In this example, we are adding a Postfix package that has been compiled with the VDA patch. Note, the package has been copied to the /tmp
directory prior to running the commands below.
# navigate to package directory cd /tmp # add postfix package freight add postfix_2.11.2-1~oitibs+1_amd64.deb apt/wheezy # update freight cache freight cache
The last thing we will need to do is setup Nginx to host our newly created repository. This can be accomplished by adding a simple location statement to out main site as seen below. Once this configuration is complete, we will be hosting out repository at https://oitibs.com/repo. InĀ our follow up article Remove Package From Freight we have detailed how to remove packages from your Freight repository.
RCrowley’s repository is unmaintained. For a maintained fork of Freight see:
https://github.com/freight-team/freight
Thanks for the update.