Candid photograph of a Linux server terminal with a soft olive-green glow against a dark slate background, conveying a calm technical atmosphere.

Step-by-step guides for system administrators — covering command-line basics, web server setup, and preparation material for technical interviews.

Browse Tutorials

Install and configure Memcached on Fedora

Memcached is a lightweight, in-memory key-value store used as an object cache. It keeps values in RAM, returns them over a simple network protocol, and evicts least-recently-used entries under pressure. On Fedora, it reduces database reads and application latency without the operational weight of a full database cache.

Fedora’s dnf workflow makes installation straightforward, while Australian production estates often standardise on RHEL or CentOS Stream. The commands below apply to those related systems, but administrators should confirm the packaged systemd unit before changing production. Package sources, updates, and security policies should match the organisation’s approved baseline.

Australian cloud workloads often keep application and cache tiers in the same Sydney or Melbourne region to reduce latency. Private subnets and cloud security groups still apply alongside firewalld. Place Memcached near its callers rather than across distant availability zones, and expose only the interface those callers require.

Keep logs and monitoring in UTC, especially across Melbourne’s daylight-saving changes, even when incidents are discussed locally. An Australian “no worries” belongs in informal support chat, while runbooks need exact commands and rollback steps. Australian data-residency and procurement requirements also favour private cache traffic.

Prepare the Fedora host

Confirm the host, kernel, disk space, memory, and private address. Use hostnamectl, uname -r, df -h, and free -h; on cloud instances, record which private IP clients will use. The Linux and Unix fundamentals reference provides useful context for shell and permission conventions.

Apply pending updates and confirm the server time before installation. On Fedora, use sudo dnf upgrade -y, then review reboot requirements with needs-restarting -r if available. Do not upgrade a production host immediately before a maintenance window without checking the release notes.

Install and start the service

Install the daemon and let systemd manage its lifecycle. The package normally creates an unprivileged memcached account and a systemd unit:

sudo dnf install -y memcached
sudo systemctl enable --now memcached

Confirm the service is active and inspect its listener. A secure local installation should show port 11211 bound to loopback rather than every interface.

systemctl status memcached --no-pager
sudo ss -lntp | grep ':11211'

If the listener is absent, inspect recent journal entries with journalctl -u memcached -n 50 --no-pager. Package conflicts, an occupied port, or a failed user lookup will appear there. Resolve the cause before editing firewall rules; an open port cannot compensate for a daemon that failed to start.

Set cache and network limits

The packaged unit normally reads /etc/sysconfig/memcached. Confirm that path with systemctl cat memcached, then edit it using sudoedit. A conservative starting point is:

PORT="11211"
USER="memcached"
MAXCONN="1024"
CACHESIZE="1024"
OPTIONS="-l 127.0.0.1"

CACHESIZE is a memory limit in megabytes, not a reservation of usable RAM for everything else. The example permits 1 GiB; size it to the host and workload, leaving headroom for the application, OS, and connection buffers. OPTIONS should set an explicit bind address, while MAXCONN should reflect measured concurrency rather than an arbitrary large number.

Match exposure to application placement:

Placement Memcached binding Network rule Best fit
Same host 127.0.0.1 No inbound opening Local applications and command-line tools
Private application tier Private service IP Allow the application subnet only App and cache in one cloud region
Authorised client subnet Dedicated private IP Allow named source subnets only Remote checks and approved service clients

Secure and validate the deployment

For local-only use, keep 127.0.0.1 and add no inbound firewalld rule. For private remote clients, bind the private IP and allow only their subnet. For example:

sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.20.0.0/24" port port="11211" protocol="tcp" accept'
sudo firewall-cmd --reload

Mirror the same source restriction in cloud security groups. If using a non-standard port, give SELinux a matching label after installing policycoreutils-python-utils: sudo semanage port -a -t memcached_port_t -p tcp 11212. Never publish standard Memcached directly to the public internet; use private networking or a hardened intermediary with explicit access controls.

Test locally with printf 'version\r\n' | nc 127.0.0.1 11211, then run stats from the same command. Expect a VERSION response and counters for hits, misses, evictions, and bytes. From an authorised application host, use nc -vz CACHE_PRIVATE_IP 11211. Host antivirus does not replace network controls: Norton security guidance can inform endpoint reviews, while firewall and identity rules still govern cache access.

Operate the cache in production

Memcached has no durable disk store. A restart empties it, expired entries are reclaimed lazily, and the database must remain authoritative. Give cached objects sensible TTLs so stale data disappears naturally, and ensure clients can rebuild the cache after a cold start.

Pre-deployment checks

Routine checks

For Python clients, isolate dependencies using the Python virtual environment guide before connecting an application. On the cache host, apply the chosen settings with sudo systemctl restart memcached && systemctl is-active memcached, then retain the output in the change record.