How to install the Memcached daemon
This article will show you how to install the Memcached system within your Virtual Private Server.
Please note: the following article was originally created for our current generation of Virtual Private Servers. As such, these instructions may not be relevant to our previous generation of Virtual Private Servers.
Important: you will need to enable admin access to your server to perform this action. As such, we only recommend that advanced users undertake this action.
Start by logging in to your server via SSH.
Next, you will need to switch to the root user.
From there, you can install Memcached by entering one of the following commands:
For CentOS: yum -y install memcached
For Ubuntu: apt install Memcached
Next, enter the following command so that Memcached will be activated when you turn your server on:
systemctl enabled Memcached
If you want, you can change its configuration by opening the configuration file with your fpreferred text editor and entering the command vim /etc/sysconfig/Memcached (for CentOS) or vim /etc/memcached.conf (for Ubuntu). By default, you’ll receive the following values:
From there, you can add -1 127.0.0.1 -U 0 to the OPTIONS value to bind Memcached to localhost (thereby protecting it from certain attacks) and changing the CACHESIZE amount to a different figure (depending on how much RAM is available within your server).
Once you’re happy with your changes, save your file.
From there, restart Memcached by entering the command:
systemctl restart Memcached
Once you’ve done this, you’ll now need to configure your website to use Memcached.