CentOS
Cent Operating System
Articles
How to Run a Script Automatically at Boot on Linux (systemd)
To run a script once every time the server starts, for example to set a network option, mount a special disk or send a "server is up" message, use a small systemd...
How to Run a Script When USB Devices Is Attached or Removed Using UDEV?
The post outlines steps to create UDEV rules that run a specific script when a USB device is attached or removed. We can use the udevadm tool to see the information...
How to Scan for New LUNs with Multipath on RHEL, AlmaLinux and Rocky Linux
When a storage administrator assigns a new LUN (a disk from a SAN, over Fibre Channel or iSCSI) to a server, Linux does not always notice it by itself. You tell the...
How to Secure Kibana with an Nginx Reverse Proxy
CentOS 7 is end of life. Current Kibana versions (9.x) have their own login and can use TLS, so Nginx is used mainly to publish Kibana on a normal HTTPS address. These...
How to Secure a CentOS, AlmaLinux or Rocky Linux Server
The steps that make the biggest difference on a CentOS-family server are: keep it updated, log in with SSH keys instead of root passwords, close every port you do not...
How to Send Linux Audit Logs to a Remote Rsyslog Server
The Linux audit system writes its events to /var/log/audit/audit.log on each server. If an attacker gets root, they can edit that file. Sending a copy of every audit...
How to Set Up Nginx Server Blocks on AlmaLinux and Rocky Linux
CentOS 7 reached end of life on 30 June 2024, so this guide now uses AlmaLinux 9 / Rocky Linux 9 (the steps also suit other RHEL 9 rebuilds).
Server blocks (virtual...
How to Set Up a Firewall with firewalld on AlmaLinux and Rocky Linux
CentOS 6/7/8 and RHEL 6/7 are end of life. This guide uses AlmaLinux 9 / Rocky Linux 9 (and Ubuntu 24.04 / Debian 12 where they differ).
firewalld is the standard...
How to Set Up a Remote Syslog Server with rsyslog
A remote syslog server is a server that collects log messages from your other servers and network devices, by default on port 514 (UDP and TCP). With rsyslog you set...
How to Set a Network Interface to Promiscuous Mode Permanently on Linux
A network interface in promiscuous mode passes every packet it sees to the system, not only packets addressed to it. Packet capture and intrusion detection tools...
How to Set a Static IP Address from the Linux Command Line (CentOS, AlmaLinux, Rocky Linux, RHEL and Ubuntu)
To set a static IP address from the Linux command line on CentOS Stream, AlmaLinux, Rocky Linux, RHEL or Fedora, change the NetworkManager connection with nmcli and...
How to Set dev_loss_tmo Value Persistently Using Udev Rule?
1. Check the attributes of the FC remote port(s) using the below command:
# udevadm info --attribute-walk --path=/sys/class/fc_remote_ports/rport-x:y-z
2. Then...
How to Set nproc (Max User Processes) Limits on Linux
The nproc limit caps how many processes (and threads) one user may run. It protects a server from a runaway program or a fork bomb. When it is too low, busy...
How to Set or Disable the Login Banner and MOTD for Specific Users
Linux servers can show two kinds of messages to people who log in over SSH: a banner, shown before login (often a legal warning), and the MOTD ("message of the day"),...
How to Set the Date, Time, Time Zone and NTP with timedatectl
timedatectl shows and sets the system clock, the time zone and automatic time synchronisation (NTP) in one tool. It replaces the separate date, hwclock and...
How to Set udev Rules for Oracle ASM on Multipath Disks
Oracle ASM needs its disks owned by the Grid Infrastructure user (often grid, group asmadmin) with mode 0660, and those settings must survive reboots. With multipath...
How to Start and Restart the Samba Service in Linux
To restart Samba, run sudo systemctl restart smb on AlmaLinux, Rocky Linux, RHEL and Fedora, or sudo systemctl restart smbd on Ubuntu and Debian. To start it now and...
How to Start, Stop and Use Process Accounting (psacct and acct)
Process accounting records every command that finishes on the server: who ran it, when, and how much CPU time it used. It helps answer "who ran this?" after an...
How to Stop Kernel or Package Updates with dnf versionlock and apt-mark hold
Sometimes an application needs a specific kernel or package version, so it must not be updated. RHEL/CentOS 7 used the yum versionlock plugin; AlmaLinux 9 / Rocky...
How to Stop Repeated Promiscuous Mode Messages in the System Log
Messages such as device eth0 entered promiscuous mode and device eth0 left promiscuous mode, repeated many times in /var/log/messages or the journal, mean that some...
How to Stop SSH Session Timeouts (ServerAliveInterval, ClientAliveInterval) and Exit, Kill or Stop SSH
OpenSSH does not close an idle session by itself: ClientAliveInterval is 0 and there is no idle timeout by default. When a quiet session drops, a router, NAT gateway...
How to Troubleshoot NFS Latency With nfsiostat
When an NFS share feels slow, the first question is where the time goes: the network, the NFS server, or waiting inside the client. nfsiostat answers that per mount...
How to Troubleshoot iSCSI Connection Problems on Linux
When an iSCSI disk does not appear, disappears, or is slow, work from the network up to the session and the disk. The commands below are the same on all current...
How to Tune Btrfs Filesystem for Better Performance?
Btrfs is a filesystem which is very new and is still under development and benchmarking phase. As far as performance is concerned usually it doesn’t require much to do...
How to Upgrade MariaDB on cPanel, AlmaLinux, Rocky Linux and Ubuntu
MariaDB 10.4, CentOS 7 and VestaCP are all end of life (VestaCP is no longer maintained). The current MariaDB long-term releases are 10.11, 11.4, 11.8 and 12.3. These...