Restore from backup

Discussions about the usage of KeyHelp.
Post Reply
User avatar
info@eurhosting.net
KeyHelp Translator
Posts: 45
Joined: Tue 24. May 2016, 15:17
Location: Brno
Contact:

Restore from backup

Post by info@eurhosting.net »

Martin created a great manual in how to restore a server from a backup.

Here the english version

###############################################################
### Schedule - KeyHelp Backuprestore ###
### Instructions for restoring a server backup ###
### Version: 30.01.2019 - mda ###
### Updated: 20.04.2021 - alex ###
## Time required: approx. 60-75 minutes ###
###############################################################

###############################################################
## Preliminary

1) Basic installation of new system with KeyHelp

2) Upload backup file (for example, in folder /backup/restore)
-> Unzip the backup
-> 7z x BACKUPFILE.7z

3) Backup of the current mySQL user configuration
-> e.g. Export via PHPmyAdmin -> user accounts
-> Used to restore the new installation
set passwords of KeyHelp, Roundcube etc.

4) Stop the maintenance intervals "Processing of tasks" and "Control panel update" (will be reactivated after Restore)
-> "Maintenance intervals" -> Checked on "Enabled?" remove.

5) Stop mail services
-> service postfix stop
-> service dovecot stop
###############################################################
## Restore - Sections are named after main folders ##
###############################################################
### config
Path:

cd config/
for i in *.tar ; do tar -xf $i ; done ; rm *.tar
cp -av cron/ /var/spool/
cp -av root/ /
mv /etc/ssl/keyhelp /etc/ssl/keyhelp.bak
cp -av etc/ssl/keyhelp/ /etc/ssl/
rm -rf /etc/ssl/keyhelp.bak

Folder keyhelp/ is normally not needed, folder etc/ only selectively.

Manually, the following files must be the KeyHelp users / groups and associations
to be taken over:

etc/passwd
etc/shadow
etc/group
etc/gshadow

Here, e.g. diff or cat in conjunction with grep be a help.
UID / GID of KeyHelp users are number 5000 and up.
Important: Also take over group mapping to KeyHelp groups (for example, keyhelp_nossh) in
etc/group and etc/gshadow!

If manual adjustments have been made to config files, so must
these may also be taken over. However, this should happen in the end.

cd ..

###############################################################
## home
Path:

cd home/
for i in *.tar ; do tar -xf $i ; done ; rm *.tar
mkdir /home/users ; cp -av * /home/users/

cd ..

###############################################################
## mail
Path:

cd mail/
for i in *.tar ; do tar -xf $i ; done ; rm *.tar
mkdir /var/mail/vhosts ; chown vmail:vmail /var/mail/vhosts
cp -av * /var/mail/vhosts/

cd ..

###############################################################
## database
Path:

cd database/
chmod 700 disaster_recovery.sh
./disaster_recovery.sh
-> Follow instructions of the script

Restore system passwords from export (see step 3)
-> mySQL shell with root rights open and the commands exported
To run. root user itself last!

#######################
-> System restart ! #
#######################

Unless a backup of Debian 8 on Debian 9 or Ubuntu 16.04 on Ubuntu 18.04
has been replayed in the keyhelp database -> table "settings"
the following value can be changed:

uses_fcgid -> 1

Rewrite KeyHelps user configuration:

Call the command "keyhelp-toolbox" on the server console.
-> Select menu option 1 ("Rewrite user configuration files") and follow the instructions of the script

Call "php /home/keyhelp/www/keyhelp/cronjob/mastercronjob.php --force-update"

Enable the two maintenance tasks we disabled earlier again:
-> "Maintenance intervals" -> Enable "Processing of tasks" and "Control panel update".

Ensure the certificates are all working well (espacially Let's Encrypt):
Call the command "keyhelp-toolbox" on the server console.
-> Select menu option 6 ("Start maintenance tasks") and than 8 ("Maintenance of SSL/TLS certificates") and follow the instructions of the script

Then, if necessary, restart and the restore is complete.
Stop stop stop
If hosting is not your main focus, I can be of help to mantain your servers
nikko
Posts: 914
Joined: Fri 15. Apr 2016, 16:11

Re: Restore from backup

Post by nikko »

Nice, thanks!
The software said: Requires Win Vista®, 7®, 8® or better. And so I installed Linux.
Post Reply