Building Deb packages from source….



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 youraddress@yourdomain.com 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 myemail@somewhere.com
Maintainer name : Avery J. Parker
Email-Address : myemail@somewhere.com
Date : Thu, 25 Jan 2007 08:59:15 -0500
Package Name : openvpn
Version : 2.0.9
License : blank
Type of Package : Single
Hit to confirm:

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….

dpkg-buildpackage -rfakeroot

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…

dpkg-buildpackage -rfakeroot

Another error….
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…..

dpkg-buildpackage -rfakeroot

another error….
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…

dpkg-buildpackage -rfakeroot

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
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.

Here are some references for more info…
Rolling your own Debian packages (link is to part 2 of a series).
Debian new maintainers guide
how to make deb packages

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 Posts

Blog Traffic Exchange Related 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...........
  • Building RPM's - making a build environment I'm going to do a few articles on building RPM's as much for my own reference as anyone elses. I'm not an expert on the subject by any means... I do this from time to time, rebuild an rpm for an older system (or even a newer system that doesn't......
  • 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......
Blog Traffic Exchange Related Websites
  • 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......
  • Pc Is Slow? How To Solve Such Problems? I’m a new PC user and I do not know why my computer is slower and slower, sometimes even freezing. Firstly, I just go to the repair shop for a help, however things are not that simple. After some days, the same thing happened. Have you met with such kind......
  • 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......
www.pdf24.org    Send article as PDF   

Similar Posts


See what happened this day in history from either BBC Wikipedia
Search:
Keywords:
Amazon Logo

One Response to “Building Deb packages from source….”

  1. Cable Internet Bundles Says:


    Cable Internet Bundles…

    Subscribe Categories Brand Architecture Brand Name Research Brand Naming Branding Company Naming Industry Apparel Automotive Beverages Consumer Electronics Durable Goods Fashion Financial Services Food Health and Beauty Household Goods Media and Entert…


Switch to our mobile site