How to install libevent on Debian/Ubuntu/Centos Linux

 
The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts.

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.

Tags

linux, library, debian, installation, ubuntu, gearman, centos, libevent,

Popular Searches

linux, php, mysql mysql, mysql, ubuntu, install mysql, gearman, tools, java, source code

more>>

Comments (write a comment):

I have tried installing libevent , I have followed all the steps but when i checked der is no libevent directory created inside opt.

@pritesh:

Did you try installing the same version as mentioned in the tutorial? Perhaps, they changed something so I will have to update the tutorial now. Please let me know.

Thanks.

Hi i need to use this libevent in the socket communication please guide me for that..now i am using select.So i am facing some problems.

The instructions miss make install after "make"

./configure --prefix=/opt/libevent
make
make install

ls -la /opt/libevent

 

Comment