(866) 366-3640 - support@sagonet.com
Sago Logo
Banner

   
Log in / create account Page Discussion History Go to the site toolbox
CPanel Restore with NO BACKUPS

The following guide is shamelessly ripped from Pimpenstein's post at http://forums.theplanet.com/index.php?showtopic=38797, but updated for use with cpanel 11.


Edited Original Post

So your cpanel server got hacked or crashed? Lots of that going around these days. And if you didn't have cpanel backups of all your sites, then your only option is to copy from the old drive... heres the basics..

commands to be executed from root shell in code blocks

Order restore from hosting provider.

In trouble ticket specify to leave the old drive in

Once the restore is done, SSH in to box..

create a folder /old to mount the old drive

mkdir /old

mount the old / partition as old (on newer sata boxes almost always /dev/sdb3)

mount /dev/sdb3 /old
rsync -vrplogDtH /old/var/lib/mysql /var/lib
rsync -vrplogDtH /old/var/cpanel /var
rsync -vrplogDtH /old/usr/local/apache/conf /usr/local/apache
rsync -vrplogDtH /old/usr/local/apache/domlogs /usr/local/apache
rsync -vrplogDtH /old/usr/local/frontpage /usr/local
rsync -vrplogDtH /old/var/named /var
rsync -vrplogDtH /old/var/ssl /var
rsync -vrplogDtH /old/var/spool/cron /var/spool
rsync -vrplogDtH /old/usr/share/ssl /usr/share
rsync -vrplogDtH /old/etc/vfilters /etc
rsync -vrplogDtH /old/etc/proftpd /etc
rsync -vrplogDtH /old/etc/vmail /etc
rsync -vrplogDtH /old/home/* /home
rsync -vrplogDtH /old/usr/local/cpanel /usr/local
rsync -vrplogDtH /old/usr/local/cpanel/3rdparty/mailman /usr/local/cpanel/3rdparty
rsync -vrplogDtH /old/var/log/bandwidth /var/log
rsync -vrplogDtH /old/root/.my.cnf /root
rsync -vrplogDtH /old/etc/httpd/conf/httpd.conf /etc/httpd/conf
rsync -vrplogDtH /old/etc/sysconfig/network /etc/sysconfig

then change to the old etc, and execute all on one line ...

cd /old/etc
rsync -vrplogDtH secondarymx domainalias valiases vfilters exim* proftpd* pure-ftpd* passwd* group* *domain* *named* wwwacct.conf cpupdate.conf quota.conf shadow* *rndc* ips* ipaddrpool* ssl hosts userdomains trueuserdomains trueuserowners nameserverips cpupdate.conf demousers localaliases /etc

well I hope I got everything... after you move all that stuff you will find yourself fixing up little things here and there....

If your server has more than 1 ip, cpanel doesnt bind to more than 1 unless the service is started, and configured to run at startup. Also restart cpanel, mysql, apache

service ipaliases start
chkconfig --levels 345 ipaliases on
/scripts/restartsrv_apache
/scripts/restartsrv_named
/scripts/restartsrv_mysql
/scripts/restartsrv_exim

Update Cpanel etc

/scripts/upcp
/scripts/fixeverything
/scripts/easyapache

update kernel to latest (plenty of howto's on the forums) mount /tmp as noexec (and symlink /var/tmp to /tmp)

End of Original Post

Hope this comes in useful for someone else, and thanks again to Pimpenstein for writing the original post.


Disclaimer: The instructions on this thread were used to sucessfully restore a crashed CentOS 4.5 / Cpanel 11 system with the old hard disk as /dev/sdb3 - no hardware/ip changes etc. If you do not understand the instructions dont go blaming anyone if you break your system.

Copied from http://forums.cpanel.net/showthread.php?t=71394