Installation
Memcached is available in the official APT package repository of Debian and can easily be installed.
First of all, and as always, update the system’s cache repository using the below-given command:
Upgrade the installed packages using the command:
Right after updating and upgrading, type the command given below to start the installation process of Memcached along with the libmemcached-tools.
Type Y and hit Enter.
After the successful installation of Memcached, the Memcached service will automatically start. Verify the status of Memcached service using the systemctl command as shown below:
If it is not started, start it by typing the command provided below:
After starting it manually, check the status again to confirm the ignition of the Memcached service.
In the status, you can see that the Memcached service is running, and you can also see the port number highlighted in the screenshot attached on which Memeched listens.
Configuration
If you want to configure remote server access of the Memcached server, you first have to include the server’s IP address to the /etc/memcached.conf configuration file.
To know the IP address of the server on which Memcached service is running, type the command given below:
You can see that the IP address of our server is 192.168.18.39. Note down the server IP address because we have to add this IP in the Memcached configuration file.
To open and edit the configuration file in nano editor, type the command given below:
Change the IP address from 127.0.0.1 to the server’s IP address, which in our case is 192.168.18.231.
After successfully adding the IP address, Press CTRL + S and CTRL + X to save and exit the file.
Now, you need to allow the firewall and open port 11211 for any incoming traffic.
After running the above-given command, reload the firewall for the changes to work.
After restarting the Memcached service, verify the status by typing the command given below:
Now, the Memcached server is fully configured and ready for remote access from any other machine on the network.
Conclusion
This post provides a to-the-point and profound guide on how to install Memcached on the Debian 10 system. This post also contains the configuration of Memcached for remote server connections by allowing the firewall to open its port for incoming traffic. After following the configuration provided in this post, the Memcached is ready for connecting to other machines.