How to Backup and Restore Email in Zimbra

This post will describes the quick steps how you can perform backup and restore in zimbra email server. Assumed that the domain ehowstuff.local have one user with the email id user@ehowstuff.local. Email administrator was requested to perform backup and restore without login to user, meaning the backup and restore task should be perform via command line using zmmailbox command. Kindly refer to below steps :

1. Make sure you have root access to zimbra email system and the backup destination should be writable by zimbra user. Create /backup and assign permission to zimbra user and group :

[root@mail-server ~]# mkdir /backup
[root@mail-server ~]# chown -R zimbra:zimbra /backup

2. As a zimbra user, issue the following command to backup the user mailbox :

[root@mail-server~]# su - zimbra
[zimbra@mail-server ~]$ zmmailbox -z -m user1@ehowstuff.local getRestURL "//?fmt=tgz" > /backup/user1@ehowstuff.local.tar.gz

3. As a zimbra user, issue the following command to restore the user mailbox :

[root@mail-server~]# su - zimbra
[zimbra@mail-server ~]$ zmmailbox -z -m user1@ehowstuff.local postRestURL "//?fmt=tgz" > /backup/user1@ehowstuff.local.tar.gz

Note : Please note that this will backup mailbox content only without user preferences.

How to Backup and Restore MySQL Database on CentOS/RHEL

In this post, i will share on how to backup and restore MySQL database on Linux server. I have tested this on my CentOS and RHEL servers.

MySQLDump — A Database Backup Program, Click for more info.
The mysqldump client is a backup program originally written by Igor Romanenko. It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format.

What is MySQLDump and how to use it :
The MySQLDump is handy utility that can be used to quickly backup the MySQL Database to the text files. To use the MySQLDump utility it is required to logon to the System running the MySQL Databse. You can use Telnet to remotely logon to the system if you don’t have the physical access to the machine.

Assumed that the MySQL server has been installed with the version/release as below :

Name        : mysql
Arch        : i686
Version     : 5.1.52
Release     : 1.el6_0.1

Login to mysql to check the existing databases :

[root@centos62 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.1.52 Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Show available databases :

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| phpmyadmin         |
+--------------------+
3 rows in set (0.00 sec)

mysql> exit
Bye

1. Backup MySQL database to <databasebackupfiles>.sql

<databasename> = Target existing database name
<databasebackupfiles> = Preferred backed up file name (Optional and user defined)

# mysqldump -u root -p <databasename> > <databasebackupfiles>.sql
Enter password: <Type your mysql password and press enter>

1.1 As Example, i will back up the database named “mysql” to mysql19022012.sql file. This will taking backed up all the tables including the data :

[root@centos62 ~]# mysqldump -u root -p mysql > mysql19022012.sql
Enter password:

1.2 View the backed up file :

[root@centos62 ~]# ls | grep mysql
mysql19022012.sql

1.3 View the content on mysql19022012.sql :

[root@centos62 ~]# more mysql19022012.sql

2. Restore the backed up database named “mysql19022012.sql” to new database named “mysqlnew” as below :

# mysql -u root -p <mysqlpassword> <databasename> < <databasebackupfiles>.sql

<mysqlpassword> = MySQL password
<databasename> = Database name that will be restore
<databasebackupfiles> = Backed up database file, normally .sql file

2.1 Create the new database mysqlnew :

mysql> CREATE DATABASE mysqlnew;
Query OK, 1 row affected (0.01 sec)

2.2 As example, i will restore the mysql19022012.sql backed up file to database named “mysqlnew” :

[root@centos62 ~]# mysql -u root -p password mysqlnew < mysql19022012.sql

or

[root@centos62 ~]# mysql -u root -p mysqlnew < mysql19022012.sql
Enter password:

How to Backup and Restore the Subversion Repository

In this post, i will show you on how to backup and restore the subversion repository using svnadmin command.

To backup the repository, run below command :

     
    [root@server ~]# mkdir /mysvnbackup
    [root@server ~]# svnadmin dump /svn/repos/testsvn > /mysvnbackup/testsvn.svndump
    * Dumped revision 0.
    

To restore the repository, run below command :

    [root@server ~]# rm -rf /svn/repos/testsvn
    [root@server ~]# svnadmin create /svn/repos/newtestsvn
    [root@server ~]# chown -R apache:apache /svn/repos/newtestsvn
    [root@server ~]# svnadmin load /svn/repos/newtestsvn < /mysvnbackup/testsvn.svndump
    

How to Restore MySQL database using PHPMyAdmin

Previously, i have teach you how to backup the MySQL database. Now, i will brief you the simple steps on how to restore MySQL database using phpmyadmin. This steps only applicable for the database that was installed with phpmyadmin such as LAMP server, Wamp server and XAMPP server. Most of the students or for the development peoples has using this phpmyadmin to administer their database because it’s easy to use and it help us to reduce the common mistakes. Please follow this step to restore the MySQL database.

1. Go to this url:

    http://localhost/phpmyadmin/

In the real webhosting, “localhost “should be appear as:

    http://myexample.com:2082/cpsess57339117932/3rdparty/phpMyAdmin/index.php


2. Select Import Menu and select file to import.

3. In the previous guideline, we have teach you how to backup the “wordpress_db.sql” mysql database. We will use the same database to restore.

4. Make sure the .sql file has been selected and click go to proceed.
5. If database restoration/import has successful, it will return this such of result

    Import has been successfully finished, 35 queries executed.

6. Please note the above steps are to restore the MySQL only. To migrate the whole blog, make sure you has copy the whole content in “C:\wamp\www\ “. If the folder name was “blog”, make sure you have copy the “C:\wamp\www\blog“.