WHM/cPanel is one of the most popular web hosting control panels for managing websites and servers. AlmaLinux 8, a community-driven Linux distribution, is a perfect choice for hosting environments due to its stability and compatibility. This guide will walk you through the process of installing WHM/cPanel on AlmaLinux 8, step by step.
Prerequisites:
Before you begin the installation, make sure you meet the following requirements:
Server Requirements:
- A fresh installation of AlmaLinux 8 (64-bit).
At least 2 GB of RAM (4 GB or more is recommended).
At least 40 GB of disk space.
Root Access:
- Ensure you have root or sudo privileges on the server.
Valid Hostname:
- Set a fully qualified domain name (FQDN) for your server.
Example: server.yourdomain.com
Static IP Address:
- Ensure your server has a static public IP address.
License:
- WHM/cPanel requires a valid license. You can obtain a free trial license from the cPanel website.
Step 1: Update Your Server
Before installing any software, update your server to ensure all packages are up to date:
sudo dnf update -y
Step 2: Set the Hostname
Set a fully qualified domain name (FQDN) for your server:
hostnamectl set-hostname server.yourdomain.com
Verify the hostname:
hostnamectl
Step 3: Disable SELinux
WHM/cPanel requires SELinux to be disabled. To disable it, follow these steps:
Open the SELinux configuration file:
sudo nano /etc/selinux/config
Change the value of SELINUX to disabled:
SELINUX=disabled
Save and close the file.
Reboot the server to apply the changes:
sudo reboot
Step 4: Install WHM/cPanel
Download the WHM/cPanel installer script:
curl -o latest -L https://securedownloads.cpanel.net/latest
Run the installer:
sudo sh latest
The installation process may take 30-60 minutes, depending on your server’s resources and network speed.
Step 5: Configure WHM/cPanel
Once the installation is complete, you can access the WHM interface to complete the initial setup.
- Open a web browser and navigate to the WHM login URL:
https://<your-server-ip>:2087
- Log in with the root username and password.
- Follow the on-screen instructions to:
- Agree to the license agreement.
Configure your networking settings.
Add your server’s DNS resolvers.
Set up your hosting packages and additional preferences.
- Agree to the license agreement.
Step 6: Secure Your Server
After installing WHM/cPanel, take the following steps to secure your server:
Update the Firewall:
WHM/cPanel uses ConfigServer Security & Firewall (CSF). Install and configure CSF to enhance security.
Enable Automatic Updates:
Configure automatic updates in WHM to keep your server secure and up to date.
Install an SSL Certificate:
Use AutoSSL to secure your domains with free SSL certificates.
Use Strong Passwords:
Ensure all accounts use strong passwords to prevent unauthorized access.
Common Commands for Managing WHM/cPanel
Here are some useful commands for managing WHM/cPanel:
Restart cPanel services:
systemctl restart cpanel.service
Check cPanel status:
systemctl status cpanel.service
Uninstall cPanel (not recommended):
/usr/local/cpanel/scripts/uninstall_cpanel
Conclusion
Installing WHM/cPanel on AlmaLinux 8 is a straightforward process if you follow the steps outlined in this guide. With WHM/cPanel, you can efficiently manage your server and host multiple websites. Don’t forget to secure your server and keep your software updated for optimal performance and security.
If you have any questions or encounter issues during the installation, feel free to reach out to the WHM/cPanel support team or refer to their documentation.