Thủ Thuật Kinh Nghiệm

Backup WordPress with BackWPup Tutorial

Backup WordPress with BackWPup Tutorial

We all know that we need to backup our website, but the question is always how. This tutorial covers using an excellent and free backup tool, BackWPup. BackWPup also has a paid version if you need additional features (but most people will do just fine with the free version).

backwpup_header

Why Backup?

A number of hosting services provide backups to your website, so why should you go to the extra effort to make your own backups? Well, here are a few reasons.

  1. While hosting services do backup items, it can be 24-48 hours between backups, and you have no control over when they do it. So if you want a backup before you make a major change to your site, you have to leave your site static for two days first. 
  2. If there is a problem, most services will only do one free backup restore per period (and their length of period can range from 3 months to a year). There is also a delay between contacting tech support and the restore actually happening (that could also possibly take two days).
  3. With their backups, all of your data is still on THEIR servers. You don’t have any direct access. With your own backups, you have direct access anytime you want to your data.
  4. If you are planning some big site changes, you want to test those at a test location, which means you need a full backup copy of your website.
  5. If you change hosting services, you need a full copy of your website to setup at the new host before your domain gets pointed to the new hosting service.

Installing BackWPup

To get started, head over to your WordPress site and select Plugins from the left side menu. At the top of the page click on “Add new”.

1_add_new

In the Search box enter “BackWPup” and click on “Search Plugins”.

2_search

Then click on “Install Now” and when asked if you are sure you want to install the plugin, say yes.

3_search_results

Once BackWPup has installed, click on Activate Plugin.

4_installing_plugin

You will then be taken to your list of plugins which will give you two messages. The second lets you know that the plugin has been activated. The first suggests that you check your BackWPup settings. Click on the “this page” link.

5_plugin_installed

Once on the BackWPup Welcome page, scroll all the way to the bottom and click on “Backup Now!”.

6_backwpup_welcome

BackWPup Dashboard

Now that BackWPup is installed, it’s time to get acquainted with the dashboard. The dashboard has four areas.

  • First Steps – This is a quick checklist of 4 steps. Check the installation will take you the settings information panel. Create a Job will allow you to create a new Job. Backups are done by creating and then running Jobs. Run the created Job will allow you to run Jobs. Check the Job log shows you a log of Jobs that have been run and their status, including any errors or warnings.
  • One click backup – This allows you to create a quick database backup. Note that this is not a complete backup, it is only your MySQL database.
  • Next scheduled jobs – Shows you jobs that are scheduled to be run.
  • Last logs – A brief summary of recently run jobs.

On the left menu in WordPress the BackWPup has expanded to show several options.

  • Dashboard – Provides quick information on the state of your backups.
  • Jobs – Lists the Jobs that you have created and their next scheduled run.
  • Add New Job – Allows you to create a new job.
  • Logs – Displays a history of jobs run and the results of those runs.
  • Backups – A listing of backups if you backup to your own domain, otherwise empty.
  • Settings – Listing of settings for BackWPup — generally you do not need to touch these.
  • About – General information about BackWPup.

Creating a Job

To create a new BackWPup job click on “Add New Job” in the left menu (or step 2 in First Steps on BackWPup Dashboard). At the top of the New Job screen you will see a row of 5 tabs. We will start with the General tab.

General Settings

a1_new_job

First you will enter a Job Name. This should be something descriptive like “Website Daily Backup” where Website is the name of your site.

a2_new_job

The next item is Job Tasks. I generally add in Database Optimize and Database Check. WordPress XML is useful if you plan to do an import into another WordPress location (such as a test site to test out new features).

a3_new_job

Backup File Creation will name your backup and determine the compression used. I recommend leaving the compression at Tar GZip. You can change the first part the name (in this case backwpup_e3b955) to something more descriptive (like backup_website_name), but I would recommend leaving the date and time alone as those let you know when the backup was taken. “%Y-%m-%d_%H-%i-%s” stands for year, month, day, hour, minute, second.

a4_new_job

Job Destination allows you to select where you would like your backup saved. One of the simplest and easiest locations is Dropbox (if you don’t have Dropbox, this link will get you an extra 500MB when you sign up for a free account). For an estimate of file size, a complete backup for one of the sites I’ve worked on is about 100MB (about 150 posts & 1500 comments).

