Ghosted

Complete AlmaLinux cPanel Installation Guide

πŸš€Complete AlmaLinux cPanel Installation

Professional Step-by-Step Setup for AlmaLinux 8 to 9.6 with Security Best Practices

⚠️ Important Prerequisites: This guide is designed for fresh AlmaLinux installations (versions 8 through 9.6) with root access. Always backup your data before proceeding. Follow these steps in order as some depend on previous configurations.

πŸ“‹ System Preparation & Initial Setup

1 Update Your AlmaLinux System

Start by ensuring your system is fully updated with the latest security patches and packages:

dnf update -y reboot
πŸ’‘ Pro Tip: Schedule the reboot for minimal disruption: dnf update -y && shutdown -r +1
2 Configure Server Hostname

Set a proper Fully Qualified Domain Name (FQDN) for your server. This is crucial for cPanel functionality and SSL certificates:

Replace these with your values:

Hostname: server.yourdomain.com

Example: web1.ghosted.com

hostnamectl set-hostname server.yourdomain.com echo “127.0.0.1 server.yourdomain.com” >> /etc/hosts
3 Disable SELinux for cPanel Compatibility

cPanel requires SELinux to be disabled for proper operation:

sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/’ /etc/selinux/config setenforce 0

πŸ“¦ Install cPanel & WHM

πŸ“ Installation Notes: cPanel installation typically takes 1-4 hours depending on your server specifications and internet connection speed. The installer will automatically configure Apache, MySQL/MariaDB, PHP, and all required dependencies.
4 Download and Execute cPanel Installer

Run the official cPanel installation script:

cd /home curl -o latest -L https://securedownloads.cpanel.net/latest sh latest

The installer will automatically:

  • Install all required dependencies and packages
  • Configure Apache, MySQL/MariaDB, and PHP
  • Set up WHM (Web Host Manager) interface
  • Configure basic security settings
  • Install default cPanel features and modules
5 Complete Initial WHM Configuration

Access WHM at:

https://your-server-ip:2087

After installation completes, access WHM using your root credentials and complete:

  • Accept the license agreement
  • Configure your contact email
  • Set up nameservers (ns1 and ns2)
  • Configure networking and IP addresses
  • Choose your MySQL/MariaDB settings
  • Select quotas configuration
Optional Step

πŸ›‘οΈ Upgrade to Imunify360 (Advanced Security)

Should You Upgrade?

cPanel comes with ImunifyAV FREE pre-installed, which provides basic malware scanning. However, if you’re running a hosting company or managing multiple WordPress sites, we highly recommend upgrading to Imunify360 for comprehensive protection.

Imunify360 includes:

  • Advanced Web Application Firewall (WAF)
  • Real-time malware protection and cleanup
  • Proactive defense against zero-day attacks
  • Intrusion detection and prevention
  • Automatic security patches
  • DDoS protection
6 Remove ImunifyAV Free (If Upgrading)

First, check if ImunifyAV is installed and remove it:

# Check if ImunifyAV is installed rpm -qa | grep imunify # If found, remove it systemctl stop imunify-antivirus dnf remove imunify-antivirus* -y rm -rf /var/lib/imunify360 rm -rf /etc/sysconfig/imunify360
7 Install Imunify360

Download and install Imunify360:

wget https://repo.imunify360.cloudlinux.com/defence360/i360deploy.sh chmod +x i360deploy.sh ./i360deploy.sh –key YOUR_KEY_HERE

Need an Imunify360 License?

Contact Ghosted.com and we’ll be happy to help you get licensed! All our shared hosting packages come with Imunify360 included for maximum protection.

8 Verify Imunify360 Installation
imunify360-agent version systemctl status imunify360
Optional Configuration

πŸ“§ Disable Mail Services (Recommended for Security)

Why Disable Mail Services?

If you don’t need to send mail directly from your server, disabling mail services significantly reduces your attack surface by:

  • Eliminating mail-based exploits and vulnerabilities
  • Preventing your server from being used for spam
  • Reducing server resource usage
  • Closing potential entry points for hackers

We recommend using external mail services like:

  • Google Workspace (formerly G Suite)
  • Microsoft 365
  • Other dedicated email providers

Need Email Solution Advice?

If you need guidance on setting up professional email services, reach out to Ghosted Web Support. We’ll help you choose and configure the best email solution for your needs.

9 Disable cPanel Mail Services

Stop and disable mail-related services:

