How to install Memcached on Debian 10

Memcached is a very popular caching system used to store data in the form of key-value pairs. It is used for storing or caching the data in the form of objects in the memory to optimize and enhance the speed of dynamic web applications. This post will walk through a quick guide on how to install Memcached on the Debian 10 Operating system.

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:

$ sudo apt update

Upgrade the installed packages using the command:

$ sudo apt upgrade

Right after updating and upgrading, type the command given below to start the installation process of Memcached along with the libmemcached-tools.

$ sudo apt install memcached 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:

$ sudo systemctl status memcached

If it is not started, start it by typing the command provided below:

$ sudo systemctl start memcached

After starting it manually, check the status again to confirm the ignition of the Memcached service.

$ sudo systemctl status memcached

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:

$ ip a

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:

$ sudo nano /etc/memcached.conf

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.

$ sudo ufw allow from any to any port 11211

After running the above-given command, reload the firewall for the changes to work.

$ sudo systemctl restart memcached

After restarting the Memcached service, verify the status by typing the command given below:

$ sudo systemctl status memcached

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.



from Linux Hint https://ift.tt/3n2Vd10

Post a Comment

0 Comments