Step 1: Log in using SSH.
You must be logged in via SSH as sudo or root user.
Step 2: Installing cPanel.
Run this command:- cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest.
Step 3: Logging into cPanel.
After the installation, you will get a link that will look like: cpanel.example.com:2087. Copy and paste it in your preferred browser. Now all you have to do is log in with your login credentials.
Step 4: Set up SMTP relay.
a) Go to https://x.x.x.x:2087 (replace x.x.x.x with the IP address of your server).
b) Within WHM navigate to: Main > Service Configuration > Exim Configuration Editor, in the Basic Editor search for “SPF include hosts for all domains on this system” and change the setting from “None” to `_spf.smtprelay.snel.com`. Click on “Save” at the bottom.
c) On the same page (Main > Service Configuration > Exim Configuration Editor), click on the Advanced Editor button and search on the page for “Section: POSTMAILCOUNT” and add the following:-
d) On the same page search for “Section: ROUTERSTART” and add the following:-
Step 5: Save changes.
Click on the “Save” button on the bottom of the page to save changes and restart the mail server to apply the new configuration.
Conclusion
Congratulations, you have successfully installed cPanel on CentOS.