How To Install & Fully Configure cPanel/WHM On AlmaLinux 8 & 9
In this tutorial, I will show you step-by-step instructions on installing cPanel/WHM on your VPS or VDS server. cPanel is the most easy hosting control panel. cPanel has millions of users worldwide.
Before installing cPanel on the VPS, we need to configure the server or prepare the server for perfect cPanel installation.
1. Run this command to check any firewall rule on your server
iptables-save > ~/firewall.rules
2. Now, run this command to stop all firewall rules on the server
systemctl stop firewall.service
3. Now, run this command to disable all firewall rules on the server
systemctl disable firewall.service
4. Run this command to update your OS
sudo dnf update
5. We must disable SELINUX on the server to run cPanel/WHM properly. To disable SELINUX run this command
vi /etc/selinux/config
After you run the command a file will open on the server and you need to change the text on the file. You will see a line SELINUX=permassive, you need to change it to SELINUX=disabled.
After you make the change, press ESC, write “:wq” and press Enter to return to the main page to run the next commands.
7. Now, we need to install PERL on the server. cPanel can not work without PERL. To install PERL please run this command.
sudo dnf install perl
8. We need to change the default Hostname of the server to an FQDM (Fully Qualified Domain Name)
It helps your email sending and email score. Otherwise, your emails sent from this server will count as SPAM. There are many other reasons to change the hostname of the server. To change the hostname run these commands:
sudo hostnamectl set-hostname server.yourdomain.com
Now open the hostname file:
sudo vi /etc/hosts
You will see the “127.0.0.1 localhost old.hostname.com” line in the file. Edit the file and replace the old hostname with your hostname. To make changes follow the previous editing steps as we have done when changing SELINUX file.
9. Let’s install Screen on your server for an errorless cpanel installation. To install it run the below commands:
dnf install epel-release
dnf install screen
10. We have done the pre-installation configuration. Now, reboot your server from the command line to from server control panel.
After the reboot is complete, log in to the server again and run the screen command to start a screen for cPanel installation:
screen
11. Start the cPanel installation process.
To start cPanel installation, run this command or if you have any other command line that is provided by your license provider you can run that.
You can buy a cheap cPanel license from CloudWave. To buy click here.
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
Now, wait for 20-30 minutes to complete the installation. In some cases, it can take longer.
After Installation Configuration and Process
1. Search Resolver Configuration.
- Set Resolver “8.8.8.8” & “1.1.1.1” & “8.8.4.4”
2. Search Nameserver Selection.
- Select PowerDNS & Click Save
3. Search FTP.
- Select Pure-FTPd & Click Save.
4. Search cphulk.
- Enable cPHulk. Do some basic configuration.
5. Search Update Preferences
- Select Stable and turn off Automatic Update
6. Search Basic WebHost Manager.
- Do all configuration and Nameservers.
7. Search Server Time
- Set the server time.
8. Search Tweak Settings
- Go to Compression, set gzip to 8
- Go to PHP, enable ionCube loader, source gurdian.
- Go to Mail and configure mail settings.
- Go to Domain, Allow all option. Not the Remote Domains.
9. Search Compiler Access.
- Disable Compilers.
10. Search Configure Security policies.
- Set password strength 80
- Select Password Strength & Password Age 90 Days.
11. Search Security Questions.
- Set security questions for root password recovery.
12. Search Shell fork bomb
- Enable Protection.
13. Search SMTP Restriction.
- Disable it.
14. Search Greylisting.
- Enable Grey Listing.
15. Search Background Process Killing.
- Select all processes and click save.
16. Search Auto SSL.
- Select Lets Encrypt. Recreate all SSL. Do simple configuration.
17. Search EasyApache4.
- Select All PHP option + ZendGuard > Customize.
- Enable mod_mpm_prefork > Next
- Enable Apache Module mod_suexec, authnz_idap, bwlimited, cgi, deflate, expires, header, suphp, ssl, unique_id
- Must Use php extensions: https://make.wordpress.org/hosting/handbook/server-environment/
- Disable Apache Module “mod-ruid2” (Very Important)
- Enable php extensions ioncude, libc client, pear, bcmath, calender, cli, common, curl, devel, exif, fileinfo, xml, runtime
18. Search multiphp ini
- Choose PHP version and enable 1st 2 options.
- Do basic configuration
- Go to Editor mode > search disable_functions > add “apache_child_terminate, apache_setenv, define_syslog_variables, escapeshellarg, escapeshellcmd, exec, fp, fput, ftp_connect, ftp_exec, ftp_get, ftp_login, ftp_nb_fput, ftp_put, ftp_raw, ftp_rawlist, highlight_file, ini_alter, ini_get_all, ini_restore, inject_code, mysql_pconnect, openlog, passthru, php_uname, phpAds_remoteInfo, phpAds_XmlRpc, phpAds_xmlrpcDecode, phpAds_xmlrpcEncode, popen, posix_getpwuid, posix_kill, posix_mkfifo, posix_setpgid, posix_setsid, posix_setuid, posix_setuid, posix_uname, proc_close, proc_get_status, proc_nice, proc_open, proc_terminate, shell_exec, syslog, system, xmlrpc_entity_decode”
19. Search Multiphp manager
- Go to php handlers > Choose suphp for all php versions
20. Search Manage Plugin
- Install ClamAV. Go to ClamAV settigns and choose all function and click save.
21. Search MariaDB Upgrade
- Select MySQL > Continue > Continue and Upgrade the Database from MySQL to MariaDB
22. Reboot the server.
23. Install All Other scripts/plugins (LiteSpeed, CloudLinux, Softaculas, Jetbackup, FleetSSL, Imunify, etc.)
24. ConfigServer Firewall Installation.
Go to Terminal and run these commands:
cd /usr/src
wget https://download.configserver.com/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh
25. Configure ConfigServer Firewall
- Go to ConfigServer > Scroll down > Firewall configuration > Turn Off Testing mode > Restrict Mode = 3
26. Installing Softaculas.
- Go to ConfigServer Firewall > CSF > Firewall Allow IPs > Add the following IPs > Save > Restart CSF+ifd
142.132.212.2 #api.softaculous.com
192.198.80.6 #s0.softaculous.com
158.69.6.246 #s1.softaculous.com
138.201.40.168 #s2.softaculous.com
213.239.208.58 #s3.softaculous.com
138.201.24.83 #s4.softaculous.com
148.251.137.79 #s5.softaculous.com
167.114.200.240 #s7.softaculous.com
46.250.225.249 #s8.softaculous.com
27. Change SSH Port Number
- Step::1 Login to PuTTy as root
- Step::2 Run the following command:
vi /etc/ssh/sshd_config
- Step::3 Now search for the Port and change it
- Step::4 Save the changes by typing :wq!
- Step::5 Now restart the SSH service by running the following command
service sshd reload
- Step::6 Now login to WHM as root
- Step::7 Navigate to the Plugins section
- Step::8 Go to ConfigServer Security & Firewall
- Step::9 Click on Firewall Configuration
- Step::10 Enter the same values in TCP_IN and TCP_OUT assigned via SSH(PuTTy)
- Step::11 After saving the changes click on Restart csf+lfd
28. Change cPanel Help, Contact, Documentation links