In this guide, we’ll walk you through the process of installing WHM cPanel on AlmaLinux 9.
Prerequisites
Before you begin, ensure you have the following:
- A fresh installation of AlmaLinux 9.
- Root access to the server.
- A valid cPanel license (you can get a trial license from the cPanel website).
- At least 2 GB of RAM (4 GB recommended) and a minimum of 40 GB of disk space.
Step 1: Update Your Server
First, ensure that your server is up to date by running the following commands:
sudo dnf update -y
sudo dnf upgrade -y
Step 2: Set the Hostname
WHM requires a valid fully qualified domain name (FQDN) as the hostname. Set your hostname using the following command:
hostnamectl set-hostname server.example.com
Replace server.example.com
with your actual domain name.
Step 3: Disable SELinux
WHM cPanel is not compatible with SELinux in enforcing mode. You need to disable SELinux by editing the configuration file:
sudo nano /etc/selinux/config
Find the line SELINUX=enforcing
and change it to:
SELINUX=disabled
Then, apply the change:
sudo setenforce 0
Step 4: Install Required Packages
WHM cPanel requires some additional packages. Install them with the following command:
sudo dnf install perl wget screen -y
Step 5: Download and Run the cPanel Installation Script
Switch to the /home
directory and download the latest cPanel installation script:
cd /home
wget -N http://httpupdate.cpanel.net/latest
Run the script using screen
to ensure the process continues even if your SSH session disconnects:
screen
sh latest
The installation process can take anywhere from 30 minutes to a couple of hours, depending on your server’s specifications and internet speed.
Step 6: Complete the Setup in WHM
Once the installation is complete, you can access WHM to finish the setup. Open your web browser and navigate to:
https://server.example.com:2087
Replace server.example.com
with your actual server domain or IP address. You will see the WHM login screen. Use root
as the username and your root password to log in.
Follow the on-screen instructions to complete the initial setup, including setting up your contact information and nameservers.
Step 7: Secure Your Server
After installing WHM cPanel, it’s crucial to secure your server. Here are a few recommendations:
- Change the SSH Port: Edit the SSH configuration file to change the default SSH port from 22 to another number.
sudo nano /etc/ssh/sshd_config
Find the line
#Port 22
and change it to a port number of your choice, for example,Port 2222
. Save and close the file, then restart the SSH service:sudo systemctl restart sshd
- Install a Firewall: Use CSF (ConfigServer Security & Firewall), a popular choice for cPanel servers, to enhance your server’s security.
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
- Enable cPHulk: cPHulk is a cPanel brute force protection service. Enable it in WHM under the “Security Center”.
Conclusion
Installing WHM cPanel on AlmaLinux 9 is a straightforward process, providing a powerful and user-friendly interface for managing your web hosting environment. By following this guide, you can set up your server quickly and ensure it’s secured and ready for production. Enjoy the benefits of a robust, scalable hosting solution with WHM cPanel and AlmaLinux 9.