Note: You are currently viewing documentation for Moodle 3.11. Up-to-date documentation for the latest stable version of Moodle may be available here: Site Backup for Low-tech Users.

Site Backup for Low-tech Users: Difference between revisions

From MoodleDocs
Line 59: Line 59:
8. Back up your database:  Here’s a video that shows how: [http://www.youtube.com/watch?v=ifPJzlqq1rQ]
8. Back up your database:  Here’s a video that shows how: [http://www.youtube.com/watch?v=ifPJzlqq1rQ]


In words, here’s how: Go to your server’s cPanel. Open phpMyAdmin.  In the left pane, you will see your database(s) listed.  Normally, a Moodle database will include an underline and mdle; and mine has 198 tables in it.  Click on the database you want to back up.   
In words, here’s how: Go to your server’s cPanel. Open phpMyAdmin.  In the left pane, you will see your database(s) listed.  Normally, the name of a Moodle database will include an underline and mdle; and my Moodle database has 198 tables in it.  Click on the database you want to back up.   


The page will refresh and along the top you will now see a row of buttons. Click on the button Export.   
The page will refresh and along the top you will now see a row of buttons. Click on the button Export.   

Revision as of 16:22, 21 February 2010

Site Backup for Low-Tech Users

This page requires a review. Please do so and remove this template when finished.


This page is submitted for review and correction.

If you use Moodle and administer your site, and you do not write Unix/Linux command lines or php code, you can still understand how to back up your site.


1. First, it’s a good idea to reread the two Moodle FAQs about Beginning Administration: [1] and [2]

Also, revisit cPanel, which is a common webhost interface, where you manage what you have on your hosted server space.

You probably used cPanel when you installed Moodle. It includes File Manager. In addition, cPanel includes phpMyAdmin. This utility will be used to back up and, if necessary, query your database. PhpMyAdmin is documented in language that presumes computer expertise. But phpMyAdmin is used by Moodlers in videos you can find on the Web (on, for example YouTube). For example, there are videos of Moodle processes using cPanel and PhpMyAdmin at http://www.e-blackboard.org/.

Backing Up to Upgrade Moodle

2. Backing up in order to upgrade Moodle can raise the specter of databases whose default “collation” or “character set” is not exclusively the utf-8 that Moodle requires. You can see a discussion of this issue, relevant to those who used Fantastico to install Moodle, here http://moodle.org/mod/forum/discuss.php?d=140949

Course Backups First

3. Every Moodler should download the free book Using Moodle 2nd edition in .pdf. https://docs.moodle.org/en/Using_Moodle_book It tells you all about how to create Moodle courses. Its final chapter (16) describes basic system administration, including how to automate the backing up of your courses. That automated course backup is really simple and you should do it.

If a course is ever broken, fouled, or lost, there is a “restore” feature built right into Moodle’s front-page administration block. It restores courses from backups. In order to practice restoring a course, be sure to include among your Moodle courses a shell or “dummy” course.

The rest of Using Moodle’s final chapter explains the administration settings on Moodle’s front page. All those explanations are vital. However, Using Moodle cannot tell you how to backup your whole site.

Besides your courses, what should you back up?

4. To understand a site backup, you should know that Moodle software is supported by three other software programs. (These will be installed on your webhost’s server, and your host maintains and updates them.) In most cases, these three are the open-source (free) software programs called Apache (server software), MySQL (which creates and stores your databases), and PHP (the language in which Moodle code is written, and that allows Apache, MySQL, and Moodle to communicate). You can use alternatives to the Apache an MySQL "brand names," but you will always need all three types—plus the Moodle code itself.

It’s good to read the Site Backup FAQ [3] You will not understand everything, but that’s OK.

Experienced system administrators back up their sites according to instructions here: [4] But that page assumes that readers can write Unix/Linux commands and php code. If you cannot, the steps below should help you.


5. If a disaster happens, you will need to restore, from zipped backup copies, two of the three components of your Moodle system. These two are

your moodledata folder and your MySQL database(s).

(The third component is the folder where you installed your Moodle code. I will discuss that component later.)

One difficulty is that these three components are called by confusingly similar names.

a. The data folder. This is also called data files, Moodle files, data directory, or moodledata (uploaddata if Fantastico installed your site). Sometimes this folder is also called dataroot because that’s where it’s located.
b. Your database, or data tables, usually in a MySQL database. Strictly speaking, these are not files; they are tables. Taking this backup is often called a MySQL dump, a database dump, or a database export.
c. Moodle code: that is, the version of Moodle you’re using. Your Moodle code is stored on your server at a location called dirroot. So sometimes it’s called the Moodle directory. If you don’t back up your Moodle code, you can instead download a recent “weekly” version of Moodle and reenter any tweaks you have added.

The Steps to a Low-Tech Site Backup

6. Get an ftp (file transfer protocol) program. I bought a really simple one (Transit) for about $25, but there are free ftp programs such as CyberDuck and FileZilla. This ftp program copies a file from “them” (the server) to “us” (your desktop) when you drag and drop.

7. Back up your data folder: Use your ftp program to copy (that is, drag and drop) the file called “moodledata” or (in a Fantastico install) “uploaddata.” It will be zipped as a file that ends in .tar.gz You don’t need to unzip it, but keep it where you can find it.

8. Back up your database: Here’s a video that shows how: [5]

In words, here’s how: Go to your server’s cPanel. Open phpMyAdmin. In the left pane, you will see your database(s) listed. Normally, the name of a Moodle database will include an underline and mdle; and my Moodle database has 198 tables in it. Click on the database you want to back up.

The page will refresh and along the top you will now see a row of buttons. Click on the button Export.

You will see boxes with options in them (see below).

PhpMyAdminExport.jpg

Check “Select all. ” In the Structure box, I leave the defaults, and also click “Add DROP TABLE, etc.”

Go down to the bottom and find “Save as file”: add today’s date to the default name. After “Compression,” I select gzipped. Then, down in the lower right, press GO. A popup window will ask you whether you want to save the exported file. Click OK (Save). Wait a minute or two.

AdminMyPhp will zip a copy of your database and send it to your home computer’s desktop.

Remember, I said that the third component's backup was less urgent?

I am told that you can use an ftp program to backup your Moodle code—the folder where your Moodle is stored. I have not done so yet. I can always download a fresh Moodle from the Web at Moodle downloads http://moodle.org/downloads/

Another Site Backup

Finally, if you have a spare computer capable of Internet connection, you can create a backup/test Moodle site.

Temporarily connect that computer to the Internet. Download the Moodle package or "appliance" appropriate for your operating system, such as MAMP [6] or another one of the packages described here: [7]

Create as many empty courses as you have on your site. Then increase the upload limit: on your front page, under Administration>Security>Site policies, find Maximum upload size and increase it to whatever you need for your largest course backup.

Then go into each empty course, and use Administration>Import to import your course backup. Don't forget to import your glossaries and front page.

Now you have a test Moodle. It’s not secure; so don’t open it up to the Web. But you will have a complete, working copy of your site.

Could someone explain, step by step, for those who have not written php code or command-line Unix/Linux, how to restore from site backups? Perhaps a video like the installation video at at http://ic.eflclasses.org/tutorials/ ?