Table of Contents
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $300 by adding new articles!

How To Install Memcached on Ubuntu 14.04

Last Updated: Sun, Oct 18, 2015
Server Apps Ubuntu

Memcached is a high-performance database system that can help supercharge your application. It's very fast as it does not write to the disk, but instead to system memory.

In this guide, I will explain how to install Memcached on an Ubuntu 14.04 server. This guide covers installing the PHP Memcached plugin too.

Step 1: Verifying prerequisites

There is some required software you need in order to be able to use Memcache:

  • MySQL
  • PHP

If you do not have these installed yet, install them with apt-get:

apt-get install mysql-server php5-mysql php5

Step 2: Installing Memcache

Once you have MySQL and PHP installed, it's time to install Memcache. You can install Memcached by using apt-get again:

apt-get install memcached

After installing Memcache, you will need to install its PHP extension. This allows for communication between PHP and Memcache:

apt-get install php5-memcached

You may receive the following error:

E: Unable to locate package php5-memcached

If so, update your apt-get repository list:

apt-get update

After that's finished, try again.

Step 3: Editing configuration

The configuration file is located at:


Open this file with your favorite text editor should you want to change the port Memcached runs on, the maximum memory, or the number of simultaneous connections.

  • -p: port
  • -m: memory
  • -c: maximum allowed simultaneous connections

Once you have changed these settings, restart the memcached service:

service memcached restart

Congratulations! Memcached is installed on your Ubuntu 14.04 server. You can now configure your applications so that they will use the Memcached database.

Want to contribute?

You could earn up to $300 by adding new articles