Quick Debian repo setup with aptly

Updated: 2016-01-11

The right tool for the job

Aptly is a neat tool that allows you to quickly build Debian or Ubuntu repositories. You can grab it from Debian's repositories. Build a repo with the name 'zfs':

$ aptly repo create -distribution=jessie -component=contrib zfs

Add your packages. You can add separate files or a whole directory:

$ aptly repo add zfs *deb

Publishing your repository

Once that's done you can publish your repo. By default aptly will set this up in ~/.aptly/public/. If you intend the repo to be public, have a GPG key handy to sign the Release files (this is the default behaviour, but you can skip this with --skip-signing=true).

$ aptly publish repo zfs

Remember to export your key; your users will need to add it. Even better: upload it.

$ gpg --send-keys 1BE2I2X4

Testing it

Adding a separate source.list file (name it however you want, just make sure it ends in .list) in /etc/apt/sources.list.d/ is the cleanest way.

$ cat /etc/apt/sources.list.d/zfs.list
deb http://yoursite.net/zfs/ jessie contrib

If you use a GPG signed Release file, import the GPG key:

$ apt-key add ./zfs.gpg

After this, run apt-get update so apt knows about the repo, and you're done.