• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

How to restore cPanel on your dedicated server!

#1
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
/scripts/fixeverything
/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:

Members online

No members online now.

Latest posts

Latest profile posts

Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,961
Messages
673,239
Members
89,014
Latest member
sanoravies