FedoraLinuxTutorials

How To Install Memcached on Fedora 35

Install Memcached on Fedora 35

In this tutorial, we will show you how to install Memcached on Fedora 35. For those of you who didn’t know, Memcached is a high-performance distributed, in-memory caching system. It primarily is used to speed up sites that make heavy use of databases. Memcached has an API with a very large hash table distributed across multiple machines. when a table is full, subsequent inserts cause older data to be purged in the least recently used order.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Memcached on a Fedora 35.

Prerequisites

  • A server running one of the following operating systems: Fedora 34 or Fedora 35.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Memcached on Fedora 35

Step 1. Before proceeding, update your Fedora operating system to make sure all existing packages are up to date. Use this command to update the server packages:

sudo dnf upgrade
sudo dnf update

Step 2. Installing Memcached on Fedora 35.

By default, Memcached is available on Fedora 35 base repository. Now run the following command below to install Memcached on your Fedora system:

sudo dnf install memcached

After installation is complete we need to start the Memcached server to start operating. We do that with the following command below:

sudo systemctl start memcached
sudo systemctl enable memcached
sudo systemctl status memcached

Step 3. Configuring Memcached.

We need to make some configurations in Memcached. Now edit the Memcached default configuration file in your favorite text editor:

sudo nano /etc/sysconfig/memcached

Add the following file:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="64"
OPTIONS="-l 127.0.0.1,::1"

Save and close the file, then restart your Memcached:

sudo systemctl restart memcached

Step 4. Configure Firewall.

Fedora comes with a firewall enabled by default, and it will block other connections from other computers that are trying to access our Memcached service. We must open the appropriate ports so that the samba-shared resources can be accessed from other machines:

sudo firewall-cmd --new-zone=memcached --permanent
sudo firewall-cmd --zone=memcached --add-port=11211/udp --permanent
sudo firewall-cmd --zone=memcached --add-port=11211/tcp --permanent
sudo firewall-cmd --reload

Step 5. Installing Memcached PHP Extension.

Install the following PHP extension php-pecl-memcached as shown below:

sudo apt install php-pecl-memcache

Next, restart Memcached and Apache for the changes to take effect:

sudo systemctl restart memcached 
sudo systemctl restart httpd

Congratulations! You have successfully installed Memcached. Thanks for using this tutorial for installing the Memcached on your Fedora 35 system. For additional help or useful information, we recommend you check the official Memcached website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button