Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Install Memcached on Debian 11

by | Sep 19, 2021

Wondering how to install Memcached on Debian 11? We can help you.

With Memcached, we can speed up dynamic web applications by alleviating database load.

As part of our Server Management Services, we assist our customers with several Memcached queries.

Here, our support techs discuss how we can install Memcached on Debian 11 / Debian 10.

 

Install Memcached on Debian

We can get the Memcached package from the Debian OS repository. So, we do not need to set up external repositories.

Moving ahead, let us how our Support Techs get the installation done.

Initially, we update the repository index:

sudo apt update

Then, we install the Memcached using:

sudo apt install -y memcached

Once done, the service will be up and running automatically.

To verify the status of the service, we can use the ps or systemctl command:

sudo systemctl status memcached

Or

ps -ef | grep -wi memcached

Our output will be similar to this:

memcache 11047 1 0 03:40 ? 00:00:00 /usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1 -P /var/run/memcached/memcached.pid
  • Configure Memcached

With the help of its configuration file, /etc/memcached.conf we can manage the Memcached service.

Basically, there are four configurations by which we can bring up the production-ready Memcached instance.

a) The -m <num> sets the maximum memory we can use for object storage.

The default memory size is 64 MB. However, our Support Techs recommend a 256 MB cache.

-m 256

b) The -p <port_number> sets the listening port. The default port is 11211.

-p 11211

c) The -u <user_name> sets the Memcached service to run as a specific user.

-u memcache

d) The -l <ipaddress> sets the listening address.

By default, it listens on localhost only. So,to allow remote connections we need to change it to a network interface IP.

In addition, we can specify multiple addresses separated by comma or by using -l multiple times.

However, there are security risks when we configure Memcached to listen on the IP address.

This is because it allows anyone to access and may lead to a DDoS attack.

So, we need UFW (Firewall) to allow connections only from the trusted sources.

Eventually, we restart the Memcached process:

sudo systemctl restart memcached
  • Set up Firewall For Memcached

To secure the Memcached service, we need to configure the firewall to allow incoming connections from a trusted network to the Memcached port.

Here, this rule will allow connections from the xxx.xxx.x.x/xx subnet:

sudo ufw allow from xxx.xxx.x.x/xx to any port 11211

sudo ufw reload
  • Use Memcached

We have many Memcached clients available for programming languages like PHP, Python, Java, etc.

However, to use Memcached as a caching system for PHP applications such as WordPress, or Joomla, we need to install the Memcached to extension for PHP:

sudo apt install -y php-memcached

Once done, we restart the webserver to take the effect of the new extension.

[Need a hand? We are available 24*7]

 

Conclusion

In short, we learned how our Support Techs install Memcached on Debian 11 / Debian 10.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF