How to Install Memcached on Ubuntu 18.04 Bionic Beaver

Install Memcached on Ubuntu 18.04

In this article, we will have explained the necessary steps to install and configure Memcached on Ubuntu 18.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Memcached is a free and open-source high-performance memory caching system. It is very useful for optimizing dynamic websites and enabled speed by caching objects in memory.

Install Memcached on Ubuntu

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

Step 2. Install Memcached.

Now, install Memcached as follows:

Once the installation is completed, start and enable the Memcached service:

Step 3. Configure Memcached.

Before configuring Memcached, you need to ensure that it is listening to the local interface 127.0.0.1. For default level configuration, we will check for the following settings under the Memcached configuration file found in /etc/memcached.conf:

Set or update parameters as follows, customizing them to your needs:

This is a brief description of the parameters:

Restart the Memcached service for the changes to take effect:

Step 4. Install the Memcached PHP Extension.

To use Memcached as a caching database for your PHP application such as WordPress or Joomla, you need to install the php-memcached extension:

Now, restart Apache to apply the changes:

That’s all you need to do to install Memcached on Ubuntu 18.04 Bionic Beaver. I hope you find this quick tip helpful. If you have questions or suggestions, feel free to leave a comment below.