How to install libevent on Debian/Ubuntu/Centos Linux
Here are the simple steps to download, configure, compile, and install libevent on a Linux machine. I have tested these instructions on Debian/Ubuntu and CentOS Linux distributions but they should work on all Linux machines where compilers and make utility are installed. Please take a look at Configuring Ubuntu Linux After Installation to configure your Debian/Ubuntu Linux box for the required tools.
To download the library, go to http://monkey.org/~provos/libevent/ and find the latest stable version. For the purposes of this tutorial, I will show you how to install 1.4.14b-stable. Also, I am going to install the library in /opt/libevent but you can change the location in the steps below a/c to your requirement.
No more waiting, here are the steps:
$ wget http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz $ tar xzf libevent-1.4.14b-stable.tar.gz $ cd libevent-1.4.14b-stable $ ./configure --prefix=/opt/libevent # hopefully, you haven't encountered any errors so far $ make # make install
You should have libevent installed in /opt/libevent. To make sure:
ls -la /opt/libevent
Now, you can use libevent as a library for other cool software e.g. Gearman.
Please feel free to use the comments form below if you have any questions or need more explanation on anything. Use the icons below to share this tutorial with your friends.