Memcached is a free and open-source reminiscence object caching programs that can be utilized to hurry up your purposes by quickly storing info in reminiscence. Memcached lets you pace up net purposes like WordPress, Drupal, Joomla and different PHP primarily based purposes.
On this tutorial, we are going to clarify how one can set up Memcached on Ubuntu 18.04 server.
- A server working Ubuntu 18.04.
- A root password is configured in your server.
Replace Your System
First, replace all of the packages to the newest model with the next command:
apt-get replace -y
apt-get improve -y
As soon as all of the packages are up to date, restart your system to use the configuration adjustments.
Set up and Configure Memcached
By default, Memcached is offered within the Ubuntu 18.04 default repository. You possibly can set up it by simply working the next command:
apt-get set up memcached libmemcached-tools -y
After putting in Memcached, begin the Memcached service and allow it to start out after system reboot with the next command:
systemctl begin memcached
systemctl allow memcached
Now you can verify the standing of Memcached service with the next command:
systemctl standing memcached
You need to see the output just like the next:
? memcached.service - memcached daemon Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled) Lively: lively (working) since Sat 2019-07-13 06:13:59 UTC; 13s in the past Docs: man:memcached(1) Primary PID: 21776 (memcached) Duties: 10 (restrict: 1114) CGroup: /system.slice/memcached.service ??21776 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid Jul 13 06:13:59 ubuntu1804 systemd: Began memcached daemon.
You can too verify whether or not the Memcached service is working by typing:
ps aux | grep memcached
You need to see the next output:
memcache 21776 0.3 0.2 424764 2880 ? Ssl 06:13 0:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid root 22035 0.0 0.0 13136 1000 pts/0 S+ 06:14 0:00 grep --color=auto memcached
Subsequent, you’ll need to configure Memcached for extra superior settings. To take action, open /and many others/memcached.conf file as proven under:
nano /and many others/memcached.conf
Change the next traces as per your want:
# Default connection port is 11211 -p 11211 # Specify which IP tackle to pay attention on. -l 192.168.0.101 #Outline the utmost variety of Reminiscence can be utilized by Memcached deamon. -m 256
Save and shut the file then restart Memcached providers for the adjustments to use.
systemctl restart memcached
Set up Apache and PHP and Configure PHP to Use Memcached
Memcached is now put in and configured. Subsequent, you’ll need to put in and configure Apache to make use of Memcached.
First, set up Apache and PHP with different modules with the next command:
apt-get set up apache2 php7.2 libapache2-mod-php7.2 php-memcached php7.2-cli -y
Subsequent, create a pattern phpinfo.php file in Apache net root listing to check Memcached.
Add the next code:
<?php phpinfo(); ?>
Save and shut the file. Then, open your net browser and sort the URL http://your-server-ip/phpinfo.php. You need to see all of the PHP associated modules and Memcached info within the following web page:
Congratulations! you’ve gotten efficiently put in Memcached on Ubuntu 18.04 server. For extra info learn the official documentation at Memcache Doc. Be happy to ask me when you have any questions.
About Hitesh Jethva
Over eight years of expertise as a Linux system administrator. My abilities embody a depth data of Redhat/Centos, Ubuntu Nginx and Apache, Mysql, Subversion, Linux, Ubuntu, webhosting, net server, Squid proxy, NFS, FTP, DNS, Samba, LDAP, OpenVPN, Haproxy, Amazon net providers, WHMCS, OpenStack Cloud, Postfix Mail Server, Safety and many others.