Thread: Backup?
View Single Post
  #3  
Old 27th December 2005, 22:31
ctroyp ctroyp is offline
Senior Member
 
Join Date: Sep 2005
Posts: 292
Thanks: 3
Thanked 2 Times in 1 Post
Default

Thanks falko!

Before I perform these steps:
Code:
This might give you an idea how to start:


Quote:
What is the best way to install an ISPConfig-Update?

Normally an ISPConfig-Update does not cause any problems. Since ISPConfig is installed on a multitude of different systems and because we have heard of sporadic problems with updates which we could not reproduce in spite of testing intensively, we publish some tips/hints here that should prevent a failed update to paralyse your system.

Please note: Placeholders are indicated by square brackets [ ].

1) First make a backup of your existing (working) ISPConfig installation:

Open a root shell (under Windows you can use PuTTY ( http://www.chiark.greenend.org.uk/~s.../download.html ) for this task).

cd /root/
tar -pczf root_ispconfig_old.tar.gz ispconfig/
cd /home/
tar -pczf home_admispconfig_old.tar.gz admispconfig/

If your MySQL database is protected by a password:

mysqldump -h [name of your server, e.g. localhost] -u [database user, e.g. root] -p[database password] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the ISPConfig database] > existing_db.sql (no space character between -p and password!)

Otherwise:

mysqldump -h [name of your server, e.g. localhost] -u [database user, e.g. root] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the ISPConfig database] > existing_db.sql

Save /etc/passwd, /etc/shadow and /etc/group.

Save /etc/init.d/ispconfig_server and (if existing) /etc/init.d/ispconfig_tcpserver.

You should transfer the files named above(existing_db.sql, /etc/passwd, /etc/shadow, /etc/group, /etc/init.d/ispconfig_server, /etc/init.d/ispconfig_tcpserver) to your workstation (e.g. with WinSCP: http://winscp.sourceforge.net/eng/ ).

2) Install the ISPConfig-Update (see here). Do not close your root shell immediately after the update (also do not close your WinSCP window)!

Open a second root shell and check if the root login still works! If it does not you can restore the root user in the root shell you have left open (e.g. by editing /etc/passwd and /etc/shadow or by playing back your backups of these two files via the open WinSCP window). Please take care that these files keep the same privileges as before!

3) Open the ISPConfig system in a browser and make a change (e.g. change a user's settings). After approx. 30 sec. you can check if the root login still works on the shell. If it does, you can undo the user settings change in the ISPConfig system and close all shells/WinSCP windows. Your ISPConfig update has been installed successfully!

4) If you realise with hindsight that the root login does not work on the shell you have the following possibilities to rescue your system (it is in no way necessary to format the system's hard disk and install a new system!):

4.1) If webmin ( http://www.webmin.com/ ) is installed as tar.gz (not rpm!), you can still login to webmin and fix the root user.

4.2) Boot your system from a Rescue-CD (e.g. http://sourceforge.net/projects/rescuecd/ ).

Login: root Password: rescue

Adjust your keyboard:

kbdmap

Mount the /-partition of your hard disk (mostly /dev/hda1):

mount -t [your filesystem, e.g. ext2|ext3|reiserfs|etc.] /dev/hda1 /mnt
chroot /mnt

Now you can find the passwd and shadow file under /etc and edit them in an editor (e.g. vi) or with programs like usermod. Repair your root user and reboot the system (do not forget ot remove the Rescue-CD from your CD-ROM):

shutdown -r now

4.3) If your server has a rescue mode (like the 1&1-Root-Server):

Boot your server into the rescue mode.

Mount the /-partition of your hard disk (mostly /dev/hda1):

mount -t [your filesystem, e.g. ext2|ext3|reiserfs|etc.] /dev/hda1 /mnt
chroot /mnt

Now you can find the passwd and shadow file under /etc and edit them in an editor (e.g. vi) or with programs like usermod. Repair your root user and reboot the system.

shutdown -r now

5) If you want to restore your old ISPConfig system, please do the following steps:

/etc/init.d/ispconfig_server stop
cd /root/
mv ispconfig/ ispconfig_new/
tar xvfz root_ispconfig_old.tar.gz
cd /home/
mv admispconfig/ admispconfig_new/
tar xvfz home_admispconfig_old.tar.gz

If your MySQL database is protected by a password:

mysql -h [name of your server, e.g. localhost] -u [database user, e.g. root] -p[database password] [name of the ISPConfig database] < existing_db.sql (no space character between -p and password!)

Otherwise:

mysql -h [name of your server, e.g. localhost] -u [database user, e.g. root] [name of the ISPConfig database] < existing_db.sql

Restore /etc/init.d/ispconfig_server (and /etc/init.d/ispconfig_tcpserver, where applicable) (e.g. by using WinSCP).

chmod 744 /etc/init.d/ispconfig_server
chmod 744 /etc/init.d/ispconfig_tcpserver (if existing)
/etc/init.d/ispconfig_server start  


BTW, I'd also backup the /etc folder, your Postfix configuration, your Apache configuration, the BIND configuration, ftp configuration and restore them on the new system.
I want to mention that I have already copied all of my directories from my hd to a remote (Windows) computer via WinSCP. I couldn't copy all of the files, but I got 99% and certainly the ISPConfig stuff and mysql backup scripts. Since I have done this already, is it necessary to follow your procedure or could I simply copy the files back to the new (Mandriva) server in the appropriate locations once I have it setup? I know that I wouldn't want to replace all of the files and directories, but which ones are absolutely necessary for ISPConfig, the websites, data, etc? Just the ones you mentioned in your instructions?
Reply With Quote