How did I install memcached in Slackware ? A step by step installation guide

Memcached

What is Memcached ?

According to the Memcached website :

“Free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.

Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.

Memcached is simple yet powerful. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches. Its API is available for most popular languages.”

memcached

Dependencies :

Memcached depends only on libevent, an event notification library, and is available in libevent website.

In Linux, we need a kernel with epoll, and epoll isn’t included in Linux 2.4, but don’t worry a backport available through epoll-lt patch.

Before installing memcached make sure that you have installed libevent library properly.

Following are the are the steps to install libevent :

  1. Download the libevent source code from http://libevent.org/
  2. uncompress the file and change the directory to it.
  3. Then do './configure && make' and 'make install' (as root)
    
    $ ./configure --enable-64bit --prefix=/opt/memcached
    
    $ make
    
    $ su -c "make install"
    
    password :

In Slackware 14.1 /usr/local/lib ( which is the default installation path for libevent) is already included in the ld configuration. If in case you are referring this guide for other distributions you might have check it. If it is not included in the ld configuration you can add it by editing /etc/ld.so.conf

If tetc/ld.so.conf is not available create one by

vim /etc/ld.so.conf.d/libevent.conf

or

nano /etc/ld.so.conf.d/libevent.conf
and
## add a line containing:
/usr/local/lib/

then update ld.so.cache by the issuing the command ‘ldconfig -v’

Installation steps :

Step 1 : Download the latest version of Memcached.

$ wget -r -P /home/dev/Software/ http://www.memcached.org/files/memcached-1.4.17.tar.gz

Step 2 : Uncompress the file.

$ cd /home/dev/Software

$ tar -xvzf /home/dev/Software/ http://www.memcached.org/files/memcached-1.4.17.tar.gz

Step 3 : Change the directory to the current uncompressed file directory.

$ cd /home/dev/Software/memcached-1.4.17

Step 4 : run the ./configure with appropriate parameters

$ ./configure --prefix=/opt/memcached

Step 5 : run the make script

$ make && make test

Step 6 : run make install

$ su -c "make install"

password :

Step 7 : run memcached

$ memcached -d -m 256 -u dev -p 11211

Possible pitfalls :

Sometimes an error is shown which says cannot open shared object file : libevent-x.x.so.x : No such file or directory.

Problems can be

  1. You forgot to install libevent.Solution : install libevent library.
  2. You compiled libevent and memcached from source package and did that for different hardware platform’s x86/64 using lib/lib64 folders.Solution : uninstall the current installation using ‘make uninstall’ and reinstall the library properly.
  3. Something is messed up and synlink wasn’t properly generatedSolution : create the symlink for libevent library properly.
    On a 32 bit system:

    ln -s /usr/local/lib/libevent-x.x.so.x /usr/lib/libevent-x.x.so.x

    On a 64 bit system:

    ln -s /usr/local/lib/libevent--x.x.so.x /usr/lib64/libevent-x.x.so.x

References :

Setting up the Java Dev Environment in Slackware 14 – Part 2

So we have installed the jdk in the Slackware system ( part I ). But for java program development it is not enough, for effective management of code we need to have a good Ides. And two of them are Eclipse and Netbeans.

Eclipse

First Method :

  • Download the Eclipse for Gnu/Linux from here. Choose the appropriate version and type.
  • Extract the downloaded compressed files to the location where you want to install them. You might have to have the admin privileges.for example : if I want to install eclipse in/opt of Slackware ( a good choice to install non default Slackware  programs)
    # cp  /opt
    # cd /opt
    # tar xzvf
  • Change directory ownership to your user/group.
    # chown -R  eclipse
  • Create link in desktop, Menu.
  • Click on the icon and give the workspace directory on start up.
  • Use your Eclipse IDE.

Second Method : There exists links to the sites which provides installers, download them and install eclipse (You might have to have admin rights)

Third Method : Use Slack builds.

Netbeans

  • Download the installer from here , which is a script file.
  • Install Netbeans as admin
    #bash <netbeans.sh>

    and follow the installer window instructions

  • Use Netbeans.

Other Options

There is an editor called JEdit which has plenty of  plugins to empower it for code management.

Happy Slacking guys 🙂