You can also backup to other locations, but I like cloud storage services since I can access the backup from anywhere. The cloud storage also syncs to my computer which in turn has it’s own backup system. Did I mention I really like backing up?

a5_new_job

Log Files will email you if there is an error backing up. If you don’t get an email, it means everything is proceeding normally. If you would like to be emailed after every backup, uncheck the “Errors only” box. BackWPup will enter in the website admin email address, but you can change this if desired.

When you are done with your settings for this page, click on “Save changes”.

a6_new_job

After you click on “Save changes” you’ll receive a notice that your changes have been saved. Now we will move on to the next tab, Schedule.

a7_saved

Schedule Settings

The easiest way to schedule backups is to have them performed automatically. To do this simply select the “with WordPress cron” option.

b1_schedule

When scheduling backups, you want to do so at a time when you are unlikely to be making changes. So I like to schedule jobs to happen in the middle of the night. Alternately, you can schedule your job for a time when your site has its lowest number of visitors.

When you have your schedule set up, make sure to click on “Save changes”.

b2_schedule

Database Backup

Now that you have your schedule setup, it’s time to check the settings for your database backup. To do so, click on the “DB Backup” tab.

The first setting you will want to set up is what tables in your database you want to have backed up. Some sites will have a very small number of tables, while others could have 100 tables.

The tables for your core WordPress data will begin with the same prefix. That prefix is by default “wp_”, however for security reasons you will not normally have that prefix. If you are not sure what your WordPress table prefix is, it is the name on the third button after the “all” and “none” buttons. Click this third button to put checkmarks in front of all your core WordPress data.

Some WordPress plugins will store their data in tables that begin with the same prefix as your WordPress data. Others, however, may store their data in tables with different prefixes. There may also be other database tables which have purposes separate from WordPress. If there are tables that you are unsure of, ask your webmaster.

c1_database_options

Once you have selected the data tables to backup, you need to decide if you want to run maintenance mode during the database dump. Maintenance mode puts a notice to visitors of your website that your website is undergoing maintenance and will return shortly. When the backup is done this notice will be removed. During the database dump visitors may notice a slowdown, however unless you have a large database to dump this only lasts about a minute.

Dumpfile name will be the name of the database backup file. This will default to whatever the name of your database is. If this name doesn’t make any sense, you can change it. I would recommend only using letters, numbers, and underscores in the name. Please don’t use spaces.

The last setting is dumpfile compression. I generally recommend compressing with GZip, it reduces the size of the resulting file.

When you are finished with your settings, remember to click on “Save changes”.

c2_database_options

Files Settings

Now that you have set up BackWPup to backup your database, you need to backup your WordPress files. The Files tab allows you to do that.

The first settings are for Folders to backup. By default BackWPup will backup your root (files in your domain folder), your content, your themes, and your uploads. If you want your plugins to be backed up you will need to click the checkbox.

If you have extra folders in your root directory, you may or may not want them to be backed up. Items in your content folder don’t usually change very often, nor do your themes. Since I don’t use the WordPress default theme (twentytwelve), I have chosen to exclude that from backups. Your uploads folder is where uploaded images go, I would recommend backing this up regularly.

d1_files

After you have selected your folders to backup, you will now be asked if you want to exclude items from backup. I normally leave these settings with the default settings.

d2_files

The last section of files is special files. These include your configuration file as well as some specific access files. These files are normally small, and I would recommend backing them up.

When you have all of your files setup for your backup job, click on “Save changes”.

d3_files

Plugins Settings

On the general settings page under Job Tasks you may have selected to backup a list of plugins. If so, you will have a Plugins tab. This will save a list of the installed plugins. I normally do not make any changes here.

e1_plugins

XML export Settings

On the general settings page under Job Tasks you may have selected “WordPress XML export”, if so you will have an XML export tab. The only change that I would normally recommend is to use GZip compression.

f1_xml

Database Optimize Settings

If you selected “Optimize database tables” under Job Tasks then you will have a tab for “DB Optimize”. I normally leave these settings alone, unless there is a particularly large database. For large databases I may enable maintenance mode during optimization.

