moving my moodle installation

moving my moodle installation

by Lisa Durham -
Number of replies: 15

Ok, wouldn't you know as soon as I get it installed and running smoothly, I've got to move my moodle installation to a new server.

If someone could please verify for me that these are the steps I need to take:

1. copy the moodle installation directory to the new server
2. copy the moodle data directory to the new server
3. use the phpmyadmin in moodle to do a database dump.
4. run the resulting sql script in phpmyadmin on new server.

? Or should I just install moodle to the new server, get it up and running, then use the sql dump from the old server on the new server and copy the moodle data directory?

Sorry for silly questions, but for it's unavoidable for me now to have to move my moodle installation and I don't want to lose the course information and assignments.

Thanks,

Lisa

 

Average of ratings: -
In reply to Lisa Durham

Re: moving my moodle installation

by Claudio Tavares -
Hi Lisa
I never did that, but I'm planning to.
I think this way must work fine, just don't forget to reflect those changes in the config.php file, in the Moodle root folder (the same file you customize at the first installation).
And tell us about your experience.
In reply to Claudio Tavares

Re: moving my moodle installation

by Lisa Durham -

What a long strange trip it's been..........

Ok, because I'm in the process of moving a domain along with all the sites and files.. it's been a very odd morning.

First I did set up a database on the new box. Not a problem.
Next I used the phpmyadmin module within Moodle to create an export.
3. Used new host's phpmyadmin to import the exported moodle database. no problems so far.
4. Moved my moodledata directory to the new host. No problems.
5. Unzipped moodle program files to new host directory.
6. edited config.php for moodle.
7. (Here's where I got all messed up.) My new host has an IP only, no URL yet. When I typed in http://someIPNumbers/moodle  I would be rerouted to www.mydomain.com/moodle ??? (Not a moodle issue at all after about an hour of trying to run my head through a wall - seems to be a url / nameserver issue.) Anyway, not sure if it was necessary or not but I deleted all the tables in the database, ran the setup scripts as  a brand new moodle installation, then reimported the database from the export from the old database. Now it's working fine. Except for when I hit "logout" because when I log out, there is no trailing slash at the end of the url, so I get a 404 error. If I add a / at the end it takes me right back to the new moodle installation. Go figure.

So as it stands now, I have to be sure to type in the trailing / at the end of the http//IPhere/moodle/ and it works. After the domain is moved I'll go back into the config.php and change the url from ip numbers to the domain name.

Thanks,

Lisa

In reply to Lisa Durham

Re: moving my moodle installation

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I recommend copying the database first, then the files.

You may find the database is too big for phpmyadmin and your browser to handle (though try it first). In this case you can use the command-line programs mysqldump and mysqlimport.

I use mysqldump every day on my home machine to make an automated backup of the moodle.org database.
In reply to Martin Dougiamas

Re: moving my moodle installation

by Rob Butner -

Martin---

This is Rob---wer'e trying to move moodle to the new LINUX machine---everthing is working great---except the moodle.sql dump file. PHPMYADMIN is saying it's too big---

What shall I do???

In reply to Rob Butner

Re: moving my moodle installation

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
(Rob, I emailed Kevin already about this - did he not get it?)

Basically you need to FTP (or otherwise transfer) the file on to the Linux server, then use the Unix command line to run the mysqlimport command, eg:

mysqlimport -u youruser -p yourdatabase textfile.sql
In reply to Martin Dougiamas

Re: moving my moodle installation

by Ray Le Couteur -

Martin

I know you're working on backup issues for the next version.

I host Moodle on 2 servers (one I use for testing purposes). The test installation is on a 'Safe Mode' server and its a real pain.

Not only is file upload a problem, but the above code to backup/restore mysql isn't permitted in safe mode (Unix command lines not allowed).

It took quite a while to understand why my code didn't work - no error messages, but I came across a forum message somewhere .........

Just in case you weren't aware......


Best wishes

Ray

In reply to Ray Le Couteur

Re: moving my moodle installation

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The machine running the command doesn't necessarily have to be the same one with the database, as these commands can take a hostname as an argument. This assumes that the host is configured to allow access from other machines.

So you might look into running the command on another (less braindead) computer, for example, I use a command like this on one machine to make a backup of another:

                                    
In reply to Lisa Durham

Re: moving my moodle installation

by Max Stenlund -

Another question relating to this:

How do you move a course from one installation to another? I have two different installations and want to move 1-2 courses.

 

In reply to Max Stenlund

Moving a course to another installation

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Currently it's not possible.

However, a comprehensive backup/restore module has been started by the very able Eloy Lafuente (see bug 84). It's a very difficult task, as the data structures are complex, so there is no date set for the completion of this. I suggest patience and some good thoughts sent his way! smile
In reply to Martin Dougiamas

Re: Moving a course to another installation

by David Kelly -
This is good news... all the best to Eloy
The capacity to move a course once created and be able to create copies of it either for backup or cloning would be a powerful addition to moodle... many of the tutors using my installation have asked for the capacity to move elements from one course to another so as to avoid the need to recreate a module again and again... and sometimes they want to move whole courses changing only a few minor details like the title.

Could things like this be done by copying and moving chunks of the database? (something I feel nervous about doing, I'm no wizard with mySQL!!!)

Good luck with this work
David
In reply to Martin Dougiamas

Re: Moving a course to another installation

by Dave Ray -

Using the same Moodle version I have copied/pasted the existing Mysql database

using "PHPMyAdmin" --excellent tool--to other Moodle installs on local and internet machines.

All works well. The key is to have the same version of Moodle installed in both locations.

                                                                                 Dave wink.gif

In reply to Dave Ray

Re: Moving a course to another installation

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You've done single courses that way? Or are you talking about the whole site?
In reply to Dave Ray

Re: Moving a course to another installation

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yes I have had success copying the complete site from one installation to another.

I used mysqldump to send the complete database structure and data to a text file, and then zipped the data file tree

On the target machine I read the MySql dump file into an empty database and restored the data file. You still need to create the database and set permission manually. Once config.php was set up appropriately it worked first try.

About 15 minutes work, including installing Moodle.

In reply to Howard Miller

Re: Moving a course to another installation

by Jacob Romeyn -
Of course also transfer your moodldata file to the new server. Yes this is the standard procedure I always use for a full backup.