Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Site Backup for Low-tech Users/RewriteDraft.

Site Backup for Low-tech Users/RewriteDraft: Difference between revisions

From MoodleDocs
Line 25: Line 25:


== Old 6,7,8 The Steps to a Low-Tech Site Backup ==
== Old 6,7,8 The Steps to a Low-Tech Site Backup ==
==


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.   
== Backup up key folders==
You will need a program and rights to go into your website files to make a backup.  You can copy the folder to another off site location, or zip the folders and copy that zip file to another location. 
 
An FTP (file transfer protocol) program might be useful. There are free programs such as CyberDuck and FileZilla.  A FTP program copies a file from "there" (the server) to “here” (your desktop).  Usually this is as simple as a drag and drop and then waiting for the files to transfer.
 
Some webhosts will have an interface that will allow you to create a zip or tar file and download it.  Similar to a FTP program.
 
===Back up your moodledata folder===
 
Use your program to copy (that is, drag and drop) the directory called “[[moodledata]]” or the zip or tar file you created that contains this folder. This folder was named and  created in the install process.  It usually located in a public directory, not in the same directory as the moodle code folder. 
 
===Backup the moodle code folder===
Use your program to copy (that is, drag and drop) the directory that contains the moodle code.  This directory is usually called "moodle" and maybe in the public root (htdocs). You may have created a tar or zip file of this directory and it's contents.
 
==Backup the MySQL database===
Backing up the MySQL database is a different process.  Here is [http://www.youtube.com/watch?v=ifPJzlqq1rQ a video of the process.]
 
The MySQL database is made up of tables.  Each table has records.  The MySQL database may have tables for Moodle and other programs. 
 
===Open phpMyAdmin===
phpMyAdmin can be installed as part of the Moodle interface.  When installed it can be found in the site administration block>Server>database.  Many webhosts will use a program called cPanel, or have a link to program that can manage the MySQL databaseWe will use phpMyAdmin.


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: [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, 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.   
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.   

Revision as of 15:34, 24 February 2010

link back to real page
This page is written for Moodle site administrators who are interested in learning about site backup and restore process, but who are not familiar with code, command lines or website administration. For others please see Site backup

TIP: Please remember there are many different configurations for webservers and Moodle sites. Most of the instructions should start with the words "Generally speaking".

A complete Moodle site backup involves 3 things: the Moodle code, the moodledata folder and the MySQL table. A course backup and download off site is always a best practice but it only involves parts of the moodledata folder and SQL table.

Before disaster strikes

When a major Website disaster happens, you may need to restore the three parts:

  • moodledata folder - sometimes called the: data files, Moodle files, data directory, uploaddata, dataroot, or simply moodledata (in lowercase). It is not called the "database".
  • MySQL or PostgreSQL database - We will refer to the MySQL database. There are other SQL flavors which can be used.
  • Moodle code - location of Moodle code.

Thus it is a good idea to first know how to backup these parts.



Course Backups - better than nothing

As the site administrator, you probably have set an automatic course backup in your site settings. Sometimes site administrators forget that these backups should be copied to a safe place other than their webserver. Teachers maybe encouraged to download their course(s) backups to their computer on a weekly basis.

The course backups and restores only deal with parts of the moodledata folder and MySQL tables. For example, they may include reference to a default theme or a contributed code module, but not the actual code or information that will make them work.

Old 6,7,8 The Steps to a Low-Tech Site Backup

==

Backup up key folders

You will need a program and rights to go into your website files to make a backup. You can copy the folder to another off site location, or zip the folders and copy that zip file to another location.

An FTP (file transfer protocol) program might be useful. There are free programs such as CyberDuck and FileZilla. A FTP program copies a file from "there" (the server) to “here” (your desktop). Usually this is as simple as a drag and drop and then waiting for the files to transfer.

Some webhosts will have an interface that will allow you to create a zip or tar file and download it. Similar to a FTP program.

Back up your moodledata folder

Use your program to copy (that is, drag and drop) the directory called “moodledata” or the zip or tar file you created that contains this folder. This folder was named and created in the install process. It usually located in a public directory, not in the same directory as the moodle code folder.

Backup the moodle code folder

Use your program to copy (that is, drag and drop) the directory that contains the moodle code. This directory is usually called "moodle" and maybe in the public root (htdocs). You may have created a tar or zip file of this directory and it's contents.

Backup the MySQL database=

Backing up the MySQL database is a different process. Here is a video of the process.

The MySQL database is made up of tables. Each table has records. The MySQL database may have tables for Moodle and other programs.

Open phpMyAdmin

phpMyAdmin can be installed as part of the Moodle interface. When installed it can be found in the site administration block>Server>database. Many webhosts will use a program called cPanel, or have a link to program that can manage the MySQL database. We will use phpMyAdmin.


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/

Tips and tricks

Useful and free books

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.

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 does not tell you how to backup your whole site.

Old 1 Site Backup for Low-Tech Users

It is a good idea to reread the two Moodle FAQs: Beginning_Administration_FAQ and Beginning_Administration_2_FAQ

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).

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 [1] or another one of the packages described here: [2]

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.


Old 4 Besides your courses, what should you back up?

To understand a site backup, you should know that Moodle software is supported by three other software packages. (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 and 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.

Old 2 Backing Up to Upgrade Moodle

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

See also