Fix cPanel/WHM Installation on Red Hat 6 & 7 Fearless Guide

Posted on

Fix cPanel/WHM Installation on Red Hat 6 & 7 Fearless Guide

Fix cPanel/WHM Installation on Red Hat 6 & 7 Fearless Guide

This tutorial aims to guide you on how to Fix cPanel/WHM Installation on Red Hat 6 & 7. The latest cPanel version supported on Red Hat 6 & 7 is version 110. However, attempting to install newer versions on CentOS 7, CloudLinux 6 and 7, and RHEL will result in errors.

You can leverage the steps provided below to gain insights on how to Fix cPanel/WHM Installation on Red Hat 6 & 7.

When attempting to install cPanel on RHEL 7, the following FATAL error is encountered:

(FATAL): cPanel & WHM no longer support Red Hat 6 & 7 based distributions on version 112 or greater.

This indicates that cPanel & WHM v112 and later versions do not support Red Hat 6 & 7-based distributions.

Resolve cPanel/WHM support on Red Hat 6 & 7

To Fix cPanel & WHM Installation on Red Hat 6 & 7, you can install the LTS (Long Term Support) version by following these steps:

First, open the /etc/cpupdate.conf file using your preferred text editor, such as nano or vi:

nano /etc/cpupdate.conf

Next, add the following line to the file:

CPANEL=lts

Save and close the file.

After completing these steps, you can proceed with your cPanel installation.

Important Note: Selecting this option means you will not receive any updates or support for your cPanel installation. Therefore, the following solution is highly recommended.

Migrate To Red Hat 8 for Installing cPanel & WHM

Given that CentOS 7’s end-of-life is June 30, 2024, there is little reason to continue installing on RHEL 7. If you want to leverage the newer cPanel versions, we strongly recommend using Red Hat 8 derivatives like AlmaLinux 8, Rocky Linux 8, and CloudLinux 8.

Migrating to Red Hat 8 based distributions is the best solution for using cPanel on RedHat-based distros.

Consider these resources for cPanel/WHM installation on Red Hat 8:

Install cPanel WHM on Rocky Linux 8

Install cPanel WHM on AlmaLinux 8

Also, you can visit the cPanel Tutorials to get more information and guides.

Tips: If you are looking for a web hosting operating system, you can check this guide on AlmaLinux vs CloudLinux – Which One is Better For Web Hosting.

Therefore, migrating to Red Hat 8-based distributions to use cPanel is strongly recommended instead of trying to use it on Red Hat 6 & 7. This ensures full support, updates, and eliminates any compatibility concerns. It is a better approach than trying to Fix cPanel/WHM Installation on Red Hat 6 & 7 the old way.

Alternative Solutions for cPanel/WHM on Newer Systems

While migrating to a supported operating system is the best long-term strategy, here are two alternative solutions that address the issue, focusing on containerization and virtual environments. These are presented for informational purposes and may have their own set of challenges and considerations.

1. Containerization with Docker

Docker allows you to run applications in isolated containers, packaging all dependencies, including the operating system libraries and runtime environment. This can be a viable workaround to run cPanel within a CentOS 7 container on a newer host OS, effectively isolating the cPanel installation from the underlying host’s limitations.

Explanation:

Docker creates a virtualized environment that emulates a complete operating system. By creating a CentOS 7 container, you can install cPanel within that environment, satisfying the system requirements of older cPanel versions while leveraging the newer host OS for resource management and security.

Steps:

  1. Install Docker: On your newer Linux distribution (e.g., AlmaLinux 8, Rocky Linux 8), install Docker.

    # Example for AlmaLinux 8/Rocky Linux 8
    sudo dnf install docker-ce --nobest -y
    sudo systemctl start docker
    sudo systemctl enable docker
  2. Create a Dockerfile: Create a Dockerfile that defines the CentOS 7 environment and installs cPanel. This Dockerfile will contain the instructions to build the Docker image.

    FROM centos:7
    
    # Update the system
    RUN yum update -y
    
    # Install necessary packages
    RUN yum install -y wget perl net-tools
    
    # Download and install cPanel (replace with actual cPanel installation script)
    RUN wget http://httpupdate.cpanel.net/latest
    RUN chmod +x latest
    RUN ./latest
    
    # Expose necessary ports
    EXPOSE 2082 2083 2086 2087 2095 2096 2089 2090 110 143 465 587 993 995 20 21 22 25 53 80 443 3306
    
    # Start cPanel services (this needs to be adapted based on cPanel installation)
    CMD ["/usr/local/cpanel/scripts/restartsrv_cpsrvd"]

    Important Considerations for the Dockerfile:

    • cPanel Installation Script: Replace http://httpupdate.cpanel.net/latest with the correct URL for the cPanel installation script that is compatible with CentOS 7. You might need to find an older version of the installer.
    • cPanel Startup: The CMD instruction needs to correctly start the cPanel services. The example CMD may not be entirely correct and might require modification based on how cPanel installs within the container. You might need to create a custom script to start all the necessary cPanel services.
    • Licensing: Ensure you have a cPanel license that is valid for use in a containerized environment.
    • Persistence: Data within the container is not persistent by default. You’ll need to configure Docker volumes to persist data (e.g., website files, databases) across container restarts.
  3. Build the Docker Image: Build the Docker image from the Dockerfile.

    docker build -t cpanel_centos7 .
  4. Run the Docker Container: Run the Docker container from the image.

    docker run -d -p 2082:2082 -p 2083:2083 -p 2086:2086 -p 2087:2087 -p 2095:2095 -p 2096:2096 -p 2089:2089 -p 2090:2090 -p 110:110 -p 143:143 -p 465:465 -p 587:587 -p 993:993 -p 995:995 -p 20:20 -p 21:21 -p 22:22 -p 25:25 -p 53:53 -p 80:80 -p 443:443 -p 3306:3306 --name cpanel_container cpanel_centos7

    This command maps the necessary ports from the container to the host machine. Make sure to adjust the port mappings as needed.

