How to Install WHM/cPanel on VPS: A Comprehensive Step-by-Step Guide

Introduction
WHM (Web Host Manager) and cPanel are the gold standards for server and hosting management, offering intuitive interfaces for administrators and users. This guide will take you through installing WHM/cPanel on your VPS, ensuring your server meets the requirements and addressing potential issues like network configurations and troubleshooting.


System Requirements

To run WHM/cPanel efficiently, ensure your VPS satisfies the following requirements:

Hardware Requirements

  • RAM: Minimum of 2 GB (4 GB or more recommended for better performance).
  • Disk Space: At least 40 GB of free space.
  • Processor: 64-bit architecture.

Software Requirements

  • Supported Operating Systems:

    • CentOS 7 or 8
    • AlmaLinux 8
    • Rocky Linux 8
  • Root Access: Full administrative/root access to your VPS.

  • Static IP Address: WHM/cPanel requires a dedicated IP. Ensure your server is configured with a static IP.


Step 1: Log in to Your VPS via SSH

Use an SSH client like PuTTY (for Windows) or your terminal (Linux/Mac) to access your VPS.

  1. Open your SSH client.

  2. Enter the following command:

    ssh root@your-server-ip
    

    Replace your-server-ip with the IP address of your VPS.

  3. Provide your root password to log in.


Step 2: Update System Packages

Keeping your system up to date is critical for a smooth installation process. Run the following command to update all installed packages:

yum update -y

Step 3: Configure the Network (Disable Network Manager)

WHM/cPanel requires the Network Manager to be disabled to avoid network conflicts.

  1. Stop the Network Manager service:

    systemctl stop NetworkManager
    
  2. Disable it permanently to prevent it from starting at boot:

    systemctl disable NetworkManager
    
  3. Enable and restart the traditional network service:

    systemctl enable network
    systemctl start network
    
  4. Verify the status of the network service:

    systemctl status network
    

Step 4: Set the Hostname

A fully qualified domain name (FQDN) is required for the server. Set the hostname using the following command:

hostnamectl set-hostname server.yourdomain.com

Replace server.yourdomain.com with your desired hostname.


Step 5: Install Dependencies

WHM/cPanel depends on tools like Perl, Curl, and Wget. Install them with this command:

yum install perl curl wget -y

Step 6: Disable SELinux

SELinux (Security-Enhanced Linux) must be disabled because it conflicts with WHM/cPanel.

  1. Check the current SELinux status:

    sestatus
    
  2. Temporarily disable SELinux:

    setenforce 0
    
  3. To disable SELinux permanently:

    • Open the configuration file:
      nano /etc/selinux/config
      
    • Change SELINUX=enforcing to SELINUX=disabled.
    • Save and exit the file.
  4. Reboot the server to apply changes:

    reboot
    

Step 7: Download and Install WHM/cPanel

  1. Navigate to the /home directory:

    cd /home
    
  2. Download the WHM/cPanel installation script:

    curl -o latest -L https://securedownloads.cpanel.net/latest
    
  3. Execute the installation script:

    sh latest
    

The installation process may take between 30 minutes to an hour, depending on your server's hardware and internet speed.


Step 8: Access WHM for the First Time

Once the installation completes, you can access WHM using the following URL:

https://your-server-ip:2087
  1. Log in using the root username and password.
  2. Complete the initial configuration setup, which includes:
    • Activating your cPanel license.
    • Setting up contact details.
    • Configuring DNS settings.

Step 9: Configure Firewall for WHM/cPanel

Ensure the required ports for WHM/cPanel are open in your firewall:

firewall-cmd --zone=public --add-port=2087/tcp --permanent
firewall-cmd --zone=public --add-port=2083/tcp --permanent
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --reload

Network Troubleshooting

1. Network Service Fails After Disabling Network Manager

If your network service fails after disabling the Network Manager:

  • Manually restart the network:

    systemctl restart network
    
  • Verify your network configuration file /etc/sysconfig/network-scripts/ifcfg-eth0 contains the correct settings:

    BOOTPROTO=static
    ONBOOT=yes
    IPADDR=your-server-ip
    NETMASK=255.255.255.0
    GATEWAY=your-gateway-ip
    DNS1=8.8.8.8
    DNS2=8.8.4.4
    

Save changes and restart the network service:

systemctl restart network

FAQ

1. Can WHM/cPanel be installed on any Linux distribution?

No, WHM/cPanel supports only CentOS, AlmaLinux, and Rocky Linux (64-bit).

2. What happens if I skip disabling SELinux?

SELinux may block certain services or processes required by WHM/cPanel, causing errors.

3. How can I check the installed version of cPanel?

Run the following command:

/usr/local/cpanel/cpanel -V

4. How do I reset the root password for my server?

Run the following command to reset your root password:

passwd root

Troubleshooting Tips

1. Installation Fails

  • Ensure the server meets the minimum hardware and software requirements.
  • Re-run the installation script if interrupted:
    sh latest
    

2. WHM Not Accessible

  • Verify that required ports (e.g., 2087) are open in the firewall.
  • Restart the network service to ensure connectivity.

3. SELinux Issues

  • Double-check that SELinux is permanently disabled by inspecting /etc/selinux/config.

Conclusion

 

By following this step-by-step guide, you can successfully install WHM/cPanel on your VPS, configure your server, and troubleshoot any issues during the process. WHM/cPanel is an essential tool for managing web hosting environments, making server administration efficient and user-friendly. For additional assistance, contact our support team.

Hjälpte svaret dig? 0 användare blev hjälpta av detta svar (0 Antal röster)