I think it is safe to say that the majority of computer users, at one time or another, and to one degree or another, has had that moment where we wished we had made a backup of our files—but hadn’t. I don’t believe that an in-depth explanation is required to illustrate why this is a good idea, and that we can all agree that this is something that we should periodically do to avoid that “I wish I made a backup” moment.
While it may seem obvious that you would do this on your personal computer; the files on your Westhost account are no exception. It is just as easy to remove or overwrite a file or an entire directory on your Westhost account. The frequency in which you do this is going to depend on your site; you must decide on the regularity that you perform the backup. There are multiple ways that you can perform the backup of your site, the easiest and most popular method I will describe below.
Take inventory of your account
This will give you an idea of what you are going to back up if for whatever reason you are unsure. The easiest way to do this is to access your Site Manager (http://yourdomain.com/manager) > Install & Manage Applications. This will give you a snapshot of the applications that you have installed and what you will be backing up.
Install FTP program
You are going to want to install an FTP program on your computer to download the backup that you will create. FTP stands for File Transfer Protocol and is going to be the method with which you download your backup from the Westhost server to your computer. There are many FTP programs out there that you can use ranging from free to programs that you must purchase. For the purposes of this instruction, I will be using FileZilla as it is compatible with both Windows and Mac platforms. You can download FileZilla for free here.
Zip up site directory
It is possible to download the entire site directory file by file, but this results in long download times and is overall inefficient. The preferred way to back up your site is to “zip up” your site’s home directory into one single zipped file, and then download the one file. To zip up your sites directory follow these steps:
- Open up the File Manager (http://yourdomainname.com/fm) and log in with your Site Manager username and password
- Upon logging in, you will be placed inside your primary domain’s directory (/var/www/html). In order to zip up the /html directory, you will need to go up one directory (/var/www). You can do this by simply clicking “up one dir” at the top of the directory list.
- It’s important that you are in this directory; otherwise, the below command will not work. Now that you’re in the appropriate directory, you will issue the zip command by first clicking “Execute a Command” at the top right of the screen.
- Type in this command where it says Enter Shell Command:
tar -zcvf yourdomain.com-YYYY-MM-DD.tgz html/
- Hit Submit and this will initiate the backup process. This may take a while depending on how big your directory is. So don’t be alarmed if it appears as if it isn’t doing anything. When it is finished it will output a long list of files that it archived.
Now that you have successfully zipped your directory backup, you are ready to download it. Open up FileZilla and connect to the server by following the instructions outlined in the Westhost documentation.
When you open up FileZilla, you are going to see a local side (your computer) on the left and a remote side (your server) on the right. By default you will be placed in the upper-most directory on your server “/” or what is known as the root of your server. You will need to browse to the location where the backup was made. On the top-right pane of FileZilla, browse to /var/www and you should see the backup that you created in the bottom-right pane. Simply drag the backup file (yourdomainname.com-YYYY-MM-DD.tgz) over to the left-hand pane of your FileZilla which is your local computer. This will initiate the download and, once again, can take awhile depending on how large the backup is. The progress meter at the bottom of the screen should give you an idea when the download will be finished.
The backup that we performed is going to back up your Web site’s files, but if your Web site uses applications such as WordPress, Joomla, Drupal, or any other application that delivers dynamic content, you are going to have a database that you will want to backup as well. The databases that these applications use are going to store all of your blog posts, application settings, users, etc. Simply put, applications that use a database will not function without it. That said, it is equally important to back up the database as it is to back up the site files.
You will most likely already know if you have an application that uses a database after taking inventory of your site earlier on step one. If you have determined that you use a database, follow these steps to make a backup of the database. At any rate, it would be a good idea to follow the below steps to be absolutely sure that you’re backing up a database if you have one.
phpMyAdmin is a database management application that will allow you to export your database. To install this (if not installed already), go to Site Manager > Install & Manage Applications. phpMyAdmin is going be under the Development sub section and will be highlighted blue if already installed. Once it’s installed, click on the phpMyAdmin name and it will give you a link to the phpMyAdmin login.
Once logged in (you will need to use your Site Manager username and password), you will see the main page for phpMyAdmin. On the left you will see a list of all your databases. From this list, you will be able to identify quite easily databases that your site uses (databases like mysql, test, and information_schema are there by default and generally don’t need to be backed up). To make a backup of each database, you will need to follow the below process.
- Click on the database on the left
- Click on Export (towards the top)
- Scroll down to the bottom and check “Save as file”
- Click Go (opens window prompting you choose a location to save the exported database on your computer)
This will export the database in SQL format which is the standard format for databases. Repeat this export for your other databases as necessary.
Once you have made the backup of your site files and the database, you can rest assured that you have something to fall back on if in case, you encounter one of the would-be “I wish I made a backup” moments.
This article was brought to you by WestHost, for shared hosting, dedicated server hosting, cloud servers and 24/7 support visit our site here westhost.com