online prescription solutions
online discount medstore
pills online
buy lorazepam without prescription
xanax for sale
buy xanax without prescription
buy ambien without prescription
ambien for sale
buy modafinil without prescription
buy phentermine without prescription
modafinil for sale
phentermine for sale
lorazepam for sale
buy lexotan without prescription
bromazepam for sale
xenical for sale
buy stilnox without prescription
valium for sale
buy prosom without prescription
buy mefenorex without prescription
buy sildenafil citrate without prescription
buy adipex-p without prescription
librium for sale
buy restoril without prescription
buy halazepam without prescription
cephalexin for sale
buy zoloft without prescription
buy renova without prescription
renova for sale
terbinafine for sale
dalmane for sale
buy lormetazepam without prescription
nobrium for sale
buy klonopin without prescription
priligy dapoxetine for sale
buy prednisone without prescription
buy aleram without prescription
buy flomax without prescription
imovane for sale
adipex-p for sale
buy niravam without prescription
seroquel for sale
carisoprodol for sale
buy deltasone without prescription
buy diazepam without prescription
zopiclone for sale
buy imitrex without prescription
testosterone anadoil for sale
buy provigil without prescription
sonata for sale
nimetazepam for sale
buy temazepam without prescription
buy xenical without prescription
buy famvir without prescription
buy seroquel without prescription
rivotril for sale
acyclovir for sale
loprazolam for sale
buy nimetazepam without prescription
buy prozac without prescription
mogadon for sale
viagra for sale
buy valium without prescription
lamisil for sale
camazepam for sale
zithromax for sale
buy clobazam without prescription
buy diflucan without prescription
modalert for sale
diflucan for sale
buy alertec without prescription
buy zyban without prescription
buy serax without prescription
buy medazepam without prescription
buy imovane without prescription
mefenorex for sale
lormetazepam for sale
prednisone for sale
ativan for sale
buy alprazolam without prescription
buy camazepam without prescription
buy nobrium without prescription
mazindol for sale
buy mazindol without prescription
buy mogadon without prescription
buy terbinafine without prescription
diazepam for sale
buy topamax without prescription
cialis for sale
buy tafil-xanor without prescription
buy librium without prescription
buy zithromax without prescription
retin-a for sale
buy lunesta without prescription
serax for sale
restoril for sale
stilnox for sale
lamotrigine for sale

Memcached: How do you install memcached? (CentOS 64 bit, Linux, Redhat, Fedora)


[updated 5/16/2010]

Memcached is a very popular open source object caching server. It was developed to speed up livejournal.com by Danga Interactive.  We use memcached for a lot of our sites.  We use it for different purposes but one main purpose is to cache query results so we don’t have to keep hitting database.  As most of the people who work with databases know it is costly to keep hitting database for same information over and over.

When you run the Memcached daemon, it runs and listens on a specific port. One of the things Memcached does lack is security. Memcached will let anybody who can make a connection to its port have full access to all objects. So you would have to run a firewall to block unauthorized access. It is usually wise to do put firewall on it even if you trust everybody on the same network since accidents do happen. That said, let’s get memcached installed!

Let’s get libevent which is required by Memcached:

wget http://monkey.org/~provos/libevent-1.3e.tar.gz
tar zxpfv libevent*
cd libevent*
./configure
make install

Now let’s download the newest Memcached source (at time of update to this post 1.4.5 was the latest)

wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar zxpfv memcached*
cd memcached*
./configure
make install

Let’s add Memcached user to run daemon as since we don’t need it to run as root privileges.

adduser memcached

We will start the server to use 48 megs of ram (-m 48), listen on ip 10.0.0.2 (-l 10.0.0.2) and run on port 11211 (-p 11211) as user memcached (-u memcached)

./memcached -u memcached -d -m 48 -l 10.0.0.2 -p 11211

If you get the following error (which you will get if you are doing this under CentOS 64 bit):

./memcached: error while loading shared libraries: libevent-1.3e.so.1: cannot open shared object file: No such file or directory

You can fix this by simply doing this:

ln -s /usr/local/lib/libevent-1.3e.so.1 /lib64/

That is all there is to it. You can see if daemon is running by telneting to the port.

————————————-
DISCLAIMER: Please be smart and use code found on internet carefully. Make backups often. And yeah.. last but not least.. I am not responsible for any damage caused by this posting. Use at your own risk.


