CentOS
Cent Operating System
Articles
How to Limit the Download Speed of dnf and apt Updates
Package updates can fill a slow or shared network link, for example on a branch office line or when many servers update at the same time. Both dnf and apt can limit...
How to List Services on RHEL, AlmaLinux and Rocky Linux and Check Their Status with systemctl
To list all services on Red Hat Enterprise Linux (RHEL) and its rebuilds AlmaLinux and Rocky Linux, run systemctl list-units --type=service --all. To see only the...
How to Log Debug Messages with rsyslog and journald
By default, /var/log/messages (AlmaLinux, Rocky Linux, RHEL) and /var/log/syslog (Ubuntu) leave out the least important messages, the "debug" level. When you...
How to Log all Bash History Commands to syslog (/var/log/messages) in CentOS/RHEL?
The user wants to see the list of commands used in the syslog messages. This way the user can audit user activities written in bash_history.
Solution
1. To log...
How to Make USB Storage Read-Only with a udev Rule (and Block USB with USBGuard)
On machines where data must not leave on a USB stick, you can make every USB storage device read-only as soon as it is plugged in: people can still read files from it,...
How to Make ethtool Settings Persistent Across Reboots
ethtool changes network card settings such as offloading features, speed and duplex, but those changes are lost at the next reboot. On CentOS 6 and 7 (both end of...
How to Measure Network Bandwidth and Latency with qperf
qperf measures bandwidth and latency between two Linux machines over TCP, UDP and, on suitable hardware, RDMA. Its strength is latency: it reports the round-trip time...
How to Modify Kernel Arguments With grubby
Kernel arguments (also called kernel command-line parameters) control things such as the console, crash dumps, or hardware quirks. On AlmaLinux, Rocky Linux and RHEL,...
How to Monitor /etc/passwd and /etc/shadow Changes with auditd
Changes to /etc/passwd, /etc/shadow and /etc/group mean that user accounts, passwords or group memberships changed. An unexpected change is a strong sign of an...
How to Monitor Linux Server Performance with Netdata
CentOS 7/8 are end of life; these steps are for Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9. Netdata is an open-source monitoring agent that collects...
How to Monitor System Time Changes with auditd
Someone changing the system clock can hide their tracks in the logs, break TLS and two-factor logins, or disturb scheduled jobs. Security standards such as PCI DSS and...
How to Open a Port in the Firewall on RHEL, AlmaLinux and Rocky Linux
To make a service reachable from outside, two things must be true: the service listens on the port, and the firewall allows it. This guide opens a port with firewalld,...
How to Open and Close Ports on a Linux Server Firewall
CentOS 6 and 7 are end of life. These are the current ways to open and close a port (5555/tcp in the examples).
AlmaLinux / Rocky Linux (firewalld)
firewall-cmd...
How to Prevent Users From Reusing Their Last 10 Passwords
A password history rule stops users from setting a password they used recently, so an expired password cannot simply be set again. The PAM module pam_pwhistory does...
How to Query and Change Kernel Parameters with sysctl (Now and Permanently)
Kernel parameters control things such as IP forwarding, network buffer sizes, swap behaviour and file limits. sysctl reads and changes them while the system runs, and...
How to Rebuild a Corrupt RPM Database on RHEL and AlmaLinux
To rebuild the RPM database, back up its folder, then run rpmdb --rebuilddb as root (rpm --rebuilddb does the same) and compare rpm -qa | wc -l before and after. Check...
How to Recover Missing GRUB2 Files from /boot?
If the GRUB2 files in /boot are missing, the system cannot boot. Boot a rescue system, then reinstall GRUB2 and regenerate its configuration.
Steps (AlmaLinux / Rocky...
How to Recover an Interrupted dnf or apt Package Transaction
If a package installation or update stops half-way, because the SSH session dropped, the server lost power or someone pressed Ctrl+C at the wrong moment, some packages...
How to Reinstall GRUB2 from Rescue Mode on RHEL, AlmaLinux and Rocky Linux
If a server stops at a "grub>" or "grub rescue>" prompt, or no longer finds its operating system after a disk change, the boot loader must be reinstalled. You do...
How to Remove the Rescue Kernel and Boot Entry With grubby
AlmaLinux, Rocky Linux and RHEL install a rescue boot entry: a kernel and a large initramfs that contain drivers for almost any hardware, so the system can still boot...
How to Remove virbr0 and lxcbr0 Interfaces on CentOS/RHEL 6,7?
RHEL/CentOS 6 and 7 are end of life; these steps are for Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9. A server with one network card may still show extra...
How to Resize or Expand a Btrfs File System
Btrfs can grow and shrink while it is mounted, and it can span several disks, so resizing is usually a single command. Which Linux you run matters: Btrfs is the...
How to Restore a Deleted LVM Volume Group (vgcfgrestore)
If a volume group was removed by mistake with vgremove, the data is usually still on the disks: LVM only deleted its description of the volumes. Before every change,...
How to Run MariaDB as a Custom User and Group on RHEL, AlmaLinux and Rocky Linux
MariaDB normally runs as the system user mysql. Some security policies or shared setups require it to run as another account. On current systems you do this with a...
How to Run a Custom Script as a systemd Service
Turning your own script or program into a systemd service means it starts at boot, restarts when it crashes, runs as a chosen user, and logs to the journal. All you...