How to Manually Backup a Website in CyberPanel on Ubuntu 22.04

This guide explains how to manually back up a website hosted on CyberPanel running on an Ubuntu 22.04 server.

Step 1: Access the Server

Log in to your server as the root user using SSH:

ssh root@your-server-ip

Step 2: Navigate to the Website Directory

Use the following command to navigate to your website’s root directory. Replace example.com with your actual domain name:

cd /home/example.com/public_html

Step 3: Backup the Website Files

Run the following command to create a compressed backup of the website files. This assumes there is already a backup directory:

tar -czvf /home/example.com/backup/example_files_$(date +%F).tar.gz /home/example.com/public_html

This command will generate a compressed backup file named with the current date.

Step 4: Find the Database Name

To back up the database, first, find the database name:

  1. Log in to CyberPanel.
  2. Navigate to phpMyAdmin.
  3. Locate and copy the database name associated with your website.

For example, if the database name is example_db, use it in the next command.

Step 5: Backup the Database

Use the following command to create a database backup. Replace example_db with your actual database name:

mysqldump -u root -p example_db > /home/example.com/backup/example_db_$(date +%F).sql

You will be prompted to enter the MySQL root password. You can find the MySQL credentials in CyberPanel under the Database Info section.

Done!

Your website and database backups are now saved in the /home/example.com/backup/ directory. Be sure to download (fix the permissions first) or transfer them to a secure location for safekeeping.

1 Like