This is a test site. Any changes will be lost!

Upgrading: Difference between revisions

From MoodleDocs
No edit summary
(test pages)
 
(10 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Moodle is designed to upgrade cleanly from one version to the next.  Please refer to [[Upgrading to Moodle 1.6]], [[Upgrading to Moodle 1.8]] or [[Upgrading to Moodle 1.9]]  for particular considerations related to the upgraded version. 
Information about how to upgrade and the pitfalls etc
 
Changes that have been made to the original code, such as installing a contributed module (non-standard module) or a site edit of a php file, may not upgrade. This includes modifications to standard themes, that will be overwritten during an upgrade.
 
 
__TOC__
 
When upgrading a Moodle installation you should follow these steps:
 
==Check the requirements==
Spend some time re-reading the [[Installing Moodle | installation documentation]] and documentation for the new version. Check the system requirements for the version you are upgrading to in ''Administration > Server > [[Environment]]''.
 
== Backup important data ==
 
Although it is not strictly necessary, it is always a good idea to make a backup of any production system before a major upgrade, just in case you need to revert back to the older version for some reason. In fact, it's a good idea to automate your server to backup your Moodle installation daily, so that you can skip this step.
 
There are three areas that need backing up:
 
=== 1. The Moodle software directory itself ===
 
Make a separate copy of these files before the upgrade, so that you can retrieve your config.php and any modules you have added like themes, languages etc
 
=== 2. Your data directory ===
 
This is where uploaded content resides (such as course resources and student assignments) so it is very important to have a backup of these files anyway. Sometimes upgrades may move or rename directories within your data directory.
 
=== 3. Your database ===
 
Most Moodle upgrades will alter the database tables, adding or changing fields. Each database has different ways to backup. One way of backing up a MySQL database is to 'dump' it to a single SQL file. The following example shows Unix commands to dump the database called "moodle":
 
mysqldump -u username -p -C -Q -e -a moodle > moodle-backup-2007-04-01.sql
(The "-a" switch is deprecated and should be replaced by "--create-options")
 
Substitute your database user account for username. The -p flag will prompt you for the password for the username specified by -u.
 
If your database host is different from the host you want to execute the backup command (usually the web server), you have to specify it with the -h option to mysqldump:
 
mysqldump -u username -p -h databasehost -C -Q -e -a moodle > moodle-backup-2007-04-01.sql
 
You can also use the "Export" feature in Moodle's optional "MySQL Admin" web interface to do the same thing on all platforms. In Moodle v1.9 and greater, this is located in '''Site Administration''' -> '''Server''' -> '''Database'''. This interface can also be downloaded from http://download.moodle.org/modules/integrations.php. It is an integration of PHPMyAdmin for the Moodle administration interface.
 
== Install the new Moodle software ==
 
=== Using a downloaded archive ===
 
@Do not overwrite an old installation unless you know what you are doing ... sometimes old files can cause problems in new installations. The best way is to rename the current Moodle directory to something else, then unpack the new Moodle archive into the old location.
 
Linux
mv moodle moodle.backup
tar -xvzf moodle-1.1.tgz
 
Next, copy across your config.php, any other plugins such as custom themes, and your .htaccess file if you created one:
 
cp moodle.backup/config.php moodle
cp -pr moodle.backup/theme/mytheme moodle/theme/mytheme
 
Don't forget to
 
sudo chown www-data moodle/config.php
 
if necessary.
 
=== Using CVS ===
 
You can use CVS for updating or upgrading your Moodle.
First you need to do a CVS checkout in your (empty) Moodle root directory.
 
You can use any of our [[CVS_for_Administrators#CVS_Servers|CVS Mirror servers]]. Just replace '''SERVER.cvs.moodle.org''' in the instructions below with the name of the mirror server you chose!.
 
'''For Linux servers'''
 
To do a CVS checkout of Moodle, you first have to logon to the Moodle CVS server.
 
  <nowiki>cvs -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle login</nowiki>
  No password for anonymous, so just hit the Enter button.
 
Go to the directory where you want the Moodle root to come and type
 
  <nowiki>cvs -z3 -d:pserver:anonymous@SERVER.cvs.moodle.org:/cvsroot/moodle co -r MOODLE_18_STABLE moodle</nowiki>
  (where MOODLE_18_STABLE is the desired version)
 
To update, just go into the Moodle root directory and update to the new files:
 
  cvs update -dP
To update to a new version type in the following and change 18 to whatever newest version upgrade number is
  cvs -Q update -dP -r MOODLE_18_STABLE
 
Make sure you use the "d" parameter to create new directories if necessary, and the "P" parameter to prune empty directories.
 
'''For Windows servers'''
 
You can use Tortoise CVS to do the initial checkout and the updates.
 
If you have been editing Moodle files, watch the messages very closely for possible conflicts. All your customised themes and non-standard plugins will be untouched.
 
Don't forget to visit the admin page after the CVS update process has completed.
 
== Finishing the upgrade ==
 
The last step is to trigger the upgrade processes within Moodle.
 
To do this just visit the admin page of your installation e.g. ''<nowiki>http://example.com/moodle/admin</nowiki>''
 
It doesn't matter if you are logged in as admin or not. If you are upgrading from some older versions you would not be able to login before the upgrade anyway.
 
Moodle will automatically detect the new version and perform all the database or filesystem upgrades that are necessary. If there is anything it can't do itself (very rare) then you will see messages telling you what you need to do.
 
Assuming all goes well (no error messages) then you can start using your new version of Moodle and enjoy the new features!
 
Please note that if you are running a large scale of moodle site (e.g. have more tha 10,000+ courses and 40,000+ users), make sure that you do your own performance profiling testing before you upgrade to Moodle 1.8.x, as there are still quite a few outstanding (unresolved) performance issues in 1.8.x for large user base installations.
 
== Verify the upgrade (optional) ==
 
If you wish to confirm that the database definitions in the upgraded database match the definitions of a new, clean install (which they should) you might like to look at [[Verify Database Schema]].
 
==Upgrading more than one version==
 
In general, it is recommended to upgrade via each version of Moodle, for example 1.7 -> 1.8 -> 1.9. An exception to this is when upgrading from 1.5 or 1.6, when it is recommended that 1.7 is skipped, in other words upgrade 1.5 -> 1.6 -> 1.8 -> 1.9. (The main reason for this recommendation is that the default roles settings obtained when upgrading to 1.7 are not ideal for 1.8 onwards.)
 
==See also==
 
*[[Installing Moodle]]
*[[Installation FAQ]]
*[[Upgrading to Moodle 1.6]]
*[[Upgrading to Moodle 1.8]]
*[[Upgrading to Moodle 1.9]]
*Using Moodle [http://moodle.org/mod/forum/view.php?id=28 Installation problems] forum
*[http://otaru-jc.ac.jp/hagley/howtoupgrademoodlewithcpanel.swf How to upgrade Moodle with cpanel tutorial]
*[http://youtube.com/watch?v=ufAmf_jm_p8 How to backup a whole Moodle site video]
*Using Moodle forum discussions: [http://moodle.org/mod/forum/discuss.php?d=26731&parent=125858 Using cvs], [http://moodle.org/mod/forum/discuss.php?d=56915 Upgrading from 1.5.2 to 1.7], [http://moodle.org/mod/forum/discuss.php?d=56991 Upgrade nightmares.... any help appreciated], [http://moodle.org/mod/forum/discuss.php?d=62463 After upgrading i get "Your site may not be secure." msg]
 
[[Category:Installation]]
 
[[es:Actualización de moodle]]
[[fr:Mise à jour]]
[[ja:アップグレード]]
[[nl:Upgraden]]
[[zh:升级]]
[[pl:Aktualizacja]]

Latest revision as of 19:33, 15 September 2011

Information about how to upgrade and the pitfalls etc