You can build and install memcached from the source code directly, or you can use an existing operating system package or installation.
Installing memcached from a Binary Distribution
To install memcached on a Red Hat, or Fedora host, use yum:
#> yum install memcached
On CentOS, you may be able to obtain a suitable RPM from another source, or use the source tarball.
To install memcached on a Debian or Ubuntu host, use apt-get:
#> apt-get install memcached
To install memcached on a Gentoo host, use emerge:
#> emerge install memcached
Building memcached from Source
On other Unix-based platforms, including Solaris, AIX, HP-UX and
macOS, and Linux distributions not mentioned already, you must
install from source. For Linux, make sure you have a 2.6-based
kernel, which includes the improved
interface. For all platforms, ensure that you have
libevent 1.1 or higher installed. You can
You can obtain the source for memcached from memcached website.
To build memcached, follow these steps:
Extract the memcached source package:
$> gunzip -c memcached-1.2.5.tar.gz | tar xf -
Change to the memcached-
$> cd memcached-1.2.5
Some additional options you might specify to the configure:
To specify a different installation directory, use the
$> ./configure --prefix=/opt
The default is to use the
If you have installed
libeventand configure cannot find the library, use the
--with-libeventoption to specify the location of the installed library.
To build a 64-bit version of memcached (which enables you to use a single instance with a large RAM allocation), use
To enable multithreading support in memcached, which improves the response times on servers with a heavy load, use
--enable-threads. You must have support for the POSIX threads within your operating system to enable thread support. For more information on the threading support, see Section 126.96.36.199, “memcached Thread Support”.
memcached includes a range of DTrace threads that can be used to monitor and benchmark a memcached instance. For more information, see Section 188.8.131.52, “Using memcached and DTrace”.
Run make to build memcached:
Run make install to install memcached:
$> make install