Install Memcached on Ubuntu 20.04

In this guide, you’ll see how to set up and configure Memcached on your Ubuntu 20.04 system. For those unfamiliar with Memcached, it’s a free and open-source program that eases the re-extraction of information from a database with an object caching program, which allows for PHP based apps such as WordPress and Joomla to run smoothly without much latency. It does so by reducing the database load; the number of times a data source needs to be re-read upon loading an application.

Setting up Memcached on your system shouldn’t take very long if you properly follow the instructions below:

Installing Memcached

The simplest and straightforward process for installing Memcached on Ubuntu is to unpack the package included with Ubuntu’s default software repository.

Fire up the terminal and enter the following command to run an update on the repository:

$ sudo apt update

The CLI toolkit is quite handy, and you should install it too. Although installing Memcached with the supporting toolkit is optional, it comes highly recommended.

Run the following command to install Memcached with supporting utilities.

$ sudo apt install memcached libmemcached-tools

With the above commands executed you should have the Memcached server should be ready to go.

Run a status check by typing in the following command:

$ sudo systemctl status Memcached

The status check should reveal if the installation went smoothly.

With all of the above covered, we’re ready to start configuring the server.

Configuring Memcached

To configure Memcached, we will need to edit the configuration file. Go to /etc/memcached.conf and start editing the file. While the default settings allow for smooth operations, you can always change the options to better match your hardware settings to speed up the cached memory accessibility by a notch more.

One setting that you can change is the default IP address 127.0.0.1, which Memcached listens on. You can specify IP address listening by editing the following line in the config file:

$ sudo nano /etc/memcached.conf

Set the IP address which you want Memcached to listen to in the line above and change the default ports to ports of your choice.

To make the changes persistent, save, and exit the file. Then stop the Memcached server by typing in:

$ sudo systemctl stop memcached.service

Then you can restart it with:

$ sudo systemctl start memcached.service

Finally, enable the Memcached service with:

$ sudo systemctl enable memcached.service

You’ll see that changes you made before saving the file have been applied.

Allow via ufw firewall with the following command.

$ sudo ufw allow from 127.0.0.1 to any port 11211

Wrapping up

Despite being such a dynamic utility, setting up Memcached on ubuntu 20.04 is pretty simple. And it is just as easy to use and integrate into your system, provided that you keep an eye out for changes and update it regularly.



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

Post a Comment

0 Comments