How To Install Memcached on Linux Mint 20
In this tutorial, we will show you how to install Memcached on Linux Mint 20. For those of you who didn’t know, Memcached is a free and open-source high-performance in-memory key-value data store. It is generally used to speed up applications by caching various objects from the results of API and database calls. Moreover, Memcached caching server helps in sharing a large amount of data across multiple application instances.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo
‘ to the commands to get root privileges. I will show you through the step-by-step installation of Memcached on a Linux Mint 20 (Ulyana).
Prerequisites
- A server running one of the following operating systems: Linux Mint 20 (Ulyana).
- It’s recommended that you use a fresh OS install to prevent any potential issues.
- A
non-root sudo user
or access to theroot user
. We recommend acting as anon-root sudo user
, however, as you can harm your system if you’re not careful when acting as the root.
Install Memcached on Linux Mint 20 Ulyana
Step 1. Before running the tutorial below, it’s important to make sure your system is up to date by running the following apt
commands in the terminal:
sudo apt update
Step 2. Installing Memcached on Linux Mint 20.
The Memcached packages are already present in the default Linux Mint repository. To install it, enter the following command as root or user with sudo
privileges:
sudo apt install memcached libmemcached-tools
Once the installation of the Memcached server is completed, enable the Memcached services by typing the following command:
sudo systemctl enable memcached sudo systemctl start memcached
Step 3. Configuring Memcached.
Memcached options can be configured in the /etc/memcached.conf
file. By default, Memcached is set to listen only on localhost.
The following example assumes that you want to connect to the Memcached server over a private network. The Memcached server IP is 192.168.77.20, and the client’s IP address is 192.168.77.30.
sudo nano /etc/memcached.conf
Locate the line that begins with -l 127.0.0.1 and replace 127.0.0.1 with the server IP address 192.168.77.20.
Restart the Memcached service for the changes to take effect:
sudo systemctl restart memcached
Step 4. Configure Firewall for Memcached.
Once the service is configured, the next step is to open the Memcached port in the firewall:
sudo ufw allow from 192.168.77.30 to any port 11211
Congratulations! You have successfully installed Memcached. Thanks for using this tutorial for installing the latest version of Memcached on the Linux Mint system. For additional help or useful information, we recommend you check the official Memcached website.