Challenges:

  • Complexity: Dockerizing cPanel adds complexity to the setup and maintenance.
  • Resource Usage: Containers consume resources. Running a full cPanel installation within a container can be resource-intensive.
  • Security: Improperly configured containers can introduce security vulnerabilities.
  • cPanel Support: cPanel might not officially support running in Docker in this manner, which could limit support options.
  • Port Mapping: Ensure all necessary cPanel ports are correctly mapped between the container and the host machine.
  • Data Persistence: Properly configure Docker volumes for data persistence.

2. Virtualization with KVM or VirtualBox

Another alternative is to use a hypervisor like KVM (Kernel-based Virtual Machine) or VirtualBox to create a fully virtualized CentOS 7 environment. This approach provides greater isolation than Docker, but also requires more resources.

Explanation:

KVM and VirtualBox allow you to create a complete virtual machine running CentOS 7. Within this VM, you can install cPanel as if it were running on a dedicated server. This approach provides better isolation and compatibility compared to Docker, but consumes more resources because it emulates an entire operating system.

Steps (Example using KVM):

  1. Install KVM: Install KVM and the necessary tools on your newer Linux distribution.

    # Example for AlmaLinux 8/Rocky Linux 8
    sudo dnf install @virtualization
    sudo systemctl enable libvirtd
    sudo systemctl start libvirtd
  2. Create a Virtual Machine: Use virt-manager (a graphical tool) or the virsh command-line tool to create a new virtual machine. Select CentOS 7 as the operating system.

    • Graphical (virt-manager): Launch virt-manager and follow the wizard to create a new VM.
    • Command-line (virsh):

      # Example (adapt to your needs)
      virt-install 
      --name=cpanel_vm 
      --memory=4096 
      --vcpus=2 
      --os-variant=centos7.0 
      --location='http://mirror.centos.org/centos/7/os/x86_64/' 
      --disk size=20,bus=virtio 
      --network bridge=virbr0
  3. Install CentOS 7: During the VM creation, select a CentOS 7 installation source (e.g., an ISO image or a network location).

  4. Install cPanel: Once the CentOS 7 VM is running, log in and install cPanel as you normally would on a CentOS 7 server.

    # Example cPanel installation (replace with the correct script)
    cd /home
    wget http://httpupdate.cpanel.net/latest
    sh latest
  5. Configure Networking: Configure the network settings of the VM to allow access from the host machine and the internet. Bridged networking is often the easiest option.

Challenges:

  • Resource Intensive: Virtual machines consume significant resources (CPU, memory, disk space).
  • Complexity: Setting up and managing virtual machines requires some technical expertise.
  • Licensing: Ensure you have a cPanel license that is valid for use in a virtualized environment.

Code Example (virsh command):

The virsh command above is an example of creating a virtual machine using the command line. You’ll need to adapt it to your specific needs, including:

  • --name: The name of the virtual machine.
  • --memory: The amount of RAM allocated to the VM (in MB).
  • --vcpus: The number of virtual CPUs allocated to the VM.
  • --os-variant: The operating system variant (CentOS 7 in this case).
  • --location: The URL to the CentOS 7 installation media.
  • --disk: The size and type of the virtual disk.
  • --network: The network configuration (bridged networking in this example).

Disclaimer:

These alternative solutions are presented for informational purposes only. They may not be officially supported by cPanel, and implementing them requires technical expertise. Always back up your data before making any significant changes to your system. Migrating to a supported operating system is the recommended and most reliable solution for running cPanel. It is the best approach to Fix cPanel/WHM Installation on Red Hat 6 & 7.

Leave a Reply

Your email address will not be published. Required fields are marked *