We do a lot of cPanel OpenVZ installs on a SolusVM VPS cluster. This can take a long time to do when you factor in having to install cPanel on each and every one of them. I figured the needs to be an easier way to do this, and there is. Simply install cpanel on a VZ, then create a template, so that you have cPanel installed everytime you create a VZ automatically.
To do this, use the following steps:
- Create a new Virtual Server in your SolusVM. For this example, I used CentOS 6, 64 Bit
- SSH to your new Virtual Server, and run these commands. (These will change to the /root folder, download the latest install script from cPanel, set the script to executable, and then run the script)
- cd /root
- wget https://securedownloads.cpanel.net/latest
- chmod 755 latest
- ./latest
- Once cPanel is installed, install any plugins you want, such as CSF (configserver Firewall) or CMQ (configserver Mail Queue).
- Once cPanel and your plugins have all been installed, go back to SolusVM admin panel, and shutdown the new Virtual Server.
- Go into the settings of the Virtual Server in SolusVM admin panel, and click on the button called Create Template
- Give the template a new name and click on the create template button.
The last step will create a tar file in /vz/template/cache on the hardware node that you had the virtual server setup on. Once it has completed packaging the template, it will send a message to the system log in SolusVM Admin panel.
Now you need to add the template to SolusVM so it can be used.
- In SolusVM, click on the media tab, then click on Add OpenVZ Template.
- For Name, I used CentOS-6 64bit – cPanel
- For Description, I just put something like “This has cPanel installed already”
- In the Template dropdown, choose the new template that you just created
- Status should say Active
- Arch in this case would be x86_64 (this is for 64 Bit)
- Click on Add Template
Now that the template has been added to SolusVM, you need to copy this template to all your hardware nodes.
- In SolusVM, click on the media tab, then Media Sync
- Click on the create tab
- Under OpenVZ Templates, choose the new template in the first box, then choose the servers you want to copy to in the 2nd box. (ctrl+click to choose multiple servers)
- Scroll to the bottom and click on Create Sync Job
Once the sync has completed, it will list it as completed under the jobs tab.
Now whenever you go to create a new Virtual Server, when you get to the screen that asks what Operating System to use, simply choose the new template you created. This will create the new VPS with CentOS 6 64Bit, with cPanel installed on it. Then you just need to go to https://IP_ADDRESS:2087 to complete the configuration of the cPanel server.