As a ZenTao administrator, one important responsibility of yours is to back up data regularly, so it can be recovered on time once any system failures occur. In the following part, we will see how to back up data in ZenTao.
ZenTao backup includes configuration, changed codes, database, and files. Now let’s see how to back up in a different environment.
1. Back up via one-click installation package
If you use the one-click installation package, the simplest way to back up is to back up the entire installation directory. In order to back up the whole directory, you should stop Apache and MySQL before backup.
For Windows one-click installation package, it is to back up the entire directory of xampp.
For Linux one-click installation package, it is to back up /opt/zbox/data/mysql/zentao(pro) and /opt/zbox/app/zentao(pro).
For Lampp in Linux, it is to back up opt/lampp/var/mysql/xxxxx (xxxx is the name of ZenTao database, which is zentao by default) and /opt/lampp/htdocs/zentaopms.
2. Manual backup
2.1 Back up configurations, codes and filesConfiguration files are saved in zentao/config/my.php, attachments in zentao/www/data/ and changed codes in zentao. So the way to back up configuration files, codes and attachments are to back up the entire directory of zentao.
2.2 Back up your database
2.2.1 Back up original database files
Find
data directory in
mysql. It is usually installed in the directory of mysql in Windows or in the directory of
/var/mysql or
/var/db in Linux. In the directory
data, there is a directory
zentao, where the original database files are saved. So you can copy this entire directory to back up. In Linux, you have to pay attention to privileges.
2.2.2 Back up files by exporting files
Export database by management tools provided in mysql,
mysqldump -u XXX -p zentao > zentao.sqlXXX can be changed into actual users.
3. Back up in ZenTao
Log in ZenTao as an administrator and go to Admin->Data->Backup and click the Backup Button to back up ZenTao.
You can also change the setting of the backup.
4. Back up by scripts provided in ZenTao
init.bat and init.sh have been included in ZenTao 4.0+ to initialize the scripts for management. One of them is used to back up the database and attachments with the name of backup.bat (for Windows) or backup.sh (for Linux).
First please refer to 8.1.1 Initialize Scripts to initialize all the scripts. Then switch to the directory of zentao/bin/ to execute backup.bat or backup.sh.
I:\xampp\zentao\bin>gt;backup.bat I:\xampp\zentao\bin>gt;i:\xampp\php\php.exe I:\xampp\zentao\bin\php\backup.php Backuping database, successfully saved to I:\xampp\zentao/backup/201304/db.20130402.zip Backuping files, successfully saved to I:\xampp\zentao/backup/201304/file.20130402.zip
Execute backup.sh in Linux.
./backup.sh Backuping database, successfully saved to /mnt/data/z/pms/backup/201304/db.20130402.zip Backuping files, successfully saved to /mnt/data/z/pms/backup/201304/file.20130402.zipOnce backed up, the database and attachments should be named after dates and saved to the directory of zentao/backup.
Notes: If MySQL is stopped, the data in MySQL cannot be backed up.