How To Install Memcached Memory Caching In Linux

Install Memcached Memory Caching

We will Install Memcached Memory Caching in Linux sever to improve website speed. We can install and configure apache Memcached in Linux.

Memcached is a distributed memory object caching system which is used to speed up the dynamic database-driven website by caching data and object in RAM to reduce the number of times external data source must be read.

Memcached is also used to cache entire database tables and queries to improve the performance of the database.

Check Out: RPM useful Commands List

Requirements: Apache with PHP installed and CentOS machine.

Let’s Begin

Step 1: Install Memcached

yum install memcached -y

install memcached linux

Step 2: Start the Service and enable at boot time.

systemctl start memcached && systemctl enable memcached

Check Out: Configure Varnish To Work With Apache

You can also install libmemcached. This will provide you several tools that will work with Memcached.

Step 3: You can also check the version and default port used for Memcached

memcached -h

Step 4: You should disable the UDP it can protect you from Denial of service attacks(DOS).

Configuration file location: /etc/sysconfig/memcached

Check Out: ByPass Root Password Of Mysql Server

Securing Server:-

Now we will bind the localhost Ip address to Memcached which will help us to protect from Denial of service attacks and “-l 127.0.0.1“.

If you want to disable UDP in Memcached So you need to use “-U 0“ this with an option in /etc/sysconfig/memcached file.

If you want you can also change port here other settings too.

vim /etc/sysconfig/memcached

Restart the service and make sure Memcached should listen on 127.0.0.1. You can also use your Web server Ip address here I have used the localhost.

Check Out: Install AIDE ( File Integrity)

systemctl restart memcached && netstat -tnlp | grep memcache

memcached install in linux

Step 4: If you want to you can check Memcached server status,

memcached-tool 192.168.185.143 stats

apache memcached linux

Step 5: Don’t forget to add Memcached port in the firewall

firewall-cmd --permanent –add-port=11211/tcp

firewall-cmd –reload

installing memcached on linux server

Check Out: Force User to Change Password At first 

Step 6: PHP module for Memcached

yum install php-perl-memcache

Check Remote Connectivity,

echo stats | nc memcache_host_name_or_IP 11211

You’re done download elasticsearch source code apache memcached linux configure

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment