🚀 2025 Updated cPanel Installation & Optimization Guide (Free)
cPanel is one of the most widely used web hosting control panels on Linux servers thanks to its clean UI and powerful controls. It lets you easily manage websites, emails, databases, and server resources, making it a top choice for individuals, agencies, and hosting providers.In this guide, we’ll walk through the up-to-date 2025 cPanel installation and essential performance/security optimizations step by step. Our goal is a clear, detailed walkthrough—especially for users who want faster servers and less wasted resources.
🛠️ Step 1: Server Update Guide
Before installing cPanel, start with a fresh server running Ubuntu, AlmaLinux, or CloudLinux. Because cPanel installation is not reversible, it’s recommended to install only on a clean server.Make sure to apply all system updates first. Use the commands below to update your system, then proceed with cPanel installation.
For AlmaLinux and CloudLinux, run:
Code:
dnf update -y && dnf upgrade -y && dnf autoremove -y && dnf -y install wget && dnf -y install nano && dnf -y install curl && dnf -y install epel-release && dnf -y install screen
For Ubuntu, run:
Code:
apt update -y && apt upgrade -y && apt autoremove -y && apt -y install wget && apt -y install nano && apt -y install curl
⚠️ When prompted during these commands, answer Yes to proceed.
🛠️ Step 2: Choose Your MariaDB Version
Before starting cPanel installation, decide on the database version. This ensures the installer configures your chosen MariaDB automatically.As of 2025, we recommend stable MariaDB 10.11. Do the following:
🔧 Create the folder and file:
Code:
1- mkdir /root/cpanel_profile
2- nano /root/cpanel_profile/cpanel.config
📝 Then add this line into the file:
Bash:
mysql-version=10.11
This makes the cPanel installer automatically configure MariaDB 10.11.
🛠️ Step 3: cPanel Installation Guide
Installing cPanel is straightforward, but take care to complete each step. We’ll download the installer from cPanel’s official servers and start the setup.Because components are downloaded online, installation can take ~20–60 minutes depending on server speed and connectivity. During this time, wait for completion without interruption.
🔧 Command to start installation:
Bash:
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
When the installation finishes, you can access the cPanel/WHM interface. In the next step we’ll do initial configuration.
🛠️ Step 4: cPanel Trial Licensing
Because cPanel is paid software, you must license it after installation. In this guide we’ll use a trial license, which lets you test all features briefly for free.Once installation completes, open your browser and log in with root username and password at:
https://YOUR-IP:2087 Follow the on-screen steps to request and activate a trial license.
📩 You’ll need an active email address to get the trial license. You can use a personal email. Keep in mind:
➡️ If your IP has previously used a trial license, you can’t get another trial on that IP.
You may need your cloud provider to assign a fresh IP that hasn’t used a cPanel trial.
✅ After licensing, you can fully use the WHM/cPanel interface.
🛠️ Step 5: Install CloudLinux (with Trial License)
For improved stability, security, and isolation on cPanel, CloudLinux is highly recommended. We’ll install it using a trial license. You can later switch to a paid license.💡 What does CloudLinux provide?
- Enables SelectPHP (multiple PHP versions per account).
- Lets you set per-account limits for CPU, RAM, inodes, etc.
- Provides CageFS isolation so malware in one site can’t jump to others.
- Adds security—especially if you often handle risky assets (warez/cracked themes/plugins).
⚠️ You can skip this step, but CloudLinux is strongly recommended for security and resource control.
✅ Get a CloudLinux Trial Key
Request your trial activation key here: 🔗 https://cloudlinux.com/trial-shared-pro/After receiving the key by email, run the following on your server via SSH:
Bash:
1- wget https://repo.cloudlinux.com/cloudlinux/sources/cln/cldeploy
2- bash cldeploy -k ACTIVATION_KEY
📌 Replace ACTIVATION_KEY with the license key sent to your email. Example: bash cldeploy -k CLP-25u1oH3YEzBSsou0gatn5nzO
⚠️ Depending on server speed and connectivity, this step may take ~20–60 minutes.
After CloudLinux installs, reboot the server so changes fully apply. We recommend:
Bash:
shutdown -r now
🔄 This gracefully stops services and reboots, reducing potential issues.
When the server is back, complete activation in WHM: go to
https://YOUR-IP:2087 and log in as root.In WHM:
- Go to Server Configuration > CloudLinux Manager, or
- Search CloudLinux Manager from the top-left search box.
- Click “Start Wizard”.
Once done, define default CPU, RAM, I/O, and INODES limits for all accounts—or set custom limits per domain for fair resource sharing.
🛡️ Step 6: Install Imunify360 (Trial)
To protect your cPanel server from malware and attacks, Imunify360 is a powerful solution. We’ll use a trial license.🔗 Get a trial key at https://trial4.imunify360.com/. Then run:
Bash:
1- wget https://repo.imunify360.cloudlinux.com/defence360/i360deploy.sh
2- bash i360deploy.sh --key YOUR_KEY
After installation, Imunify360 appears in WHM. You can run scans, view threats, and configure advanced security.📌 Replace YOUR_KEY with your trial activation key. Example: bash i360deploy.sh --key IMUNNOq5HD9uO8xWGI6
⚠️ Depending on server speed and connectivity, installation may take ~20–60 minutes.
⚡ Step 7: LiteSpeed Web Server Installation (Trial)
For faster page loads and better resource efficiency, consider replacing Apache with LiteSpeed Web Server. It delivers major performance gains, especially for WordPress, forums, and e-commerce.LiteSpeed integrates with WHM and supports most Apache configs out of the box.
🔧 Run these SSH commands to install:
Bash:
1- cd /usr/src
2- wget http://www.litespeedtech.com/packages/cpanel/lsws_whm_plugin_install.sh
3- sh ./lsws_whm_plugin_install.sh
4- rm -f lsws_whm_plugin_install.sh
Then in WHM, open “LiteSpeed Web Server” from the left menu and follow the wizard to activate a Trial license.
⚡Load the Ready-Made LiteSpeed Config After Installation
For performance and compatibility, upload our pre-tuned config file:- Connect via SFTP (e.g., FileZilla).
- Go to
/usr/local/lsws/conf. - Replace
httpd_config.xmlwith the provided ready config. - Then restart the LiteSpeed service.
After that, enter WHM as root and finalize LiteSpeed activation/config.
⚠️ The ruid2 module warning will disappear after later steps—no action needed now.
🛡️ Step 8: ModSecurity Installation & Configuration
To harden security for your server and hosted sites, we’ll install and configure ModSecurity. We’ll also add the ConfigServer module so you can toggle ModSecurity per domain.Run these commands in the terminal:
Bash:
1- cd /usr/src
2- rm -fv /usr/src/cmc.tgz
3- wget http://download.configserver.com/cmc.tgz
4- tar -xzf cmc.tgz
5- cd cmc
6- sh install.sh
7- rm -Rfv /usr/src/cmc*
In WHM, search modsec and open ModSecurity™ Vendors. Enable any missing rule sets.
To temporarily disable rules per domain, search ConfigServer ModSecurity Control in WHM.
🔒 Step 9: EasyApache 4 Configuration
EasyApache 4 manages web stack components and PHP versions/modules. Choose which PHP versions and modules to use here.We provide a pre-made configuration for a smooth setup. Log into WHM as root, search EasyApache 4, open it, upload our config, and apply.
This installs required PHP versions/modules so your sites have a complete runtime.
⚠️ This usually takes 5–10 minutes. No extra steps are needed afterward.
🛡️ Step 10: Configure disable_functions
For security, disable risky PHP functions to reduce the impact of malicious scripts.Log into WHM as root, search MultiPHP INI Editor, click it, then open Editor Mode. Find disable_functions and configure your list.
⚠️ Repeat this for every PHP version installed on your server.
🛠️ Step 11: Load the General cPanel Configuration File
Default cPanel settings may not be optimal. Replace them with our pre-tuned config for better performance and security.Connect via SFTP, then:
📁 Path:
/var/cpanel/ Replace the existing
cpanel.config with our prepared file. Then apply changes by running:
Bash:
/scripts/restartsrv_cpsrvd
✅ This restarts cPanel services so your settings take effect. Log into WHM and verify everything loaded correctly.
✅ That’s it! Your cPanel installation and optimization are complete. Your panel is now faster, more secure, and tailored to your needs. If you run into any issues, feel free to reach out!