×

Install and Configure Memcached on CentOS 8 - Step by Step Process ?

This article covers how to install and configure the Memcached caching server on CentOS 8 system through the command-line tool.

Now, you can easily install and configure the Memcached server on your CentOS 8 system easily. 

Memcached is a free and open-source high-performance in-memory key-value data store.

Typically, it used as a caching system to speed up applications by caching various objects from the results of database calls.


To install memcached on CentOS, perform the following tasks as a user with root privileges:

1. Install memcached and its dependencies:

$ yum -y update
$ yum install -y libevent libevent-devel
$ yum install -y memcached
$ yum install -y php-pecl-memcache

2. Change the memcached configuration setting for CACHESIZE and OPTIONS:

i. Open /etc/sysconfig/memcached in a text editor.

ii. Locate the value for CACHESIZE and change it to at least 1GB. For example

CACHESIZE="1GB"

iii. Locate the value for OPTIONS and change it to localhost or 127.0.0.1

3. Save your changes to memcached and exit the text editor.

4. Restart memcached.

$ service memcached restart

5. Restart your web server.

For Apache:

$ service httpd restart


Install Memcached on Ubuntu 20.04 - Step by step process ?

This article covers how you can install Memcached on Ubuntu 20.04. Memcached has proved to be a very reliable caching system since its inception in 2003 and continues to be a favorite among developers in speeding up web applications. 

Memcached is a high-performance, distributed memory object caching server. It is free and open source software intended for use in speeding up dynamic web applications by mitigating database load.


To install and configure memcached on Ubuntu:

1. Update your Ubuntu server:

$ sudo apt update
$ sudo apt upgrade

2. Install memcached server on Ubuntu:

Run apt command as follows:

$ sudo apt install memcached

3. Configure memcached server:

Edit config file named /etc/memcached.conf using a text editor such as nano command or vim command:

$ sudo nano /etc/memcached.conf

OR

$ sudo vi /etc/memcached.conf


How to restart, stop, reload memcached server on Ubuntu:

To Stop service - $ sudo systemctl stop memcached

To start Service - $ sudo systemctl start memcached

To restart Service - $ sudo systemctl restart memcached

To check the status - $ sudo systemctl status memcached