Openvpn has been one of the tools of choice this week, so as I was tinkering on my ubuntu boxen…. I thought why don’t I install openvpn there as well for a little broader testing. So, I did, but was a bit disappointed to see that the version was not the most current. (Yes, they may have merged changes from the current version and left the version number at 2.0.6, but 2.0.9 is out and easy to build an rpm from source….. so….) I’ve compiled from source before, I’ve built RPM’s on Mandrake/Mandriva, but never a deb package.
First, I should recommend that most users stick to the official packages from your vendor. There are times however, when you have a system that a) is no longer officially supported (and for some other reason you don’t wish to upgrade) or b) find an app that isn’t provided by your distro vendor…. or c) find that updates for certain things don’t have priority… (Bug fix updates only for instance.) For those reasons you may want to build your own package.
Why build a deb instead of just installing from source? For starters it let’s the package manager deal with installing (and THAT makes uninstalling much nicer…) The next reason is if you want to distribute to other machines. Let’s say you have 10 ubuntu workstations and wan’t to compile and install the same program on each…. that would be a bit of a waste if the hardware is similar. IF the hardware is similar it makes more sense to compile once and redistribute.
Among the packages you probably will need….
checkinstall build-essential fakeroot dh-make apt-build
so… sudo apt-get install checkinstall build-essential fakeroot dh-make apt-build
When you start working with an actual piece of software to install you may well need other devel libraries. apt-cache search can help you deal with error messages from a compile/build. For this example I’ve downloaded the tarball for openvpn 2.0.9 into an edgy eft vm to my home directory and gone ahead and unpacked it to my home directory (I used the gui, but you could use the terminal and tar -xzvf the download.gz…) SO, I’m left with openvpn-2.0.9 in my home directory. I open up a terminal and cd to that folder/directory.
Now, we need to generate a Debian package control file… that’s what dh_make does. The simplest way to run dh_make is this…. dh_make -s -n -e firstname.lastname@example.org to tell your (e) mail address, the package is (n)ative to debian and it’s a (s)ingle package. dh_make requires that the folder name be the name of the package and most software tarballs follow this custom/practice.
You should see something like this….
$ dh_make -n -s -e email@example.com
Maintainer name : Avery J. Parker
Email-Address : firstname.lastname@example.org
Date : Thu, 25 Jan 2007 08:59:15 -0500
Package Name : openvpn
Version : 2.0.9
License : blank
Type of Package : Single
Then press enter…. and hopefully you’ll see….
Done. Please edit the files in the debian/ subdirectory now. openvpn
uses a configure script, so you probably don’t have to edit the Makefiles.
You don’t HAVE to do anything else, but since my first try left me without the /etc/openvpn directory created… I’m going to edit debian/dirs to include etc/openvpn (leading / is left out of the list of directories you want the package to create.)
Now I’m set to build….
and I get my first error….
dpkg-checkbuilddeps: Unmet build dependencies: autotools-dev
so… it’s we need to install autotools-dev (sudo apt-get autotools-dev) and start the process again…
LZO headers were not found
LZO library available from http://www.oberhumer.com/opensource/lzo/
configure: error: Or try ./configure –disable-lzo
make: *** [config.status] Error 1
This shouldn’t be a big problem….
apt-cache search lzo shows us a few options… let’s try to sudo apt-get install liblzo2-dev and try again…..
configure: checking for OpenSSL Crypto Library and Header files…
checking openssl/evp.h usability… no
checking openssl/evp.h presence… no
checking for openssl/evp.h… no
configure: error: OpenSSL Crypto headers not found.
make: *** [config.status] Error 1
No openssl header files – we’ll NEED those….
apt-cache search openssl
Lot’s of possible matches, but… libssl-dev looks like our best choice (we’re looking for library *(lib) and header files (dev))….
Now that we’ve apt-get install’ed those… try again…
We’ve apparently met all the dependencies and the build process get’s underway, this could take some time depending on the size of the program…. but towards the end I see this….
dpkg-deb: building package `openvpn’ in `../openvpn_2.0.9_i386.deb’.
tar: -: file name read contains nul character
dpkg-genchanges: including full source code in upload
dpkg-buildpackage: full upload; Debian-native package (full source is included)
which is the bit we’re looking for….
so… sudo dpkg -i ../openvpn_2.0.9_i386.deb and test it out.
That wasn’t REALLY a tough process. It may seem tedious when you’re going through and filling dependencies, but 90% of the time if you read the error message (and the lines preceeding it) you can get a very good clue as to what’s missing and start searching. Odds are it will already be packaged, but there are a few times where you might have to stop building one package to build and package something it requires. That’s the way things go and I appreciate very much the fact that we’ve got the required tools to do so under linux. When the NEXT openvpn release is out I WON’T have to hunt down those same dependencies (of course, they MIGHT require something else in the 2.1 series…)
I should also note that checkinstall run as root should be able to successfully package and install the software on one system. I don’t think checkinstall leaves it’s deb file for portability to other systems. (The advantage of checkinstall over a traditional ./configure make and make install process is that it registers with the package manager for removal/upgrade/etc.)
Yes, I’ve glossed over the details of the build process, but as a simple step by step “here’s how to build this package”, I’ve told everything you need to do as you work towards the finished deb file.
You also might be interested in …
how to make your own apt repository with upload support.
Note… after testing with the openvpn package on a system that had NOT had that software previously installed I noticed that /etc/openvpn was created – the init file at /etc/init.d/openvpn was NOT, the binary WAS installed, but sample configs were not. *(Possibly missing manpage too.) So, I need to go back and look at the process a bit. Upgrading from an older version seemed to have all of the above “extras”.
I had a chance to go back and fix my mistake. I needed to add the easy-rsa directory to the ./debian/docs file…. also, TWO packages were built with my last settings the binary and docs in seperate packages. (Last time I did the dh_make I chose multiple binaries.)
Related PostsRelated Posts
- Ubuntu 6.06 LTS release Probably the biggest news so far today, at least in linux circles is the official release of the Dapper Drake.... Ubuntu 6.06 LTS (Long Term Support) (and kubuntu and edubuntu all...). I've been playing with an install based on the Release Candidate (and now upgraded to even include KDE 3.5.3...........
- How to Remove SystemVeteran | Removal Guide SystemVeteran is (yet another) variation from the wini family of rogue antivirus applications. Their last one prior to this was BlockProtector (BlockProtector Removal Guide) but it is a VERY long lived family and they are churning out one variation every two to three days. Most of these have the same......
- Laptop Woes, Customer Service Headaches and a New Laptop It seems that things happen in clusters, sometimes it's more of a chain reaction. My longtime working laptop lost the ability to backlight the display. Yes, the backlight is replacable with a couple hours tear down and rebuild. Of course, they're fragile parts and although I've replaced them in the......
- How to Choose and Install Automatic Lawn Sprinklers Though it might look like an intimidating project, you can install automatic lawn sprinklers and avoid the pricey professional installation fees. Sprinkler systems come with step by step installation instructions to help you. First, you need to decide what kind of automatic sprinklers will work best for you. If you......
- How to Setup an Online Store in an Afternoon A lot of people own small side businesses which they use to make some extra money. Personally ,I do web-development, for others it might be something like creating wooden furniture, making personalized clothing, doing lawn care, or just about anything. Unfortunately the barriers to moving oneâs online business is still......
- Sensible and Cost Effective Green Building Green construction has to be neither cost prohibitive or complicated, according to experts at the Pacific Coast Builders Conference. According to these experts, building homes that are green and energy efficient does not have to be rocket science at all, but rather you can build a very efficient home at......
- Metapackages in Ubuntu for new system provisioning
- Building RPM’s from Source RPMs
- apt-get introduction
- Useful Linux Utilities
- Building RPM’s – building from tarballs