# Stop and disable Exim (Mail server) systemctl stop exim systemctl disable exim # Stop and disable Dovecot (IMAP/POP3) systemctl stop dovecot systemctl disable dovecot # Disable SpamAssassin systemctl stop spamassassin systemctl disable spamassassin # Disable ClamAV Scanner systemctl stop clamd systemctl disable clamd
10 Configure WHM to Keep Mail Services Disabled

Prevent cPanel from restarting mail services:

In WHM, navigate to:

Service Configuration β†’ Service Manager

Uncheck these services:

Exim, Dovecot, SpamAssassin, ClamAV

Save the configuration to ensure mail services remain disabled.

πŸ”’ Essential Security Hardening

11 Secure SSH Configuration

Implement SSH security best practices:

# Backup original SSH config cp /etc/ssh/sshd_config /etc/ssh/sshd_config.backup # Edit SSH configuration nano /etc/ssh/sshd_config

Add or modify these security settings:

Port 2222 # Change from default port 22 PermitRootLogin no # Disable direct root login PasswordAuthentication no # Require SSH keys only MaxAuthTries 3 # Limit login attempts ClientAliveInterval 300 # Session timeout ClientAliveCountMax 2
# Restart SSH service systemctl restart sshd
12 Configure WHM Security Center

Enable essential security features in WHM:

Navigate to these WHM sections:

βœ“ Security Center β†’ cPHulk Brute Force Protection – Enable and configure

βœ“ Security Center β†’ ModSecurityβ„’ Vendors – Install OWASP rules

βœ“ Security Center β†’ Shell Fork Bomb Protection – Enable

βœ“ Security Center β†’ Compiler Access – Disable for users

βœ“ Security Center β†’ Apache mod_userdir Tweak – Enable protection

13 Configure Automatic Security Updates

Enable automatic security updates for your system:

# Install automatic updates dnf install dnf-automatic -y # Configure for security updates only sed -i ‘s/apply_updates = no/apply_updates = yes/’ /etc/dnf/automatic.conf sed -i ‘s/upgrade_type = default/upgrade_type = security/’ /etc/dnf/automatic.conf # Enable automatic updates systemctl enable –now dnf-automatic.timer
14 Final Security Verification

Verify your security configuration:

# Check open ports ss -tuln # Verify services systemctl list-unit-files –state=enabled # Check cPanel services whmapi1 servicestatus # Test security settings curl -I https://your-server-ip:2083

βœ… Installation Complete – Verification Checklist

πŸŽ‰ Congratulations! Your AlmaLinux server is now professionally configured with:
  • βœ… cPanel/WHM installed and optimized
  • βœ… Security hardening applied
  • βœ… Optional Imunify360 protection (if chosen)
  • βœ… Optional mail services disabled (if chosen)
  • βœ… SSH secured with best practices
  • βœ… Automatic security updates enabled
πŸ”— Access Your Server:

Web Interfaces:

WHM (Admin): https://your-server-ip:2087

cPanel (Users): https://your-server-ip:2083

Secure Shell Access:

SSH Command: ssh username@your-server-ip -p 2222

⚑ Important Next Steps:
  • Configure your DNS nameservers in WHM
  • Install SSL certificates (AutoSSL or Let’s Encrypt)
  • Create hosting packages and pricing
  • Set up automated backups
  • Configure firewall rules if needed
  • Create your first cPanel account
  • Monitor server logs regularly

Need Professional Server Management?

Setting up a server is just the beginning. For ongoing management, security monitoring, and expert support, contact Ghosted.com. We offer managed hosting solutions that take care of all the technical details while you focus on your business.

Share:

More Posts

Change SSH Port from 22 to Custom Port

GHOSTED.COM Change SSH Port from 22 to Custom Port Complete Security Hardening Guide with Firewall Configuration & Recovery Options πŸ“‹ Compatibility: This guide is tested

JetBackup 5 AlmaLinux Repository Fix Guide

GHOSTED.COM Complete Solution for Repository Issues and Professional Installation ⚠️ Important: This comprehensive guide will help you fix repository issues with JetBackup 5 on AlmaLinux

Ultimate Imunify360 Threat Blocker Guide

GHOSTED.COM Automatically Block Hackers, Malware, and Botnets with Advanced Threat Intelligence βœ“ Production Tested βœ“ 10,000+ IPs Blocked βœ“ Daily Auto-Updates Protect Your Server with

Send Us A Message