How to setup cPanel on Amazon EC2 with Centos 6.4

I had a lot of problems setting up a cPanel server on Amazon EC2.

On my first attempt I used a CentOS image from the AWS marketplace but using one of these images has a very bad side effect of not being able to resize, clone, and/or mount the root file system to another instance ( think about the issues with data recovery or fixing an un-bootable ec2 instance – yuck ) – this is what dgFactor is referring to in his comment

My next attempt I had launched the instance but after it was launched cPanel would not install, giving errors similar to:

[20130131.123334]   Setting up Install Process
[20130131.123334]   No package wget available.
[20130131.123335]   Nothing to do
[20130131.123339] E Sysup: Needed system RPMs were not installed: wget
[20130131.123339] ***** FATAL: Cannot proceed. Needed system RPMs were not installed.
[20130131.123339]   The Administrator will be notified to review this output when this script completes
[20130131.123339] E Detected events which require user notification during updatenow. Will send iContact the log
=> Log closed Thu Jan 31 12:33:39 2013
[20130131.123339] E Running `/usr/local/cpanel/scripts/updatenow --upcp --log=/var/cpanel/updatelogs/update.1359657200.log` failed, exited with code 4608
=> Log closed Thu Jan 31 12:33:39 2013

What seems to have happened here is that the file system was full. Even though I had increased the default drive size from 5GB to 40GB when the system booted the additional space was unavailable:

How to setup cPanel on Amazon EC2 with Centos 6.4

This can be confirmed from SSH after connecting to the instance:

[[email protected] ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            5.0G  1.3G  3.4G  28% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
[[email protected] ~]# fdisk -l

Disk /dev/xvda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xeabcdefg

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1               1         652     5237158+  83  Linux
[[email protected] ~]#

Steps to setup cPanel on Amazon EC2 with Centos 6.4

  1. Pick a amazon machine image (ami) image from bashton’s blog – I used a HVM version as they allow selecting any flavor of instance and all of the ‘current generation’ instances
  2. After booting the instance, shut it down and then follow the steps from Wilman Arambillete’s answer with particular attention to the comment by Garreth McDaid regarding resize2fs

After completing these steps and switching your attached volumes so that the resized one is your primary (and only) drive mounted at /dev/sda1 things should be working well.

One thing I found odd was that CentOS seemed to boot to the secondary attached drive /dev/xvdf – but I’m not positive if it was actually booting to this drive or just showing as if it was the primary (root) drive. Nonetheless, the steps from Garreth seemed to get things working.

cPanel / WHM software installer

Now, to start the actual cPanel / WHM software installer script

sudo yum install screen wget -y

Once screen is installed, start a new session typing:

screen

That last step is important because if you don’t have screen running and your SSH session disconnects the installer may exit before cPanel setup has completed – and sometimes setup can take a few hours.

Use this this command to download the installer for cPanel with WHM:

wget -N http://httpupdate.cPanel.net/latest

Use this command to download the installer for DNS only version of cPanel:

wget -N http://httpupdate.cPanel.net/latest-dnsonly

After that script downloads, start

sh latest

You can find tips on how to use screen elsewhere so I won’t go into detail here, but to detach screen type: Ctrl-a-d which is done by holding Ctrl and pressing a then pressing d then releasing Ctrl

To reattach to your screen you can use the command:

screen -r

If you like screen you can also check out tmux but it is harder to get installed on CentOS 6 ( not installable with yum by default )

Related Posts:

This entry was posted in Linux, Server Administration and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *