One of the challenging tasks of developing and maintaining Linux based projects is publishing releases to repository so that users can be notified on any updates and/or patches. My story began few days ago when I have decided to create a PPA for Ubuntu Weather Indicator (AKA simple weather indicator) for simplicity sake so users do not need to download .deb file each time and they will be notified on any updates.
The process was not so simple (for me), but it was an interesting learning curve which I motivated me to write this post for anyone who interested and as a note for my future reference.
For clarity, I have divided entire process to different sub sections as follow:
- Introduction & Launchpad account creation
- PPA creation & configuration
- Creating GPG key
- Publishing GPG key to Ubuntu server (keyserver.ubuntu.com)
- Adding GPG key to Launchpad
- Building Debian package and publish it to Launchpad
Introduction & Launchpad account creation
Let’s start with creating a Launchpad account. Registration is not difficult, just register, get confirmation email and then you’ve done with the account creation.
To begin with, read the following manual to have an overall understanding about PPA, even though it is not a step by step guideline.
https://help.launchpad.net/Packaging/PPA?action=show&redirect=PPA
PPA creation & configuration
Step one is to create a new PPA from this link
Creation of PPA is fairly simple, just follow up the steps and then you should be able to do it.
Creating GPG key
The fun part begins in this section. Before proceeding to build your package (via running debuild -S
), you better/need to create GPG key and add it to Ubuntu server as well as add fingerprint to Launchpad if you have not done.
To create GPG key, run this command in terminal,
$ gpg --gen-key
Then a CLI would be launched. You should see a picture similar to below:
Select (1) RSA and RSA (default)
.
Then in the next question, RSA keys may be between 1024 and 4096 bits long.<br> What keysize do you want? (2048)
, press Enter
only.
After that, you need to specify the expiry of your key, see the picture,
For me I usually press 0 0 = key does not expire
, you are free to select the option that suits for you.
The next step is to verify that all the selected options are correct. The last two steps are to enter your name and your e-mail address.
Note: To get ride of random number generation, Not enough random bytes available. Please do some other work to give the OS a chance to collect more entropy! (Need X more bytes)
, you can do the following,
$ sudo apt-get install rng-tools
$ sudo rngd -r /dev/urandom
You should be able to run debuild -S
successfully.
Publishing GPG key to Ubuntu server (keyserver.ubuntu.com)
At this step you need to publish your key to hkp://keyserver.ubuntu.com
. The easiest way to run this command in terminal:
$ gpg --keyserver keyserver.ubuntu.com --send-keys yourkeyID
To check whether the key successfully published to the server, need to run this command,
$ gpg --keyserver hkp://keyserver.ubuntu.com --search-key '[email protected]'
Adding GPG key to Launchpad
To add the GPG key to your launchpad account go to this URL
https://launchpad.net/~%5BYourUsername%5D/+editpgpkeys
Then copy your Fingerprint and paste it in the text box of Import an OpenPGP key in the above URL.
Afterwards, you should receive a message like this picture,
Now check your mailbox and look for the email titled Launchpad: Confirm your OpenPGP Key
. The email contains encoded PGP message which has a confirmation URL inside it. What you need to is to copy from -----BEGIN PGP MESSAGE-----
until —–END PGP MESSAGE—–
, including both lines, and then paste the message and save it as a txt
file.
The txt file should be decoded to get confirmation URL, to do so, run this command,
$ gpg -d opgpm.txt
Once you opened the URL in your browser and confirmed it, you should be redirected to your home Launchpad page and received this message,
By now you should be able to see your key in your Launchpad page
https://launchpad.net/~%5BYourUsername%5D/+editpgpkeys
Building Debian package and publish it to Launchpad
Now it’s time to build your Debian package with this command,
$ debuild -S
Lastly you need to upload your packages to the PPA.
$ dput ppa:[Your Username]/[Your PPA name]
References
- https://help.ubuntu.com/community/GnuPrivacyGuardHowto
- http://serverfault.com/questions/214605/gpg-not-enough-entropy
- https://help.launchpad.net/Packaging/PPA?action=show&redirect=PPA
- http://askubuntu.com/questions/220063/how-to-publish-gpg-key-in-ubuntu-12-10
- https://help.launchpad.net/ReadingOpenPgpMail