Upgrading from 2.4 to 3.11

Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Number of replies: 26

When upgrading from version 2.4 to 3.11, is it necessary to perform a backup and restore every time an update is performed? Since to get to 3.11, the required steps are 2.4->2.7->3.1->3.6 and finally 3.11, do I have to restore all backed up data after going to 2.4->2.7 and 2.7->3.1 and so on, or I can simply restore at the end, when I get to 3.11 using the backed up data from version 2.4?

Average of ratings: -
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Dave Emsley -
Hopefully you won’t need to do any restoring as the updates will work. You only need to backups to get you back working if it DOES fail.
Average of ratings: Useful (1)
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
A typical upgrade looks like this https://docs.moodle.org/27/en/Upgrading. There is no "restore".

Note that upgrade is one-way. Means there is no downgrade other than restoring a backup. See https://docs.moodle.org/en/Site_backup and https://docs.moodle.org/en/Site_restore.

Yes, 2.4->2.7->3.1->3.6->3.11 is a possible path. I usually do 2.4->2.7->3.1->3.5->3.9, because both 3.5 and 3.9 are LTS. And I stay away from 3.11. See https://moodle.org/mod/forum/discuss.php?d=432027.

Watch out for the variing software requirements en route: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.
Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Thank you! Just a few more questions:
Watch out for the variing software requirements en route: http://www.syndrega.ch/blog/#php-and-dbms-compatibility-of-major-moodle-releases.
So after upgrading to each version, I have to upgrade Xampp too? Thanks a lot for letting me know about this, I really overlooked this step!

I was considering using 3.11 simply because its the latest version. If my site isn't live and the "Mark as Done" Box doesn't really bother me, 3.11 is perfectly fine, right?
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
You're welcome. Although I avoid speaking to anonymous requests, I made an exception. I have a connection to German.
wink

> So after upgrading to each version, I have to upgrade Xampp too?

It is up to you, how you do it. The long Moodle march means you march the dependencies along the path.

> If my site isn't live and the "Mark as Done" Box doesn't really bother me, 3.11 is perfectly fine, right?

3.11 is stable long enough, well tested and streamlined. Generally, what Ken said is true, "One last piece of advice ... take it slow ... don't get in a rush." I can't imagine, since your users were happy for 8+ years with Moodle 2.4, that they suddenly need all the new features of 3.11 all at once.

If this a test upgrade, why not a clone of the original? https://docs.moodle.org/24/en/Moodle_migration tells you how to make a clone. Since you've already tried once, Facing issues while trying to get Moodle 2.4 & compatible Xampp version running, a slow (second) start would be prudent. Listen to Ken.

Average of ratings: Useful (1)
In reply to Visvanath Ratnaweera

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Ah, I get it now. I apologise for using an anonymous account and I'll make sure to use my identity next time, but I have one last question. Every time I have to upgrade Xampp on Linux, I would have to delete the /opt/lampp contents which includes moodle and moodledata then paste the two back to the upgraded Xampp folder. Is this the only way possible to do so?
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

The OS is Linux ... will call that 'native' ... including it's package manager - the app to install/remove software (apt, apt-get, rpm, yum, dnf).   Goal: install LAMP stack + moodle.

