Personal Debian Repository

Software these days seems to becoming less and less maintainable. I serve as a buffer for this by maintaining my own aptly repository. In this way, I can host packages I can install on my systems in a coherent way that's as simple as apt-get install my-custom-package.

This also works great for software (like Discord) where they offer a DEB file download, but don't maintain their own repo. Why is beyond me and outside the scope of this post. However, you can use this to build custom Debian based packages and maintain them in your own package repository.

In this post, I'm going to show you how you can install your own if you want to maintain it and how you can add mine if you want to leverage the hosting of the packages I maintain or just keep track.

Add apt.markizano.net

The simplest thing you could do is to add my hosted repository for the software that I maintain in a Debian-based repository. Here are the steps:

  1. Install the key in the apt trusted directory:
sudo wget -O /etc/apt/trusted.gpg.d/markizano.asc https://apt.markizano.net/key.asc
  1. Create the sources.list file so you can see and install the repos:
echo "deb [arch=amd64] https://apt.markizano.net discord main" | sudo tee /etc/apt/sources.list.d/markizano-discord.list
  1. Now you can update your package repo list and install the software:
sudo apt-get update && sudo apt-get install discord

I have a daily script setup to check the version for me and remind me to update the version. As of this writing, Discord and Zoom are the two software I keep up to date here. The other repos are not as well-maintained.

Note: If you have issues with apt-get update after adding the above, you may need the apt-transport-https package to ensure you can install packages over HTTPS.

The result is you can now just keep your packages up to date just like any other package.

Now keep in mind, I just have a single small VPS that hosts my packages. It's not meant for industrial strength package management. So don't go configuring Jenkins or automation against it as it wasn't intended for that. The server itself is also located in Dallas, TX, so if you are geographically far away from that, you may experience some latency.

Roll Your Own

If you like what you see and you want to roll-your-own, I am totally a fan of this! Managing our own infrastructure, I believe, is the best way to maintain a decentralized internet.

Fondly enough, you can install aptly using your very own Debian package manager:

sudo apt-get install aptly

Once you have it installed, you can initialize a directory to use this for managing your own packages. You can also use it to mirror repositories for your own internal networks. Folks who work in high-compliance environments may appreciate this for security purposes. With this, they can ensure packages are properly scanned and secured.

It's also great for bandwidth-saving purposes. Sync once and run automation against a local mirror instead of downloading across the internet over and over.

You can view the documentation for more information on the high level overview of how this works. For the following parts, I'm going to combine the parts the documentation just states.

Configuration

You can configure aptly using a simple JSON data structure. This is either installed local to the user in ~/.aptly.conf or globally in /etc/aptly.conf.

Personally, I prefer to create an unprivileged user and run aptly as that user account. I also configure local instead of global as I don't need aptly outside of just that user account.

Repos & Mirrors

Once configured, you can setup repos, which are used to store individual packages. You can setup mirrors which can be used to copy an entire repository down. Be sure to have enough disk space. Often package mirrors for the original Debian and Ubuntu repos are several GB in size.

Snapshots & Publish

Once you have your repo or your mirror created, you create a snapshot from it which takes a picture in time of the state of the repo or mirror. You can then take the snapshot and publish it.

Sample Script

Here's a sample script I use to keep my Discord package up to date:

https://gist.github.com/markizano/3d3d63b1b7978db327609ebe5fce8a1f

Feel free to tweak this for your needs. I have my GPG key setup with a password, so I have parts in here to make it possible for GNUPG to ask for it when aptly goes to publish.

I use this as a template for various scripts (like Zoom as well) that I use to track other software in which a DEB download is provided, but no apt repository.

Happy coding!

Comments

Popular posts from this blog

Setup and Install Monero(d) -- p2pool -- xmrig

Subversion Tutorial

Connect to Wi-Fi in Linux using `wpa_supplicant` and `dhclient`