g1_database_optimize

Database Check Settings

If you selected “Check database tables” under Job Tasks then you will have a tab for “DB Check”. Again, here I leave the settings alone. I do like the database tables to be checked, however I do not want BackWPup to take any actions to try and repair them. If there’s a problem, I need to look at my databases in detail. Having BackWPup check the tables will send me an email alert if there is a problem.

h1_database_check

To: Dropbox Settings

I have selected to send my backups to Dropbox. Personally, I like Dropbox a lot. It is extremely easy to use and provides you with a free 2GB of storage. If you don’t have an account, you can sign up here and get an extra 500MB free.

On the Dropbox tab you will see a notice that you need to Authenticate with Dropbox. Click on “Authenticate (Sandbox)” and login if needed. The difference between Sandbox and full is that in Sandbox BackWPup only has access to a folder that it creates. If you choose full then BackWPup will have access to your entire Dropbox account.

i1_dropbox_login

After you click to Authenticate, you will be prompted by Dropbox to authorize BackWPup to connect with your Dropbox. You will need to click “Allow”.

i2_dropbox_login

Once Authenticated you will see green “Authenticated!” text in BackWPup. Since I am setting up a Weekly backup schedule I will enter 3 as the files to keep. What will happen is once there are 3 files, every time a new backup is made, the oldest existing backup will be deleted. This helps to save space in my Dropbox by deleting old versions.

When you have made your selections, click on “Save changes”.

i3_dropbox_settings

List of Jobs

After you have created your first job, go to the Jobs page of BackWPup (left hand menu).

j1_jobs

Once on the Jobs page, you will see your available Jobs. In this example, I have two jobs created, a weekly and a daily. If I hover my mouse over the weekly job, a list of four options will appear.

j2_jobs_list

The options allow you edit, copy, delete, or run your job now. Edit will allow you to edit any aspect of your job, copy will make a copy of the job, and delete will delete the job. If you select to copy the job, all of the settings except for the run schedule will be copied. After you copy a job you will need to edit it and set up a run schedule.

Run now allows you to run your job right now. This is helpful if testing your backup, or if you are planning to make some changes to WordPress and need a backup taken before you make those changes.

When you create a new job, I do recommend that you run it immediately. This way you will find out if there is a problem before you start to depend on the job.

Recommendations for Jobs

Now that we’ve covered in detail the various settings, which ones should you use?

I recommend setting up two jobs, one that runs daily and one that runs weekly.

Weekly Job

For your weekly job, I recommend a full backup of your site. This means the whole database for your site (both WordPress specific tables and those of your plugins) as well as all of the files (even the Plugins). I usually keep the most recent 3 backups for this. This backup is for restoring my whole site if needed.

If running low on space is a concern, do not backup the database tables that are included with your daily backup (since your daily backup will be run).

Note: Before updating plugins, WordPress versions, theme changes or other impacts to my site, I recommend manually running the weekly job. This way if something goes wrong, you have a backup.

Daily Job

For your daily job, I recommend backing up the files that change a lot. These are usually your database (especially posts & comments). The other area that changes frequently is wp-content/uploads. So I would also backup those files daily. Files for plugins, it depends on how often the plugins update. If it’s an image plugin that you work with every time you post, then you’ll want to include that in your daily backup.

Checking Your Log

Your logs are displayed both on the BackWPup Dashboard and on the Logs page.

On the BackWPup Dashboard is displayed a condensed version of the most recent jobs. This is useful for at a glance information that things are running smoothly.

k1_log

More detail can be found by going to the Logs page of BackWPup (left menu). Here you will see what types of files were backed up, when the backup was taken, the status, the size of the backup, and how long the backup took. If you need additional information you can click on the name of the backup. This will provide a more detailed log, however this log may not be easily readable for most people.

k2_log

Conclusion

BackWPup is an excellent and free backup solution which will meet the needs of most WordPress websites. They do have additional features in their paid version if you need more features than are presented here.

Hopefully this tutorial has provided you with the information that you need to get your website backed up regularly and safely. If this information was useful or you think I missed something, let me know in the comments!

Leave a Reply

Your email address will not be published.