Down to business, I have been searching for a quick tutorial on how to do this and it has not been easy, though the solution is in-fact quite simple. I will keep this as simple as possible and brief, and add on it as the days go by and suggestions come in.
I am going to also include the instructions from the cPanel installation guide.
Ready? OK!
In this TUT we will be using SoluVM and CentOS 6 64bit. Feel free to use what you like, but for the purposes of writing this, this is what I am using.
1. Create your VM with your CentOS version chosen.
2. SSH into your VM.
3. Run the following commands to remove GroupServices that will not be needed:
yum grouplist
4. Remove the following if they appear in your grouplist:
yum groupremove "Mono" "Mail Server"
5. Edit /etc/selinux/config from the command line and set the SELINUX parameter to disabled using a text editor, such as nano or vi. Nano I find is the easiest text editor for linux, the command that you would use would be:
nano /etc/selinux/config
If it comes up empty you are good to go. If you do not have nano installed just do a:
yum install nano
(Most pre-made CentOS templates from OpenVZ come with SELINUX not installed/already disabled. But it is always a safe bet to double check as cPanel will not run with it enabled.)
6. We now need to disable the default firewall and check for updates: (Enter Y to confirm Updates)
chkconfig iptables off
service iptables stop
yum update
7. Now lets verify the TMP directory permissions:
stat /tmp
Should Output:
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
If it doesn't, run this:
chmod 1777 /tmp
8. Now let's install cPanel/WHM. For this TUT we will grab the lastest FULL/VPS installation:
cd /home
wget -N http://httpupdate.cpanel.net/latest
sh latest
9. Now we wait while it runs!
10. Still waiting...I know, it takes a while...Fast forward to Step 11!
11. Install your firewall and other add-ons you wish to include in your OS Template. Be sure not to include anything directly related to your Temporary VM's hostname or IP, as these settings will be different every time you use this template.
12. Ok, so cPanel is installed and you are able to access WHM (if you do not know how to, visit: https://YOURSERVERIP:2087)
-Now that you are in WHM you have come up to the Setup Wizard. Change the fields for the contact email and hostname to some random chars such as ([email protected]). Do NOT use your email, or your clients will see it everytime!
Now that you have gone through WHM and customized everything, maybe installed Softaculous or other add-ons. It is now time to reset the box and create your Template.
13. Open an SSH to your VM, and type the following:
ls -alh /etc/.whostmgrft
-rw-r--r-- 1 root root 0 Feb 1 08:07 /etc/.whostmgrft
rm -rf /etc/.whostmgrft
What this does is resets the initial setup wizard. It is a 0-byte file that is created when you first log into WHM. If you remove this file, the setup will run again the next time a User logs into WHM. It isn't the perfect way of doing it...BUT IT WORKS!
14. Log into your SolusVM Master and shutdown the VM you just setup.
15. Inside the VM details in SolusVM you will see a "Create Template" button. Push This Button!
16. Give your template a filename, then hit the Create Template Button, and away she goes!
Please Note:
Sometimes the Create Template feature messes up and doesn't fully create the template. You can tell if this has happened by viewing the VZ/Template/Cache folder on your node. If you do not see your newly created template in there after an hour of the system notification of it starting, then it more than likely broke and you need to rerun the Create Template function again.
For a basic Template with cPanel installed (depending on node power and how packed it is) it should only take a few minutes to pack it all up and be done.
This TUT is just one way of doing it. It probably isn't the best way, but it will reset the hostname, IP and other basic config settings allowing you to update, optimize and secure WHM for your clients without having to worry about hostname conflicts and what not.
Hope it helps, and don't cry to me if you break something lol j/k Will help where I can!
I am going to also include the instructions from the cPanel installation guide.
Ready? OK!
In this TUT we will be using SoluVM and CentOS 6 64bit. Feel free to use what you like, but for the purposes of writing this, this is what I am using.
1. Create your VM with your CentOS version chosen.
2. SSH into your VM.
3. Run the following commands to remove GroupServices that will not be needed:
yum grouplist
4. Remove the following if they appear in your grouplist:
- FTP Server
- GNOME Desktop Environment
- KDE (K Desktop Environment)
- Mail Server or E-mail Server
- Mono
- Web Server
- X Window System
yum groupremove "Mono" "Mail Server"
5. Edit /etc/selinux/config from the command line and set the SELINUX parameter to disabled using a text editor, such as nano or vi. Nano I find is the easiest text editor for linux, the command that you would use would be:
nano /etc/selinux/config
If it comes up empty you are good to go. If you do not have nano installed just do a:
yum install nano
(Most pre-made CentOS templates from OpenVZ come with SELINUX not installed/already disabled. But it is always a safe bet to double check as cPanel will not run with it enabled.)
6. We now need to disable the default firewall and check for updates: (Enter Y to confirm Updates)
chkconfig iptables off
service iptables stop
yum update
7. Now lets verify the TMP directory permissions:
stat /tmp
Should Output:
Access: (1777/drwxrwxrwt) Uid: ( 0/ root) Gid: ( 0/ root)
If it doesn't, run this:
chmod 1777 /tmp
8. Now let's install cPanel/WHM. For this TUT we will grab the lastest FULL/VPS installation:
cd /home
wget -N http://httpupdate.cpanel.net/latest
sh latest
9. Now we wait while it runs!
10. Still waiting...I know, it takes a while...Fast forward to Step 11!
11. Install your firewall and other add-ons you wish to include in your OS Template. Be sure not to include anything directly related to your Temporary VM's hostname or IP, as these settings will be different every time you use this template.
12. Ok, so cPanel is installed and you are able to access WHM (if you do not know how to, visit: https://YOURSERVERIP:2087)
-Now that you are in WHM you have come up to the Setup Wizard. Change the fields for the contact email and hostname to some random chars such as ([email protected]). Do NOT use your email, or your clients will see it everytime!
Now that you have gone through WHM and customized everything, maybe installed Softaculous or other add-ons. It is now time to reset the box and create your Template.
13. Open an SSH to your VM, and type the following:
ls -alh /etc/.whostmgrft
-rw-r--r-- 1 root root 0 Feb 1 08:07 /etc/.whostmgrft
rm -rf /etc/.whostmgrft
What this does is resets the initial setup wizard. It is a 0-byte file that is created when you first log into WHM. If you remove this file, the setup will run again the next time a User logs into WHM. It isn't the perfect way of doing it...BUT IT WORKS!
14. Log into your SolusVM Master and shutdown the VM you just setup.
15. Inside the VM details in SolusVM you will see a "Create Template" button. Push This Button!
16. Give your template a filename, then hit the Create Template Button, and away she goes!
Please Note:
Sometimes the Create Template feature messes up and doesn't fully create the template. You can tell if this has happened by viewing the VZ/Template/Cache folder on your node. If you do not see your newly created template in there after an hour of the system notification of it starting, then it more than likely broke and you need to rerun the Create Template function again.
For a basic Template with cPanel installed (depending on node power and how packed it is) it should only take a few minutes to pack it all up and be done.
This TUT is just one way of doing it. It probably isn't the best way, but it will reset the hostname, IP and other basic config settings allowing you to update, optimize and secure WHM for your clients without having to worry about hostname conflicts and what not.
Hope it helps, and don't cry to me if you break something lol j/k Will help where I can!