Microsoft Azure is a growing cloud solutions provider that is being used more and more in the expanding universe of web hosting. cPanel is determined to stay ahead of the game by ensuring that Azure users are able to use cPanel & WHM to power their instances and make the best hosting platform we can.
This step by step tutorial will help you install cPanel & WHM on Microsoft Azure for the first time.
For new users who have not dabbled into Azure, you can create a free account and use their services for a testing period. You can signup by going to signup.azure.com. The testing period will give you a $200 credit that you can use for 30 days.
Please keep in mind that Microsoft requires verification via a phone number, email address, and a valid credit card when creating an account. After you have verified the information, you will be taken to the main dashboard where you can create and manage your instances.
(For quick reference, you can access this same dashboard by going to portal.azure.com)
Step One: Getting Started and Selecting an Operating System
To get started, please refer to the set of options that are on your left side panel. At the top of this list, there is a “New” option next to a “+” sign. Click this option.
After doing so, a new box will display with suggestions as to machines and images of machines to deploy. We are going to use the top search box to search for “CentOS 7.” Please refer to the screenshots for additional guidance.
When it comes to CentOS 7, there are not many options. For the easiest installation, we are going to go with a simple CentOS 7 image.
The reason for this is because the cPanel & WHM installation will include all necessary software that the server needs to function properly and securely. When selecting this image, a new display box will appear. It will provide quick information on the instance. At the bottom, you can click “Create” to continue to the next step for the server setup.
Step Two: Server Customization
Next you will see a new box come up with several fields that you will need to fill. The server creation wizard does a great job of explaining each step, but you will be asked to name the server, pick the disk type, as well as create a server username and password. (You also have the option to provide an SSH key which would need to be generated on your personal workspace and then pasted into this box.)
In this next section you will need to select the server specifications of your Azure instance. You can select whatever server best suits your needs as long as the server meets our system requirements, which you can find here: https://go.cpanel.net/whmrequirements.
Step Three: Connecting to the Server and Installing cPanel & WHM
After finishing the setup of the instance, the Azure virtual machine will display on your main dashboard. You can then click on the instance to see more information. Once here, you can see all data regarding usage, other diagnostics, and configurations regarding the machine.
After you have clicked on the instance from the above dashboard, you will need to click “Connect” in the top toolbar. At this time you will be given the command you need to run to connect to the instance. Place this command in your terminal or Putty.
You would use the username you established when the server was created. After running this command, you will be asked to use the password you created.
If you chose to use an SSH key, you can connect to the server by using the below commands:
ssh -i /Users/username/.ssh/yoursshkey [email protected] Enter passphrase for key '/Users/username/.ssh/yoursshkey':
Once you sign into the server, you are going to need to assume the role of ‘root.’ Root is the highest level of user on the server. This is required to proceed with the installation of cPanel. To change yourself to root, run the following command.
You are now root. In order to ensure that you can access WHM as root, you now need to establish the root password. To do this, please run the following command:
(You will be asked to enter the new password twice.)
The next step is to run a yum update. This will update all of the server’s essential software and tools. To run the update, use the command:
yum update -y
* The ‘-y’ option simply tells the yum update to not ask for a confirmation before proceeding *
The yum update will take a few moments depending on the server’s connection to the internet. After the update is complete, you will need to change the hostname of the server. To do this, run the command below:
hostname newhostname.server.com hostname #you can run this to confirm the hostname did change.
The final step before we can begin the cPanel installation is to disable the Network Manager service of the server. To do so, please run the commands below:
systemctl stop NetworkManager.service systemctl disable NetworkManager.service
Finally, we are ready to run the cPanel installation script. The script can be found here, go.cpanel.net/installwhm/, as well as below:
cd /home && curl -o latest -L https://securedownloads.cpanel.net/latest && sh latest
Step Four: Manage Firewall Preferences and Open Ports for cPanel & WHM
cPanel & WHM will be accessible once the installation is finished. In order to access the ports that the cPanel and WHM interfaces use, we will need to make changes to the Azure instance’s firewall preferences. This can be done by going to your Azure dashboard and then on the left-hand side, clicking on the “Networking” tab.
From this page, we are going to need to add an inbound port rule and an outbound port rule. We can start by clicking on “Add Inbound Port Rule,” and a new box will appear. In this box you will be asked to fill 4 fields which I will explain below:
- Service: This is simply to specify what the rule is for. Since all of these ports are related to cPanel services, I left them as “Custom.”
- Port Ranges: Here is where you will need to specify the port. You can also do a range of ports by using a hyphen ( – ) between the ports. For this, we are going to use ports 2080-2099. Also, you can use an asterisk ( * ) to specify any port.
- Priority: This will report to the server what rules are more important than others. The lower the number, the higher the priority of the rule.
- Port Name: You can specify this as whatever you would like. I named this “cPanel & WHM” as these ports are for the cPanel & WHM interfaces.
You can then save this rule and do the same thing for the outbound port rules. If you would like to know of other possible ports to make adjustments for, you can find our documentation on firewall configuration here. Once this is completed, you can access WHM by going to https://your.servers.IP.here:2087/
We want to thank you for considering cPanel for your hosting automation needs! We hope that this guide can help you get started in Azure as quickly as possible. If you have any concerns or questions, please do not hesitate to contact our support team by going to tickets.cpanel.net.