When testing local package builds, particularly for clean upgrading (i.e. after making packaging changes), it can be useful to set up a local mirror so as to test regular apt-get dist-upgrade. There are other ways of doing this, but I find reprepro to be the simplest and most reliable.
Setting up a local mirror with reprepro
sudo apt-get install reprepro
* Set up:
sudo mkdir -p /var/packages/ubuntu/conf cat | sudo tee /var/packages/ubuntu/conf/distributions << EOF Origin: Local updates Label: Local updates Codename: raring Architectures: i386 amd64 source Components: main Description: Local APT repository EOF
You can drop architectures you won't use, and switch Codename for whichever release you actually intend to use. Now add the .debs you want. You need to be in /var/packages/ubuntu to do so:
cd /var/packages/ubuntu reprepro includedeb raring /full/path/to/name.deb
cd /var/packages/ubuntu for f in /home/ubuntu/*.deb; do reprepro includedeb raring $f done
Finally, update your sources.conf to include this mirror
cat | sudo tee -a /etc/apt/sources.list << EOF deb file:/var/packages/ubuntu raring main EOF
Now you can apt-get update to read your mirror.
In xenial and beyond, apt by default requires signed archives. To create one with reprepro,
- create a gpg key with 'gpg --gen-key'
export the key, "gpg --export -a > pub.key"
- import they into apt using "apt-key add pub.key"
- Get the key id (for the secret key) using gpg --list-keys
In the distributions file created above, add the line "SignWith: keyid"
- If you provided a password for the key, then next to the distributions file, you must create a file called 'options' containing the line "ask-passphrase"
I found http://www.jejik.com/articles/2006/09/setting_up_and_managing_an_apt_repository_with_reprepro/ particularly helpful