How to restore cPanel on your dedicated server!


2 Feb 2004
I offered in the frontpage team to come up with some hosting targeted guides, so here's one I worked with on one of the customers of the datacentre I work at here in London.

This will help you out in a number of ways.

If your server has been hacked (very likely with the current favourite combo of Centos 4.4/cPanel neither of which are very good with security updates and running current patched builds).

Your disk failed and ext3 keeps locking the machine up.

I will assume you either have no backup, or an out of date backup or some critical work was recently performed.

You will see alot of the so-called "third party managment" companies offering this service for around $50 a pop. Now based on what I have seen of the abilities of the so called "leaders" of this industry I think a newborn would stand a strong chance of doing a better job so be careful if you have a dedicated server and you are looking for a third party to assist with the day to day operations of your server.

Most datacentres will do day to day managment for you but you are looking at a price at least 3 times higher than when left to fend for yourself.

Any way on to the guide.

You will need your datacentre to clean install your OS and cpanel on a new disk and install the original as a second disk (if you already have an additional disk they can remove it as you can repurpose your existing disk after following through with this.)

If you are doing this as a result of a disk failure and the filesystem was ext3, you should mount the partition as ext2 to avoid having the ext3 journal code triggereing a kernel panic and killing the machine.

The rest is just simple copy and paste (check man pages on commands for a detailed explanation of the options, for this guide I will simply say that the commands perform a recursive copy, overwriting existing files, maintaining permissions and ownership while forcing a yes reply to all "are you sure" prompts) :)

First backup existing data

cp -Rfpv --reply=yes /etc /etc_backup
cp -Rfpv --reply=yes /home /home_backup
cp -Rfpv --reply=yes /var /var_backup
cp -Rfpv --reply=yes /usr/share/ssl /usr/share/ssl_backup
cp -Rfpv --reply=yes /usr/local/apache /usr/local/apache_backup
cp -Rfpv --reply=yes /usr/local/cpanel /usr/local/cpanel_backup
cp -Rfpv --reply=yes /usr/local/cpanel-rollback /usr/local/cpanel-rollback_backup

Now restore cpanel. /old_disk/ is assumed to be where to old disk is mounted adapt accordingly

cp -Rfpv --reply=yes /old_disk/etc /
cp -Rfpv --reply=yes /old_disk/home /
cp -Rfpv --reply=yes /old_disk/var /
cp -Rfpv --reply=yes /old_disk/usr/share/ssl /usr/share/
cp -Rfpv --reply=yes /old_disk/usrlocal/apache /usr/local/
cp -Rfpv --reply=yes /old_disk/usr/local/cpanel /usr/local/
cp -Rfpv --reply=yes /old_disk/usr/local/cpanel-rollback /usr/local/

Check that /usr/local/apache/conf/httpd.conf has all the virtual hosts listed. If not run the following:
/scripts/rebuildhttpdconf >> /usr/local/apache/conf/httpd.conf
Then do the following:

/scripts/upcp --force
/etc/init.d/ipaliases restart
Login to whm and rebuild apache.

Check everything works

You have now saved yourself $50 or you can pay me $50 to perform the same copy and paste job that you can :D
Last edited:


Electronica Addict
Political Access
3 Feb 2002
Great start Mark :D

I'm sure there are many people that there that will find this very useful.


2 Feb 2004
Glued for easy access in the event the frontpage gets its guides section :p

Members online

No members online now.

Latest profile posts

Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.
Terrahertz wrote on Electronic Punk's profile.
Yo fellas!
Electronic Punk wrote on Sazar's profile.
Where are you buddy?
Perris Calderon wrote on Electronic Punk's profile.
Hey EP! All good with me, applying for Microsoft MVP right now, should have done this a while ago.

Notifications don't work, I only found your response by coming back to hunt up some threads, if you want, give me your email address so we can keep in touch easier!
Perris Calderon wrote on Electronic Punk's profile.
EP, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there!

Forum statistics

Latest member