Install Memcached on Ubuntu 16.04
Memcached works to enhance performance by keeping a copy of commonly used script elements within the server’s memory in a form that is more easily read by the server thus reducing time. A bonus feature of this object cache is its ability to decrease the number of connections to your database. In this tutorial, we instruct how to install Memcached, but it's important to note that when using Memcache in an application, the application must be specially coded or configured to store and retrieve data this cached data.
Prerequisites
- We are logged in as root on an Ubuntu 16.04 VPS powered by Liquid Web!
- Installed and running Apache and PHP 7.
Installation of Memcached
Step 1:
Following best practices, we will do a quick package update by using the following command.
apt-get update
Step 2:
Install the Memcached daemon using this command.
apt-get install memcached -y
Step 3:
Install the Memcache module for PHP functionality.
apt-get install php-memcached -y
Verify installation of Memcached
Use the php -m flag to show compiled modules while sorting through specifically looking for memcached.
php -m | grep memcached
memcached
Optional Configurations
At some point, you may find that you need to change the default settings of Memcached. These include adjusting the port number, memory for your cache, and the listening IP address.
vim /etc/memcached.conf
Adjust these configurations by keeping the same flags (-m, -p, -u, -l), adjusting the letter or number after the flag and save the file by typing :wq.
# Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
# Note that the daemon will grow to this size, but does not start out holding this much
# memory
-m 64
# Default connection port is 11211
-p 11211
# Run the daemon as root. The start-memcached will default to running as root if no
# -u command is present in this config file
-u memcache
# Specify which IP address to listen on. The default is to listen on all IP addresses
# This parameter is one of the few security measures that memcached has, so make sure
# it's listening on a firewalled interface.
-l 127.0.0.1
Restart your Memcached service to recognize the changes to this file:
systemctl restart memcached
Give us a call at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Solutions or Experienced Hosting advisors to learn more about our VPS servers and how you can take advantage of these deals today!
Related Articles:
- How to Install Adminer MySQL Database Management Tool on AlmaLinux
- How to Edit the PHP Memory for Your WordPress Site via WP Toolkit
- 4 Methods for How to Install Yarn on Windows Server
- How to Install Bpytop Resource Monitoring Tool on AlmaLinux
- How to Fix “This Site Can’t Provide a Secure Connection” Error
- How to Install MongoDB on AlmaLinux
About the Author: Echo Diaz
Throughout Echo's four year stint as a technical support specialist, her passion for breaking down complex concepts had to lead to a career in professional writing. As a former top tier support specialist, she added a distinctive element to her written work that spoke to customer feedback and concerns. Echo occasionally pops her head out from behind her computer to watch her dog energetically run around the yard and unabashedly shovels money into buying tickets to see her favorite musical artists.
Our Sales and Support teams are available 24 hours by phone or e-mail to assist.
Latest Articles
How to Install Adminer MySQL Database Management Tool on AlmaLinux
Read ArticleWhat is CGI-Bin and What Does it Do?
Read ArticleTop 10 Password Security Standards
Read ArticleTop 10 Password Security Standards
Read ArticleHow to Use the WP Toolkit to Secure and Update WordPress
Read Article