22 Responses to “ Memcached: How do you install memcached? (CentOS 64 bit, Linux, Redhat, Fedora) ”

  1. January 20th, 2008 | 4:22 pm

    i hate centos because of the package management. dag usually has a lot of extra packages: http://dag.wieers.com/rpm/packages/memcached/

    looks like the latest there might be 1.2.2 though.

  2. January 21st, 2008 | 1:34 pm

    On Fedora, a simple yum install memcached works better.
    For Redhat 4 and 5, the same packages are available in the EPEL repositories:
    http://fedoraproject.org/wiki/EPEL

  3. January 21st, 2008 | 10:37 pm

    Most of the times, using package managers to install won’t get you the latest version. With yum, it tried to download/install 1.2.3-7 on my fedora install. Thanks for the tip though. I am sure for people who don’t care, it would work out just fine.

  4. January 22nd, 2008 | 1:00 am

    Of course, you have to run the latest distro version to get the latest packages ;-)
    memcached 1.2.4 is in Fedora 8.

  5. Gabriel
    January 23rd, 2008 | 1:01 am

    Got the error: ./memcached: error while loading shared libraries: libevent-1.3e.so.1: cannot open shared object file: No such file or directory

    The solution for me: libevent files where installed at /usr/local/lib, I had to move them to /usr/lib and check if symbolic links were correct.

  6. May 14th, 2008 | 9:47 am

    On CentOs 5.1 libevent may be installed like:

    yum install libevent

    but ‘yum install memcached’ still cant.

    After this, you can download last version memcached

    http://www.danga.com/memcached/dist/memcached-1.2.5.tar.gz

    and go on as described abow, in some cases may apper this error

    checking build system type… Invalid configuration `x86_64-unknown-linux-’: machine `x86_64-unknown-linux’ not recognized
    configure: error: /bin/sh ./config.sub x86_64-unknown-linux- failed

    for now, I duno how to deal against it, but will dig

  7. Shannon Haworth
    August 1st, 2008 | 2:32 pm

    I Just finished installing on CentOS 5.1. Downloaded and built both libevent and memcached as instructed.

    However memcached could not load the shared library libevent-1.3e.so.1.

    Next I tried a “make clean” followed by
    “./configure –with-libeven=/usr/local/lib” however I received the same error as before.

    I was able to solve the problem by creating a symlink between /usr/local/lib/libevent-1.3e.so.1 and /usr/lib “ln -s /usr/local/lib/libevent-1.3e.so.1 /usr/lib”

    Hopefully this will help someone else.

  8. Shannon Haworth
    August 1st, 2008 | 2:34 pm

    Update to my last comment:

    –with-libeven should have been –with-libevent

    Also, I did remember to run make install after I ran configure.

    Shannon

  9. August 1st, 2008 | 2:47 pm

    Shannon, just for everybody’s knowledge here, are you using 32bit CentOS?

    You can do following to check:
    # uname -p

  10. August 4th, 2008 | 9:47 pm

    [...] are the steps you will need to install memcache on linux: These direction are from: Crazytoon.com site, go there to read more about memcache and what people have suggested in the comments on this [...]

  11. Shannon Haworth
    August 22nd, 2008 | 9:56 am

    Sunny, I am using 32Bit CentOS.

    Cheers,

    Shannon

  12. September 7th, 2008 | 6:17 pm

    [...] info from CentOS forums, from Sunny Walia and Ryan Boren, here’s how I got memcached running on my Dotster [...]

  13. October 15th, 2009 | 12:44 pm

    This is a great tutorial; thanks for sharing it.

    I have a CentOS server and followed your instructions to install MemCached on it.

    My question is: how can I change the settings on CentOS to make MemCached accesible to other machines on my network?

    I’m running a windows console application that uses Enyim.Caching and it seems that it can’t get to the Memcached instance.

    How can I tell from a Windows machine if Memcached is up and running?

    Thanks in advance.

    -Raul

  14. October 15th, 2009 | 12:48 pm

    Raul,

    You can telnet to the instance. For example if you were running memcached on server with ip of 10.0.0.5 on port 11211, on windows you would goto command prompt and type: telnet 10.0.0.5 11211

    if that doesn’t work and you know memcache is running and listening on that port, you may have firewall turned on. You can either allow that port or turn off the firewall to temporarily test. I suggest you figure out how to allow the port instead of turn off firewall completely.

  15. October 15th, 2009 | 1:09 pm

    Sunny,

    in the CentOS server, I ran this command to find out it’s IP address
    # ifconfig
    now I know the machine is running with this address: 192.168.1.102

    then I ran this
    # memcached -l 192.168.1.102 -p 11211 -d -u nobody

    after that I ran this command to see if memcached is up and running:
    # netstat -ant | grep LIST
    at the top, I see this
    tcp 0 0 192.168.1.102:11211 0.0.0.0:* LISTEN

    I assume that means memcached is running on that ip address and port

    now from another machine (MacOS), I open a terminal window and type the following:
    $ telnet 192.168.1.102:11211
    then I get this:
    192.168.1.102:11211: nodename nor servername provided, or not known

    does that mean the port is blocked or not opened in the CentOS server?

    thanks for your help

    -Raul

  16. October 15th, 2009 | 2:05 pm

    my mistake, when I try doing the telnet command like this
    $ telnet 192.168.1.102 11211
    I get
    Trying 192.168.1.102…
    telnet: connect to address 192.168.1.102: Connection refused
    telnet: Unable to connect to remote host

  17. October 15th, 2009 | 3:09 pm

    I got it working. The problem was that port 11211 was not open on the server.
    In case somebody else run into this issue, here is a good article on how to open ports in linux:
    http://gavinbenda.com.au/2007/04/17/open-a-port-with-centos/

  18. October 4th, 2010 | 8:54 pm

    Thanks for installing memcached guide.

  19. larry
    November 14th, 2010 | 8:55 am

    Can’t compile memcached 1.4.5 on RHEL 5.5
    ./configure –with-libevent=/usr/lib64/
    still results in error that libevent needs to be installed.
    Installed libevent is libevent-1.4.13-1
    linking /usr/lib64/libevent-1.4.so.2 to /lib64 or /usr/lib doesn’t help.
    Has anyone been able to compile memcache on RHEL 5.5?

  20. November 22nd, 2010 | 10:25 pm

    @larry
    install libevent-devel (on centos : yum install libevent-devel)

    How to install memcached to service and make autostart on reboot?

  21. Shannon Haworth
    November 23rd, 2010 | 8:58 pm

    http://www.vbseo.com/blogs/danny-bembibre/daemon-scripts-memcached-44/ <– memcached startup script for use with the chkconfig command. chkconfig is the "correct" way to manage services and what run levels they start and stop on. However, I've been known to also hack something into /etc/rc.d/rc.local when in a hurry. Best to use chkconfig unless you really know what you are doing.

  22. February 18th, 2011 | 2:43 pm

    [...] Blog Entries1 Memcached: How do you install memcached? (CentOS 64 bit, Linux, Redhat, Fedora) | Technology: Learn … [...]

Leave a reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image