Skip to content

Instantly share code, notes, and snippets.

@kauffmanes
Created May 28, 2020 17:33
Show Gist options
  • Save kauffmanes/5aa81ee975ea78b2d63761a43be7b63d to your computer and use it in GitHub Desktop.
Save kauffmanes/5aa81ee975ea78b2d63761a43be7b63d to your computer and use it in GitHub Desktop.
Setting up a PPA Server

DON'T USE THIS YET - WORK IN PROGRESS

What's a PPA?

I've recently been trying out Electron.js for a number of new projects and it's so great to work with. It's useful for building desktop applications as advertised, but also for applications running in kiosk mode, such as an ATM screen or embedded GUI. The development of an Electron application is outside the scope of this article, but I'm mentioning it because that process outputted the .deb file that I'll using in this article.

So what is a PPA? PPA stands for Personal Package Archive and it's a way for developers to create source packages for Ubuntu that can be built and published as an apt repository. When you add your repository to your sources list, Ubuntu can perform updates just like any other Ubuntu package. If any of this sounds like a foreign language, I recommend reading this PPA Guide.

Setting up the Server

First you'll want to update your instance and install all necessary software. I'm also making a big assumption here that you already have a server ready to go and you have SSH access. For this scenario, I just spun up an AWS EC2 instance. There are plenty of docs for how to do this online, but feel free to leave a comment if you want some help with this. In my case, I'm using Ubuntu 18.04 t2.micro instance, because it's free-tier eligible.

# get the necessary software
sudo apt update
sudo apt upgrade
sudo apt install reprepro -y

Reprepro is a tool that we'll use to produce, manage, and sync a local repository of Debian packages. It makes the folder structure needed in the repository and has a number of commands to make setting up packages easier.

Next you'll want to setup your directories. You might need to use sudo for this.

mkdir -p /var/www/repo/conf
touch /var/www/repo/conf/distributions

Add the following to your distributions file:

Origin: repo.example.com
Label: repo.example.com
Codename: trusty
Architectures: i386 amd64 source
Components: main
Description: example repo
SignWith: D69C3E54

Setup GPG Key

What is a GPG key

When creating the GPG key, you'll need to create entropy on the server so that the key generation can make an accurate footprint. When you run the key gen command, it'll tell you to move your mouse around. This takes for ever. A way around this is to install a package called havaged, which is a random number generated using the HAVEGE algorithm.

sudo apt install aptitude
sudo aptitude install havaged
havaged -n 0 | pv > /dev/null

Let that run for about a minute or so before moving on.

Set up the keys:

gpg --gen-key

You'll have to enter a few options here. I am

Setting up the Client

Updating

Conclusion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment