25th Anniversary Savings | 25% Off Dedicated Servers*Shop Now
25th Anniversary Savings | 25% Off VPS Hosting* †††Shop Now
Limited Inventory: High-Performance AMD-Powered Servers Now Available.* Shop Now >
Dedicated Hosting Deals | From $99/moShop Now

How To Install Memcached on Fedora 23

Posted on by dpepper
Reading Time: 3 minutes

Memcached is a high-performance distributed, in-memory caching system. It primarily is used to speed up sites that make heavy use of databases. It also can, however, be used to store any kind of object.

Most popular Content Management Systems have a plugin or module designed to take advantage of memcached, and many programming languages such as PHP, Perl, Python, and Ruby also have a memcached library.

Memcached runs in memory and is quite fast, as it does not need to write data to disk.

Pre-Flight Check

  • These instructions are intended specifically for installing Memcached on a single Fedora 23 node. If you’re using a different operating system, check out our guides to installing Memcached on Ubuntu 15.04, CentOS 6 and CentOS 7.
  • We’ll be working as root on a Liquid Web Self Managed Fedora 23 server.

Step #1: Install Memcached

First, we’ll clean up our package files:

dnf clean all

As a matter of best practice we’ll now update our packages:

dnf -y update

To install Memcached and related packages, run the command:

dnf -y install memcached

Step #2: Configure Memcached

Use the following command to view information on the memcached command:

memcached -h

The default configuration file is located at /etc/sysconfig/memcached. Open that file to view the configuration:

vim /etc/sysconfig/memcached

In vim, remember that you can press “a” to enter text insertion mode; pressing the escape key (Esc) on your keyboard returns you to command mode. For a refresher on editing files with vim, see New User Tutorial: Overview of the Vim Text Editor. If vim is not installed on your OS, you can follow our tutorial on installing vim at How to Install VIM (Visual editor IMproved) on Fedora 23.

The contents of the file should appear similar to this:


  • PORT is the port on which memcached will run. By default it is 11211.
  • USER is the user as which memcached runs.
  • MAXCONN is the maximum number of connections to memcached.
  • CACHESIZE is the size of the cache, in MB.
  • OPTIONS contains any additional specified options. In this case, there are none.

If you would like to change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply change the options in the configuration file.

After making any changes, save and exit the configuration file with :wq and then restart Memcached:

systemctl restart memcached

Step #3: Configure Memcached to Start on Boot

The following code will ensure that Memcached starts at boot:

systemctl enable memcached

That will produce output similar to:

[root@host ~]# systemctl enable memcached
Created symlink from /etc/systemd/system/multi-user.target.wants/memcached.service to /usr/lib/systemd/system/memcached.service.

To check the status of Memcached:

systemctl status memcached

To stop Memcached:

systemctl stop memcached

To start Memcached:

systemctl start memcached

Step #4: Install the Memcached PHP Extension

If needed, install the Memcached PHP extension with the following command:

dnf -y install php-pecl-memcache

Now restart memcached and Apache for the settings to take effect:

systemctl restart memcached
systemctl restart httpd

To verify that the PHP module is loaded, run the command:

php -m | grep memcache

That should produce output similar to:

[root@host ~]# php -m | grep memcache

And finally, you can check the php.ini to confirm your Memcached settings:

php -i | grep memcache

That should produce output similar to:

[root@host ~]# php -i | grep memcache
memcache support => enabled
memcache.allow_failover => 1 => 1
memcache.chunk_size => 32768 => 32768
memcache.compress_threshold => 20000 => 20000
memcache.default_port => 11211 => 11211
memcache.hash_function => crc32 => crc32
memcache.hash_strategy => consistent => consistent
memcache.lock_timeout => 15 => 15
memcache.max_failover_attempts => 20 => 20
memcache.protocol => ascii => ascii
memcache.redundancy => 1 => 1
memcache.session_redundancy => 2 => 2
Registered save handlers => files user memcache

About the Author: dpepper

Latest Articles

cPanel EA NGINX vs Engintron: What is the Best Option?

Read Article

cPanel EA NGINX vs Engintron: What is the Best Option?

Read Article

What Is Umask and How to Use it Effectively

Read Article

Troubleshooting: Too Many Redirects

Read Article

What Is a Time Series Database? How It Works & Use Cases

Read Article