So, you’ve decided to roll your own cPanel server.
Good decision. You can often save money and get things just the way you want them by installing cPanel from scratch. While I won’t go into the ins-and-outs of selecting a server or the minimum system requirements that cPanel has, I will give you a pretty good guide for installing cPanel on a brand-new server or VPS.
Here’s what you’ll need before you start:
1) A cPanel license. You can obtain one from buycpanel.com OR if you’re not ready to commit just yet, you can get a free 15-day trial license directly from cPanel. A VPS license will run you about $15 per month as of this writing; a dedicated license costs about $38 per month. You must have a license, even if it is only a trial license, before you install.
2) A Fresh, Clean CentOS install. CentOS isn’t the only Operating System that cPanel supports, but it is the one we’ll be using in this example and the one it seems like most people use. In any case, you must have a fresh, clean, just-out-of the-box install of whichever OS you choose. This means you should not have any other control panel or web services running on the machine at all. If you have a VPS, just go to your VPS control panel and choose to “reinstall” your OS, then choose CentOS from the list of available operating systems; in just minutes, you’ll be left with a squeaky-clean fresh install.
3) About 3-4 hours. cPanel takes a long time to install, about 90 minutes on a minimal VPS for instance. Beyond that, you’ll need to spend some time setting up your new server, tweaking settings, making sure things are loaded that you need, installing addons or additional programs you might need, etc. Plan to have about 3-4 hours of uninterrupted time.
And that’s about it! Now, once you’ve got those three things, you can proceed to the install. This is actually really easy:
1. Log in to your fresh, clean server install via SSH as root.
2. Now, let’s install screen in case we get disconnected (I’ll be posting more about screen in a later article, for now, just trust me):
yum -y install screen
3. Now, let’s install rdate to avoid a nasty little error later on some VPS servers (this won’t actually fix the underlying problem, but it will stop the error from showing up):
yum -y install rdate
4. We’ll also need Perl to install cPanel and nano to edit some files, so let’s make sure we have them:
yum -y install perl nano
5. We need to set the hostname for cPanel to use. This is usually something like: nameofserver.mydomain.com, you’ll want it to have 3 sections (server.domain.ext):
a. nano /etc/sysconfig/network
b. Find the section that is labeled hostname and edit the entry to contain your hostname, or add it if it does not exist: HOSTNAME=”vps1.example.com”
c. save and exit the file
6. Now, just to be sure, let’s also set the hostname for this session by typing (all on one line):
7. Now, let’s run screen so that we can reconnect if needed. If your SSH session should get disconnected while you are installing cPanel (cPanel takes a LONG time to install), you can just SSH back in and type “screen -r” and you’ll be magically reconnected to your installation session:
8. Now, run this command. You may just get a bunch of errors; that’s fine and expected. This is just making sure your server is ready for a clean cPanel install (this should all be on one line):
yum -y groupremove "FTP Server" "KDE (K Desktop Environment)" "Mail Sever" "Mono" "Web Server" "X Window System" "GNOME Desktop Environment"
9. Let’s change to our home directory
10. And now, let’s get the cPanel install script. This is a really fast download:
wget -N http://httpupdate.cpanel.net/latest
11. Now comes the long part. After you give this next command, sit back, have a cup of coffee, go do a crossword, do your laundry, whatever. cPanel will begin to install and this can take 60-90 minutes on even a decent VPS (my test run on a 512MB/2-Ghz VPS took about 90 minutes and about 75 minutes on a 1024MB/shared-8-core VPS):
12. REALLY – GO DO SOMETHING ELSE. Trust me, this will take a while…if everything is set up cleanly and correctly, cPanel will begin filling the screen rapidly with commands and gobbledygook. This is good. This is normal. Now go away for a while, this will take a long time. NOTE: You might see some scary messages fly by on screen if you sit around and watch the install. Things like “could not find…” or “…is disabled…” or “no process killed”. Unless the installation fails, you can safely ignore these messages. Most of them are not generated by the install per se, but by programs that the install is running; this has never caused a problem for me. Also, there are a few times when it will appear like NOTHING is happening. Do not panic and for godssake, do not interrupt the installer! This is normal and expected. Remember, even on a very fast machine, cPanel can take over an hour to install!
13. When the install is done, go to your web browser and browse to (insert your server’s ip address):
14. Log in with user name root and with your normal root password (the one that you would normally log in to SSH with).
15. A short web-based installation walk-through script will follow (you’ll confirm your host’s name, confirm your IP addresses, add DNS entries for the host, choose your DNS resolver, etc). Choose your answers carefully (but you can always change them later). cPanel will then finish installation and you’ll be ready to tweak your cPanel server to your heart’s content! You’ll probably want to install a good firewall product (like csf), and I’ll actually be covering this awesome, free firewall in an upcoming post.