How to Convert CentOS 8 to AlmaLinux OS, Enable Stub Resolvers, and Manage Hard Drive Space

This article explains how to convert a CentOS 8 server to AlmaLinux OS, how to enable stub resolvers, and how to manage and clean up hard drive space on a cPanel & WHM server. It includes commands, warnings, verification steps, and best practices for safe system maintenance.

CentOS to AlmaLinuxStub ResolversDisk Space Management

~2 min read • Updated Feb 18, 2026

1. Convert CentOS 8 to AlmaLinux OS


This process converts your CentOS 8 server to AlmaLinux OS, the CloudLinux fork of RHEL. Since CentOS 8 reached EOL in 2021, upgrading is essential for security and compatibility.


Step 1 — Update Packages


dnf clean all
dnf -y update

Step 2 — Reboot the Server


reboot

Step 3 — Download the AlmaLinux Deploy Script


curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh

Step 4 — Run the Conversion Script


bash almalinux-deploy.sh

After completion, the output should show:


Migration to AlmaLinux is completed

Step 5 — Verify Installation


cat /etc/redhat-release

Expected output:


AlmaLinux release 8.4 (Electric Cheetah)

Step 6 — Verify Kernel Boot


sudo grubby --info DEFAULT | grep AlmaLinux

Expected output:


title="AlmaLinux (4.18.0-305.el8.x86_64) 8.4"

2. Enable Stub Resolvers


Warning: This method is not recommended and is unsupported. It may cause configuration issues and reduce the usefulness of AutoSSL error messages.


Stub resolvers allow your system to use internal resolvers instead of external DNS, useful only when port 53 is intentionally blocked.


Step 1 — Test dig


/scripts/cpdig google.com mx

Step 2 — Create Symlink


ln -s stub /var/cpanel/dns_unbound_resolve_mode

Step 3 — Test with strace


strace -o cpdig.strace /scripts/cpdig google.com mx

Step 4 — Verify Stub Resolver


grep -A2 stub cpdig.strace

Expected output:


readlink("/var/cpanel/dns_unbound_resolve_mode", "stub", 4095) = 4

3. Manage Hard Drive Space


Keeping at least 10% free disk space is strongly recommended.


Step 1 — Check Disk Usage


df -h

Example output:


/dev/mapper/LogVol00  288G  189G   85G  70% /

Step 2 — Identify Large Directories


du -sh

Example:


113G home
5.4G /var

Step 3 — Inspect /var


du -sh /var/*

Example:


3.7G /var/log

Step 4 — Delete or Trim Log Files


To keep last 5000 lines:


tail -5000 filename > filename.new
mv filename.new filename
sync

To delete file:


cat /dev/null > filename

Step 5 — Restart Related Service


Restart the service that created the log file after cleanup.


4. SMART Errors


Warning: SMART errors may indicate disk failure. Disable only if you fully understand the risks.


touch /var/cpanel/disablesmartcheck
/scripts/upcp

5. Monitor Disk Usage


WHM » Home » Server Configuration » Tweak Settings

Add ignored mount points to:


/var/cpanel/chkservd_ignored_mounts

Conclusion


This guide covers converting CentOS 8 to AlmaLinux OS, enabling stub resolvers, and managing disk space safely. Following these steps ensures a stable, secure, and well‑maintained server environment.


Written & researched by Dr. Shahin Siami