Zomro » FAQ » How to create a site backup manually
flag We stand with Ukraine. To make an impact, please consider donating.

How to create a site backup manually

Sometimes a situation arises when creating backups using the control panel is not preferable. Or the server does not use the control panel at all.
In this case, you can manually create a backup of your site. Here's how to do it:

1. Connect to your server via SSH.

2. Go to the root directory of your site. In this case, the command for the transition and the site directory are as follows:
cd /home/admin/web/test.com/public_html/

3. Now you need to create a site database dump (if it is not used, then go to the next step).
If you are not sure which database is connected to the site, you can look it up in the CMS / script / framework configuration files. Usually such a file is named like config/conf/dbconfig. For example, in Wordpress this is the wp-config.php file, and the database name string is define( 'DB_NAME', 'admin_test' );
In this case, the database name is admin_test. If you have another CMS / script / framework, then check its documentation.

Now you can create a database dump. Use command:
mysqldump admin_test > admin_test.sql

Instead of admin_test, enter the name of your database, and after the > symbol, write the same name, but with the .sql extension
The larger the database, the longer it takes to dump it.

4. To create an archive, use the command:
tar czfv test.com.tar.gz ../public_html

Where: test.com.tar.gz is the name and format of the archive being created. After the name, you need to specify the extension .tar.gz
../public_html is the path to the files that will be placed in the archive.

Thus, the root directory of the site /home/admin/web/test.com/public_html/ along with all the files inside will be packed into the test.com.tar.gz archive, which, upon completion of the archiving, will be located in the root directory of the site.
After that, you can download it via FTP or using the file manager of the control panel.

You can unpack the created archive with the command:
tar xzfv test.com.tar.gz
As a result, its contents will be unpacked in the directory in which it is located. If you have dumped the database, you can import it into the database with the command:
mysql admin_test < admin_test.sql
Important: carefully check which database you are importing into, as its contents will be overwritten.