When connecting to the Memcached server via TCP and IP protocols, data is provided with a unique key value and stored as strings in memory. Stored data can be permanent or temporary. Well, in case of staging, cached data will be deleted automatically after the configured time interval. We don’t need to add any additional 3rd party repositories to install Memcached Server because it is already included in the default Ubuntu 20.04 repository. So using APT package manager and available package names we can configure this cache server on our system. We have mentioned below the steps to install Memcached on Linux server running Ubuntu 20.04 LTS.

Steps to Install Memcached on Linux Server Running Ubuntu 20.04 LTS

Installing Memcached

Step 1: if you still don’t have memcached installed on your server, you can install it from official Ubuntu repositories. First make sure your local package index is updated using the following command: Step 2: Next, install the official package as follows: Step 3: You can also install libmemcached-tools, which is a package that contains various tools that you can use to examine, test, and manage your Memcached server. Add the package to your server with the following command: Step 4: Memcached should now be installed as a service on your server, along with tools that will allow you to test your connectivity. Step 5: For start memcachedrun the following systemctl command:

Configuring Memcached Network Settings

Step 1: The default Memcached configuration file is located at /etc/memcached.conf. You can configure it according to your needs. The default settings are sufficient for most applications. However, if you want to allow remote access to your Memcached server and change the default port, edit the Memcached configuration file as shown below: Step 2: change the following values: Step 3: Save and close the file then restart the Memcached service to implement the changes. -l your-ip-server

Limit the number of simultaneous incoming connections. The daemon default is 1024-c 1024

Step 4: Now you can check Memcached status with the following command:

Configure PHP to use Memcached

At this point, Memcached is installed and configured. Now, you can configure PHP to use Memcached. Step 1: First, install Apache and PHP modules with the following command: Step 2: Next, create a sample PHP file in the Apache root directory with the following command: Step 3: Add the following code: Step 4: Save and close the file then restart the apache service to implement the changes: Step 5: If you want enable Python supportinstall the following package: Step 6: If you want enable perl supportinstall the following package:

Final Words

We hope you like our article on how to Install Memcached on Ubuntu 20.04 LTS Linux Server. Memcached is an all-purpose, high-performance distributed memory caching technology that is open source. It is a RAM-based key-value store for short, arbitrary blocks of data that is used to speed up dynamic websites. If read requests for your web application are high and writes are low, Memcached is an excellent tool for you.

How to Install Memcached on Linux server running Ubuntu 20 04 LTS - 45How to Install Memcached on Linux server running Ubuntu 20 04 LTS - 63How to Install Memcached on Linux server running Ubuntu 20 04 LTS - 28How to Install Memcached on Linux server running Ubuntu 20 04 LTS - 97