HostArmada Web Hosting Knowledge Base

Knowledge is power! Use that power and achieve total and unconditional control over the Web Hosting Services!

How can I create a backup of my website?

It is always a good idea to have a recent backup of your website available. It can save you a lot of trouble when you make a mistake, and you need to backtrack your site to a previous version. Another useful ability to have is to be able to create these backups yourself. In this article, we will be going over a few methods you can use to create a backup of your website.

Create a backup of your website using the cPanel

Backing Up Website Files

  • To start this process, please log into your cPanel account.
  • Use the search bar on the top right and type in "File Manager". Once cPanel presents the result, please click on it. Alternatively, you can navigate to the "Files" features group and choose the "File Manager" tool.

 

Access the 'File Manager' tool in cPanel

 

  • Find the directory where your website's files are stored. If you are not sure where it is, please check our tutorial on the matter.
  • After you find it, please right-click on it. This act will expand a dropdown menu. From it, please select the "Compress" option.

 

Compress (Backup) Website Root Folder in File Manager

 

  • Doing this will show a popup window from which you may choose the compression method. We recommend using either ZIP or TAR. You may select this using the radio button. On the bottom side of the window, you will find a text field where you can choose the location of the backup when it is done and its name. There will be a house icon in the beginning, which will show that this is your "Home" folder. If you want to define a path, you may use a slash "/" followed by the desired path. For example, if you want to place the backup in your public_html directory, please write:
    /public_html/ 
    By default, the name of the archive will be the same as the folder for which you selected "Compress". If you want to change it, please write the desired name on the left side of the file extension. For instance, if your folder was called mywebsite.com and you selected the ZIP extension, the backup's name will be mywebsite.com.zip.To put the desired name there, please remove everything prior to “.zip” and enter the name you wish!
  • Once the above is configured, please press the "Compress File(s)" button on the bottom right side of the screen.

 

Compress (Backup) Website Files in File Manager

 

  • A loading screen will show up, indicating the process has started. Once complete, you will receive a popup window, which will serve as a changelog of all the files that were compressed and placed in the backup.
  • There you have it! A backup of all your website's files, which you can download locally by right-clicking on the archive and selecting the "Download" option from the dropdown menu.

 

Download Website Archive (Backup) from File Manager

 

  • With this done, you have a backup copy of your website files!

 

Backing Up Website Database

Now that the website files are backed up, it is time to also back up the website database.

  • Please go back to the index page of cPanel and in the search bar located on the top right, type in "phpMyAdmin". Once cPanel presents the result, please click on it. Alternatively, you can navigate to the "Databases" features group and choose the "phpMyAdmin" tool.

 

Access the 'phpMyAdmin' tool in cPanel

 

  • When you land on the "phpMyAdmin" page, you will see a list of all your databases on the left side. From the list, please click on the database of your website. If you do not know which one it is, you need to log in via SSH and navigate to the root directory of the application, using the Linux Command Line Basics. When you are inside, please run the following command:
    grep 'username_' * -Ril 
    Here is an example:
    grep 'hostaramda_' * -Ril 
    The output will show you the database of your website!
  • When you figure out which one is it, please press on it within the "phpMyAdmin" feature. Once you click it, you will see all its tables in the middle of the screen. Above the tables, you will see a lot of tabs. The one you need to press is the "Export" tab.

 

List website database in phpMyAdmin

 

  • Once you open this tab, leave the settings as they are and press the "Go" button. A popup window from your browser will show, allowing you to save the exported database file on your local computer.

 

Export (Backup) Website Database

 

  • And there you go! You have successfully generated a backup of your website's database!

Create a backup of your website using SSH

When using this method, we will do things in reverse! First, we are going to generate a backup of the database and the files. Here is what you need to do:

  • Please login via SSH using our tutorial.
  • Navigate to the website's root directory, using the "cd" command shown in our Linux Command Line Basics tutorial. Please enter the folder and use the command shown in our How to export/import a MySQL database via SSH underneath the "Export a MySQL database Over SSH" heading. After you are done, please go one directory behind.
  • Now that you have a backup of the database, its time for the files. Please type the following:
    tar -zcf backup_name.tar.gz folder_name 
    Let's imagine you want to create a backup of your public_html folder - this is how the command will look like:
    tar -zcf site-backup.tar.gz public_html 
    Alternatively, you can use zip compression. Here is the equivalent command:
    zip -r backup_name.zip directory/ 
    Example:
    zip -r backup.zip public_html/ 
  • Both commands are going to take some time to generate the archives. An indication of the process ending would be the fact that your command-line interface will be left at its default state which will be similar to
    [user@hostname ~]# 
  • That's it! Now you have an archive that contains a backup of both your files and your database. You can either download it locally from the cPanel's File Manager or place it within a folder on your hosting account meant for backup storage.

Of course, if this is too overwhelming for you, feel free to submit a support ticket to our technical support team. They are always available at your disposal and will be more than happy to help you with the backup generation process.

Was this article useful and on point?

Find out more about HostArmada entire range of optimized Web Hosting Services and take action today on improving your website Loading Speed, Security, and overall Stability!