How to Install Memcached on ubuntu 20.04 LTS

Memcached is a free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. Its simple design promotes quick deployment, ease of development, and solves many problems facing large data caches.

In this post, We will install and configure memcached server on ubuntu 18.04/20.04 LTS

Step 1: Update the System

Update the current ubuntu repo by following commands.

sudo apt-get update

Step 2: Install Memcached

To installation of Memcached use the following commands.

sudo apt-get install libmemcached-tools memcached -y

Step 3: Get status Memcached

Get the Memcached by following commands.

sudo systemctl status memcached

You should get output like this :-

 ● memcached.service - memcached daemon
    Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset
    Active: active (running) since Fri 2019-12-20 17:46:19 IST; 1min 3s ago
  Main PID: 4673 (memcached)
    CGroup: /system.slice/memcached.service
            └─4673 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1
 
 Dec 20 17:46:19 Ansible systemd[1]: Started memcached daemon.

Step 4: Memcached Configuration

After this Memcached configuration path is /etc/memcached.conf, and by default Memcached port is 11211, You want to change the port number and bind with IP address, So then you can use the Memcached mail configuration file.

sudo nano /etc/memcached.conf

Step 5: Install and configure Apahe2 to Support Memcached

Configure Apache2 to Support Memcached to do that you need to use PHP also, Steps to install apache and php given below :-

sudo apt-get install apache2 -y

Step 6: Installing PHP7.3

To install PHP 7.3 use the following the commands.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.3 php7.3-fpm php-memcached php7.3-cli libapache2-mod-php -y
Step 7: Restart the Apache2 server

You need to restart the apache2 service to configure with php by using given command.

sudo systemctl restart apache2

Step 8: Check Memcached Installation

To verify Memcached installation, You need to create a phpInfo.php to verify Memcached.

sudo nano /var/www/html/phpinfo.php

Enter the following content:

 <?php phpinfo(); ?>

Next, visit your server’s IP address on the browser or your domain name if you have one followed by http://localhost/phpinfo.php

Conclusion

we have successfully installed and configure memcached server on ubuntu machine, Still you have any issue leave a comment.

How to Install Memcached on ubuntu 20.04 LTS

2 thoughts on “How to Install Memcached on ubuntu 20.04 LTS

  1. I am a website designer. Recently, I am designing a website template about gate.io. The boss’s requirements are very strange, which makes me very difficult. I have consulted many websites, and later I discovered your blog, which is the style I hope to need. thank you very much. Would you allow me to use your blog style as a reference? thank you!

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top