Logo

How To Install Memcached on Ubuntu 22.04

Jul 01, 2023

To install Memcached on Ubuntu 22.04, you can follow these steps:

Step 1 : Update the package index:

sudo apt update

Step 2 : Install Memcached and its associated libraries:

sudo apt install memcached libmemcached-tools

Step 3 : Memcached should start automatically after installation. You can verify its status by running the following command:

sudo systemctl status memcached

Step 4 : By default, Memcached listens on localhost (127.0.0.1) and port 11211. If you need to customize the configuration, you can edit the /etc/memcached.conf file using your preferred text editor. Here's an example command using Nano editor:

sudo nano /etc/memcached.conf

Make the necessary changes and save the file.

Step 5 : If you made any changes to the Memcached configuration file, restart the Memcached service to apply the changes:

sudo systemctl restart memcached

Step 6 : Test the Memcached installation by using the memcstat command. For example, to check the statistics of the Memcached server, run:

memcstat --servers=localhost

You should see the statistics output if Memcached is running properly.

Congratulations! Memcached should now be installed and running on your Ubuntu 22.04 system. You can use Memcached as a caching layer for your applications by connecting to it using the appropriate client libraries or tools.

Recommended