Now on your Linux (you've not shared what distro - I hope a long term support version of whatever) you've chosen to use XAMPP to install the AMP stack ... that's apache (or nginx/litespeed), MySQL or MariaDB, and PHP (along with Perl and Python).

So it's native AMP + moodle vs XAMPP which installs AMP + moodle ... which is the better route?

My take ... 'native' - using the OS package manager with additional well known repo's for things like PHP and MySQL.

When going a one off route (XAMPP), then one is kinda restricted to use documentation from that one off route - don't get confused with other tutorials for native!!!!   Example: the XAMPP stack gets installed in /opt/ and inside there apache/mysql/php.

Ok, might be easier to get started but that's tip of a deep iceburg when it comes to the overall OS ... you'd be using a bunch of shell scripts in XAMPP just for that stack + native package manager for the rest of your OS.   That's a two step ... rather than one.

Have seen beginning admins think that XAMPP is all controlling and 'forgot' about updating/upgrading kernel and other ... which is why they got hacked/owned etc.

If one looks at recent issues with major compromises and investigations as to why they happened and how they could have been avoided, the number 1 reason was 'failure to fix or patch' - the OS ... not just the apps!!!!

But ... that's me ... old dude who likes the KISS theory ... 'keep it simple stupid'.  And will confess, learned that the 'hard way' ... I quit looking for 'short cuts' when building a server and used 'native'.   Have never regretted that ... to this day.

But ... it's your choice ... just remember you pick your own poison! smile

'Spirit of Sharing',  Ken



Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Replying to the Git post here too:
Alright you've got me convinced now haha! I realised that when I work on the live site, I will have to upgrade moodle using git since it's the most convenient method. The site I'm working on right now is a fake site which isn't live, with fake data and fake users. I went through the (https://docs.moodle.org/311/en/Git_for_Administrators) article you provided, and from what I can infer, I have to perform the "Obtaining the code from Git" and "Updating your installation" instructions provided.

And for Xampp:
I am running Ubuntu 20.04.3 LTS and Xampp 5.5.38 as of now. So I would have to upgrade Xampp thrice, once before moodle 3.5 (to 7.0), before moodle 3.9 (to 7.2) and before 3.11 (to 7.4). But I still haven't understood how to do it... can you provide any link to a tutorial which can explain it if possible? I was thinking of following this answer I found on the internet:

> if you are using xampp older version and need to upgrade it to newer one you donot need to worry in ubuntu just download the newer version and run the command: ./xampp.run
it will automatically upgrade the last installed xampp in location /opt/lampp
I'm assuming this preserves everything in /opt/lampp/htdocs/ which contains the moodle files
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, see you've now shared what you are running on clone box ... highest Ubuntu.

Now to get 2.4 of moodle running on that modern OS, an old ... very old ... XAMPP would have to be used.

"I'm assuming this preserves everything in /opt/lampp/htdocs/ which contains the moodle files"

There's that gotcha term ... 'assume'!  Well, nothing like learning by doing ... even if it fails ... cause you have learned what NOT to do! (unpleasant way to learn, but lessons learned that way stay with ya for a lifetime!  We 'old dudes' say ... 'been there, done that!' *NEVER AGAIN!*)  

So if you are going to 'assume', then learn one thing before ... backing up the moodle ... code + db dump + moodledata directory an archive those backups away from XAMPP.  And know how to restore that backup.

Hmmm ... this is getting deeper and deeper in that iceburg I mentioned! smile

'SoS', Ken

In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Yeah, I guess trying it is the only option left now lol. I've backed up the data as mentioned in https://docs.moodle.org/311/en/Site_backup
and stored it in an external drive. How do it restore it though, in case things go wrong- https://docs.moodle.org/311/en/Site_restore as provided by Mr. Ratnaweera, is what I would follow if I need to.  
Thanks a lot for your help Ken, and  Mr. Ratnaweera! I will come back here if things go wrong, but I don't think they will, since the help you've provided seems to have been sufficient!!
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

'come back here' ... suggest for moodle only.  But even then, you'll have to share what the XAMPP forums/people said or what you did ... at least for me.   If an issue is with running a .sh script that came with XAMPP ... then XAMPP forums. 

Best resource for XAMPP is their stuff on internet - where ever you found info on running that .run command.

One more piece of advice ... burn a recovery CD for your OS or make a recovery USB stick for your OS.   You might need it!

Am still curious as to why you acquired moodle 2.4 - guessing that came with the XAMPP package you downloaded.   But not curious enough for a response!!! smile

Wishing you 'Happy Trails!' smile

'SoS', Ken


In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
This is what I found on XAMPP forums for linux:
> Sorry for bad news - but actually you have to start from scratch. Xampp does not provide update procedures, you have to uninstall the old release and install the new release. Also backup all your HTML files and PHP scripts, as well as all databases, and maybe some configuration settings.
The "easiest" way for me is to stop Xampp, rename the /opt/lampp folder to /opt/lampp-old (or whatever), then install a new lampp. Finally copy the whole /opt/lampp-old/htdocs folder to the new release (/opt/lampp/htdocs, previously rename the newly installed htdocs folder to htdocs-original or so) and same for the mysql data, copy the whole /opt/lampp-old/var/mysql to /opt/lampp/var/mysql (and also rename mysql folder from newly installed Xampp before). Be sure to keep the same file permissions and users of the copied folders.
If you are lucky, you are done. Try to start Xampp and see, if your projects are running. If it fails, you always can undo the renaming of lampp to lampp-old and restore the old Xampp environment.

So I'll be following this to upgrade xampp during the march. I'm beginning with the march now, I want to clarify though, using git for the upgrades:
$ cd /path/to/your/webroot
$ git clone git://git.moodle.org/moodle.git (1)
$ cd moodle
$ git branch -a (2)
$ git branch --track MOODLE_27_STABLE origin/MOODLE_27_STABLE (3)
$ git checkout MOODLE_27_STABLE
$ cd /path/to/your/moodle/
$ git pull

I simply have to enter these right, to ugprade to 2.7? And for the other versions replace 27 by the version number without decimal point?

> Am still curious as to why you acquired moodle 2.4 - guessing that came with the XAMPP package you downloaded
No, it's I'm doing this for a place I'm working at. The job is to upgrade their moodle site to the latest version, but I guess they want to see it get done on a sample site first. It's a bit weird, I know haha. Since I'm doing this march on a sample site where themes are not a necessity (they want to see if the course data is preserved after the march), can I skip the part of keeping the themes?
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

"The job is to upgrade their moodle site to the latest version, but I guess they want to see it get done on a sample site first. It's a bit weird." - NO ha! ha!  They do have reason for concern.  Not an un-reasonable requirement if they have $$$$'s invested.

Since we now know this use of XAMPP isn't a tinker thing just for you, it's something for a 'customer' ... and I assume that means you are getting paid to do this!

So before going further with answering your questions concerning the plan for XAMPP, what is the setup of the customers site?   Is it also XAMPP?   If not, suggest you'll hit a snag/snafu when doing their site - git acquired or not.

'SoS', Ken


In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
> So before going further with answering your questions concerning the plan for XAMPP, what is the setup of the customers site? Is it also XAMPP? If not, suggest you'll hit a snag/snafu when doing their site - git acquired or not.
The thing is, they'll let me know once I've completed the migration here, so I'm not really sure about the details of the main site, hopefully it isn't different to my setup. The commands I mentioned are all I need to enter for each successive upgrade?

> Since we now know this use of XAMPP isn't a tinker thing just for you, it's something for a 'customer' ... and I assume that means you are getting paid to do this!
Yes, I hope so lol!
In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Before going down what could be a very deep rabbit hole, find out (know for sure) what 'customers' environment is.  Case in point ... a 'customer' contacted me to upgrade their moodle(s).  Come to find out, after getting access to cPanel, their operating system, called 'cloudlinux' was CentOS 6 - which reach end of life years ago.

BTW, since I was familiar with the OS and git, was able to upgrade their moodles but no higher than 3.9.highest.   The OS upgrade has to be done by provider.

Now the git commands question ... IF you copy and paste, those won't work.   If the moodle code was not initially installed via git, those won't work.

And since you are getting paid, time to do some research .. hint: 'side load'.  Won't expand that hint ... time for you to earn what you might get from 'customer'.

'SoS', Ken

In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
If OP can not get old versions of dependent software for old Moodle releases, either he has to fall back to older versions of his platform (XAMP) or change the platform and/or versions. I don't know what else there so say.
In reply to Visvanath Ratnaweera

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Not disagreeing with ya Mr. V ... smile   some more thoughts ...

Or, the customer could allow consultant access to server AND clone the production to another domain for 'march' testing, knowing that one could only go so far due to PHP/MySQL versions.   Since that clone would be on the same server/environment, customer could actually see it.   That all dependent upon customers environment ... since it is moodle 24 (ancient) imagine what shape PHP or MySQL is in ... as well as the OS - server could be hacked right now and they don't know it!

Might doing the customer a favor by pushing them forward sooner ... rather than later!

Might be a better plan to get new server ... spin up a fresh 3.11 and try their hand at restoring courses with/without users, with/without some plugins.

My 2 cents!

'SoS', Ken

 

In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
What I am saying is that the OP has to face the facts. Like for example, Moodle rel. 2.7 needs PHP 5.4.4 to 5.6.last. There is no other way!

If the OP stays with XAMPP, then he needs a XAMPP with PHP 5.4.4 to 5.6.last. I don't know whether there is such a thing, I do the march by migrating the Moodle instance through a number of historical Debian LAMP VMs.

I am talking of https://docs.moodle.org/27/en/Moodle_migration as the subjects suggests. Course backup and restore is a different thing.
In reply to Visvanath Ratnaweera

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

See, your approach:

"I do the march by migrating the Moodle instance through a number of historical Debian LAMP VMs."

is 'native' ... which is better than once removed XAMPP stack (closely related to Bitnami and or other similar 'easy buttons').   For your 'customers' (that run Debian) you would have no issues and you could provide efficient and timely support! smile

'SoS', Ken

In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

You've already gotten good responses ... this to confirm ...

Checks ... after each hop upwards, stop and check the site.   Update any additional plugins (that is also something you might need to check - if the addons you are using have a compat version with destination version).   One of those could be theme, thus best if you set the theme to whatever comes as default with version number.   If theme gets in the way on a hop, safe bet is to edit config.php and add a line to force the use of boost for entire site just for the 'march'.

$CFG->theme='boost';

At each hop stop, recheck environment - Site Admin Menu, Server, Environment ... update component.   Make sure that you have required DB server and PHP versions + extensions.    If not, upgrade those before attempting next hop.   See Mr. V's blog link.

Backups ... after checking each hop upwards, you don't want to loose ground you've gained, thus do a minimal site backup which is code, DB dump, and the first time you backup, moodledata/filedir/  (that last item might be large so it's also a good idea to check disk space).

Over the last month, I've performed 2 'marches' ... so this info is fresh on my mind. smile

One last piece of advice ... take it slow ... don't get in a rush.

Now some questions for you ... is this 'march' to take place on a Linux server?   Do you have access to terminal on the server?   Does your environment have 'git'?

If question responses are 'yes', might be worth your time to investigate the use of git to do the upgrade 'march'.

Please see: https://docs.moodle.org/311/en/Git_for_Administrators

'SoS', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Thought I'd better follow up with some more detail about themes and setting default theme in config.php ... before you begin the 'march' ...

2.4 through 2.6 - set config.php to $CFG->theme='base';

afterburner, splash, anomaly, standard, arialist, standardold,
base, leatherbound, binarius, magazine,
boxxie, mymobile, brick, nimble, canvas, nonzero,
formal_white, overlay, formfactor, serenity,
fusion, sky_high

At one time, it was thought to have all of the most popular themes 'pre-loaded' but I never did see that thus ... seem to re-call that everytime I checked plugins, many of the above themes which did not exist in the theme directory would show they were to be deleted ... but never were!  Had to resort to manually editing mdl_config_plugins table removing rows for them to finally make them disappear on plugins check.

2.7 * big change * The config.php file still holds
base,bootstrapbase,canvas,clean,more

3.4 first appearance of boost - once at that version set default to boost
remove or comment out the theme line in config.php

3.7 just boost and classic - through and up to 3.11

Anyhoo, themes an example of little things one might have to be aware of and/or do in a 'march' as long as your's will be.

Hopefully, the 2.4 you begin with doesn't have tons of addons/plugins!

And if I didn't say it ... will now ... using git is by far the easiest way to 'march' a moodle - especially the 'march' you are about to take.   Hardest part of using git before a 'march' is getting the hidden .git directory and related .gitxxx files into a 24 code directory ... but you could make the first hop using git from 2.4.whatever to a git acquired 2.4.highest and then use git from then on out!

Anyhoo .... just my 2 cents!

'SoS', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Thank you so much for giving the time to write out such a detailed guide Ken! Yes I am running Linux but the site isn't "live", it's just a demo site where I'm simulating the upgrade, after which I will work on the actual site. It has only one plugin and isn't really large sized, but I've still backed up all the data and code. I was planning on upgrading it using the upgrade guide (https://docs.moodle.org/311/en/Upgrading) without Git, since I haven't set it up on my computer yet. The upgrade procedure still looks relatively simple without Git (since my site doesn't have much data, no themes and just one plugin), and I will surely consider using it in the live site! Is there any disadvantage to using this method? Please let me know! 
Also:
1) what did you mean by the following : 
>afterburner, splash, anomaly, standard, arialist, standardold, 
base, leatherbound, binarius, magazine, 
boxxie, mymobile, brick, nimble, canvas, nonzero, 
formal_white, overlay, formfactor, serenity, 
fusion, sky_high

2) >before you begin the 'march' ...

2.4 through 2.6 - set config.php to $CFG->theme='base';

I don't have to perform this right, since I don't have any themes on my site?

In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Hmmm ... always there is more than meets the eye! :|

"Is there any disadvantage to using this method?"

Look at the number of steps and what one has to do following the 'typical' ... basically, move code folder to code.old, download the .zip or tar.gz (linux should use the .tar.gz), uncompress, use FTP to upload to server, .... blah, blah, blah.

First ... that's download then upload ... and there have been many who have uploaded in the ASCII mode rather than binary mode.   That's 2 steps rather than one!

Concept ... where one can always use server to server.  One less step and also less prone to human error.

I follow that concept using git .... server that has the moodle code stays right where it's at and using git I am pulling from the moodle repo code directly into the local code and on the fly, git removes files no longer needed, updates files that need updating, and adds new files as well.  No 'prone to human error' there.  Compare blah, blah steps to one command: git pull [ENTER].   To me, git wins! smile  Besides that, there are other php scripts in admin/cli/ of acquired code that installs or updates or upgrades without your web service getting in the way.   Just php scripts talking to DB server and DB for Moodle ... another 'win' in my book! smile

If you have moodle code, you have themes ... period.  All those I listed were popular themes from 1.9 that got into version 2 of Moodle ... and like I said, at one time, it was thought to provide them all ... one less step/thing for admin of server to do - which didn't quite work as planned.   At least, that was my experience - from what I recall.  We are talking 8 years or so ago! :|

Now to your posting about XAMPP ...

'SoS', Ken

In reply to Prathmesh Singh

Re: Upgrading from 2.4 to 3.11

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, questions for ya ...

Where is your clone?  ... on public internet where it can be reached by anyone on the globe?

Where is server that you will perform this march upon?  Is server in a closet where you could go into closet and physically touch the server?

What distro is the server?   uname -an as root user.  What is distro of your clone?  Same command.

If server is remotely hosted, with what Provider?   It's ok to name names here ... not all providers are alike.

'SoS;, Ken

In reply to Ken Task

Re: Upgrading from 2.4 to 3.11

by Prathmesh Singh -
Q) Where is your clone? ... on public internet where it can be reached by anyone on the globe?
A) No, it's not really a clone, just a sample site running moodle 2.4 which I created myself, and it is offline, and can only be accessed by me.

Q) Where is server that you will perform this march upon? Is server in a closet where you could go into closet and physically touch the server?
A) Since it's offline, I'm working on my computer and it isn't connected to any server. I am not equipped to deal with servers haha