Upgrade Moodle

Upgrade Moodle

by James Elsmore -
Number of replies: 24
I just installed Moodle on Turnkey Linux.  I was able to find an image that had it all together. I know VERY little about Linux so struggling. The user that has asked for Moodle said I need to upgrade to latest version.  I have no idea how to do it on Linux.  I would appreciate so much if anyone could help me find instructions on how to do it with Turnkey Linux or has some commands I could run.

Thank you so much!  This has been quite a learning curve trying to figure this out.
James
Average of ratings: -
In reply to James Elsmore

Re: Upgrade Moodle

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
While some of the docs are a little outdated, the basics still hold true so you should start there - to make your life easier, I would suggest looking at installling with git. You should start by telling us what version of Moodle you are on currently and what version you need to upgrade to. You will need to look at the release notes for each version to make sure that you don't need to do some intermediate jumps. Turnkey looks to be based on Debian. If you just installed, I am presuming that maybe you used some built in installer - bad idea...we cannot support those as they tend to add scripts and such and we have no idea exactly what they do or don't do. If you installed manually, you are going to do a lot of the same (download software, copy over plugins and config file, remove old moodle folder, rename new folder to what the old one was named, and visit site to upgrade).
In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

That all-in-one appears to be Debian based Linux.

Came with Webmin as a panel.   Is that running?

And according to their info page on the TurnKey image for Moodle, the code should be  located in /var/www/moodle

Don't think the info page said what version of Moodle so let's check.

Login to server via ssh/terminal

cd /var/www/moodle [ENTER]

fgrep '$release' version.php

What do you get returned to you?

Also to check things:

php -v

mysql -V

There could be a checks.php script in:

/var/www/moodle/admin/cli/

run it with: php checks.php [ENTER]

What does that return?

Agree with Emma that using git for maintaining versions of moodle is the way to go, but you might have to do a 'side load' of moodle git acquired code.

Gotta see where you are before giving advice on going forward.

'SoS', Ken


In reply to Ken Task

Re: Upgrade Moodle

by James Elsmore -

Thanks for the help!!  


Ken, I ran the command.  3.9 Build 20200615

In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Perfect version for a side load of git so your updates/upgrades will go a lot smoother - other factors pending.

Sent you a PM.   Please respond there!

'SoS', Ken

PS - used to live in Fairborn, OH.   Now in San Antonio, Tx.  smile


In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

When one uses an all-in-one, one gets the OS etc. that was current the date they made the all-in-one package.

Thus, the hat only you will wear of system admin, which isn't the same as Moodle Admin, falls to you.

Like ANY OS, updates/upgrades are required for a secure server ... since you are in .gov, think that is probably a high priority.

So with that in mind, something for admin of the system.

https://www.debian.org/doc/manuals/debian-faq/uptodate.en.html

Pay attention to updates to apache, mysql/mariadb, and php as those are what makes the Moodle go ... or not go.

Some other things ... which would affect moodle ...

Memory of server ... free space available.

free

df -h

Then there is moodle.

According to manifest, git is installed and your version of moodle is the first of the 3.9 branch .... a .0.   So it is advised before going to 4 (if that is the decision) to update the 3.9.0 to the highest in that series ... which is now 3.9.16 (Build: 20220822).

Side load: (before you do the following, make a tar ball backup of moodle code and moodledata + an sql dump of the DB)

cd /var/www/ where you can see the moodle directory.

Then issue:

git clone git://git.moodle.org/moodle.git moodlegit

cd moodlegit

git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE
git checkout MOODLE_39_STABLE

See that the branch is MOODLE_39

git branch -a

* should show it is 39.

Now the side load:

still in moodlegit

cp the hidden .git directory and the other hidden .git files to the original moodle code directory you have

cp -rp .git ../moodle/

cp -rp .github ../moodle/

cp .gitattributes ../moodle/

cp .gitignore ../moodle/

now cd ../moodle/

to make sure we are on 39 we will repeat some commands:

git branch --track MOODLE_39_STABLE origin/MOODLE_39_STABLE
git checkout MOODLE_39_STABLE

now this one ... important ... don't skip

git reset --hard

Check:

fgrep '$release' version.php

and

git branch -a

If those check out, we upgrade via command line

php admin/cli/cron.php

let that run until completed - you may not have setup cron job for it yet - you need to later!

php admin/cli/maintenance.php --enable

php admin/cli/upgrade.php

That will update tables and run through default settings.

php admin/cli/maintenance.php --disable

Now hit site with web browser and login.

Check things out ... all OK?   Got any plugins installed already?  Update those.

Then take another backup and this time the tar ball archive filenames and the sql dump file name reflect 3916 in the name of the files so you know what version the backup is.

a bash shell backup script run from code root:

# 3.9.16 (Build: 20220822)
tar -cvf /backup/m39/moodle-code-3916-$(date +%Y%m%d%-H%M%S).tar ../moodle
tar -cvf /backup/m39/moodle-data-min-3916-$(date +%Y%m%d%-H%M%S).tar /var/www/moodledata/filedir;
mysqldump -u root -p'????' moodle > /backup/m39/moodle3916-db-$(date +%Y%m%d%-H%M%S).sql;

Above won't create the directories ... up to you.  And you adjust whatever

Assumes moodledata is located in /var/www/

Ask your true Moodle Admin person to login and check things out.

Once approved ... decision point ... do you really need to go to 4.0.3+?

https://docs.moodle.org/dev/Releases

3.9 is a LTS and supported til Nov 2023

If your entity has never used Moodle before, then upgrading to 4 will really won't be 'a shock' ... go ... upgrade.

*** VIA GIT ***

https://docs.moodle.org/400/en/Git_for_Administrators#Upgrading_to_a_newer_major_release

Sent you my contact info via PM.

'SoS', Ken


In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Think you might be the only person who has used TurnKey in a while.   Folks are always looking for an easier way.   You might have found one ... depending.

So how's it going or gone?

Curious minds wanna know! smile

'SoS', Ken

In reply to Ken Task

Re: Upgrade Moodle

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Haven't seen it either. Here is a review, albeit from 2012: https://distrowatch.com/weekly.php?issue=20120702#feature.

Quote: Each virtual appliance is indeed a pre-configured, self-contained module. However, instead of plugging these modules into a base install as we would when adding a LAMP package to a minimal server distribution, what TurnKey does is supply ISO images and virtual machine packages which supply the entire base operating system with one specific service. Each appliance not only supplies the required software, libraries and configuration, it also includes the underlying operating system. This approach means each appliance needs its own machine (virtual or bare metal), but it also means we can install and set up a complete software stack within five minutes with almost no configuration or documentation required.

So the TurnKey Moodle "module" is a virtual appliance, starting from the OS, Debian Linux, headless server. I expect it to be that, a Debian minimal, AMP added, Moodle installed. As documented in https://docs.moodle.org/en/Installing_Moodle_on_Debian_based_distributions. Here is the documentation to the TurnKey Moodle appliance https://www.turnkeylinux.org/moodle. Based on Debian 10 "Buster". So a major dist-upgrade to Debian 11 "Bullseye" is waiting.

As with all the full-packages, they will run instantly, but to do major changes like upgrades, either you understand the underlying system, or you replace the whole thing with the latest. I don't know whether they provide a migration path for the Moodle site. Then the path is https://docs.moodle.org/en/Moodle_migration.

I never understood the math behind such decisions. Let's estimate generous 5 hours for a Moodle beginner who knows basic Unix CLI to get a Moodle server running is reduced to 1 hour by taking a "package". Yes 80% reduction. Marvellous! But as a fraction of the hundreds or even thousands of hours maintenance to come, how much is that?

In reply to Visvanath Ratnaweera

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Agree ... but ... Turnkey (TK) is better (IMHO) than Bitnami where upgrading the app requires upgrading the entire stack.   Ugh! 

With Turnkey's manifest see that they included Webmin - was really curious to find out what TK had done with that ... it has web based interface into package manager via Perl which one could set to auto (pain points might be getting PHP/MySQL or MariaDB upgrades on auto which are too high for version of Moodle).  Would ease the pain of updates to the OS.

Plus, Webmin has cron interface, a MySQL/MariaDB tool, and custom commands where single buttons can be pointed to scripts (bash shell or even mysql queries), as well as a Terminal interface (not good for running bash shell scripts to update/upgrade moodle core code via git, however. :|)

Still, the moodle code provided probably doesn't include git repo ... never really understood why the downloads from Moodle.org don't include the hidden .git repo. 

TK does offer Virtualbox images ... IMHO, perfect for testing setups and learning CLI.

Anyhoo ... hope the OP returns to share his experiences!

'SoS', Ken


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

Re: Upgrade Moodle

by James Elsmore -

Thank you all for the responses! I haven't had time to mess with it much.  I am going to attempt to do more, but we might end up hiring a consultant that knows Linux to try and help us get this all set up. The user wants the web server portion set up. I am a windows server person, so Linux is like trying to learn a foreign language.  


James

In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Well ... if you'd care not to use contact info shared with you in private messaging in this forum, then one last parting resource if you intend to keep your TurnKey install:

https://www.turnkeylinux.org/consultants/register

which is a place for folks that have Turnkey appliance experience/skills to become an 'approved' support person.  Am assuming there is a way to seek such persons somewhere on TK site(s).

TIP of an iceburg for Moodle.

'SoS', Ken

 

In reply to Ken Task

[OT] Niche Linux distributions

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators

[OT]

Hi Ken

I hope, nobody is offended me calling TurnKey GNU/Linux a niche Linux distribution. As of today, it is ranked 132 out of the 250 odd active distributions. I was almost going to look at it, since TurnKey comes as virtual images, starting one in VirtualBox would have been simple. Instead I chose a different one, for a different reason. The reason was an "old" Acer Aspire One Pro 531, a netbook built 2010, which still looks as if it is only a couple of months old. Even the smaller battery (3 cell) still lasts 100 min. The netbook originally came with Windows XP Pro, and now orphaned. A friend of mine installed antiX, which is the no. 1 recommendation on DistroWatch for old computers and ranks 15 in the overall list. But was virtually unusable. It would have been a waste to throw it away. I took a chance and tried no. 2, Q4OS.  4.10 Desktop "Gemini". I'm so much surprised by the result. The tiny laptop is very much usable - and a beauty!

Here are the specs: Intel Atom CPU N270 1.6 GHz, Linux shows two threads, 3192 bogomips each, i686 - 32 bit of course. 2 GB RAM. A big plus is the 120 GB SSD some previous owner has spent. After starting Firefox and two shells it still consumes only 684 MB RAM. Browsing moodle.org in Firefox it rises to 780 MB. And this is still Debian 11 from what I saw.

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

Re: [OT] Niche Linux distributions

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Well, you're right. I have been known to say "use what everybody else uses".

As you are probably aware, it's not a Linux distro at all. It's a bunch of scripted builds for various, popular apps. We all know how that is going to turn out. 

The answer here is "ask Turnkey linux for support". They built the thing; hopefully they support it. 


They had me at line 78. They know not what they do...
Average of ratings: Useful (3)
In reply to Visvanath Ratnaweera

Re: [OT] Niche Linux distributions

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I think I have that same Acer netbook. Like you, I replaced the XP Pro, and switched to Linux and used it to run my 3D printers. Without going and turning it on, at the moment I cannot remember which number, but it was Ubuntu desktop. I think it was 14 and later upgraded to 15, but I haven't tried to print anything for a pretty good while. I was very pleased with how well it worked.
In reply to AL Rachels

Re: [OT] Niche Linux distributions

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi AL, you are our ultimate gadget man. ;)

About Ubuntu Desktop running in this, that is something I don't understand. 10 or more years ago the Ubuntu Desktop, which is not known for sparing resources, ran perfectly on this hardware. Today the main stream Linux desktop distributions won't run. One has to look for distributions specializing for old computers. Even they don't run very fast. When I work in the shells and browse a couple of sites, sometimes playing videos, the average load is anywhere between 3 and 5!

Whatever, this netbook is a nice toy, to show off to the local Linux geeks!
;)
In reply to Ken Task

Re: Upgrade Moodle

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
That is a great concept. I have tried to talk Martin into doing something like that for Moodle!! A place where all of us small time consultants can offer up our services.
In reply to Emma Richardson

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

@Emma

Not saying it's not a bad idea ... but ...

Nearest thing to it ...
https://moodle.org/mod/data/view.php?d=54

But, here we go again ... 'devil's advocate' ... who checks up on
consultants offering services?  Over the years have seen hosting providers
claim they have engineers with years of experience in hosting moodles - quasi MP.  Not true.   Matter of fact, was sub contracted by customer!!!

And would such a place put a small dent in the revenue flow of a certified Moodle Partners?

I'd say that any one of us who are trying to help this OP could do and are qualified.

Anyhoo! smile

'SoS', Ken


In reply to James Elsmore

Re: Upgrade Moodle

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Hi

I was going to ask you what exactly "The user wants the web server portion set up." means. After re-reading the OP, I think, I understand what is happening. You wrote there:

> I just installed Moodle on Turnkey Linux. I was able to find an image that had it all together. I know VERY little about Linux so struggling. The user that has asked for Moodle said I need to upgrade to latest version.

So, this is about a installing a _fresh_ Moodle site. You'll find countless methods under https://docs.moodle.org/en/Category:Installation. Unfortunately TurnKey GNU/Linux is not one of them. Which means, either the helpers here don't know TurnKey or they don't recommend TurnKey. Either way, if you go that path, then you have to go on your own. Not that installing Moodle on Linux is rocket science, but if you are new to both, Moodle and Linux, the climb will be vertical.
;)

In reply to Visvanath Ratnaweera

Re: Upgrade Moodle

by James Elsmore -
Can Moodle be installed on a Windows server? And can it be configure to use IIS for web services?
In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Yes, it can be installed on Windows ... IIS, MSSQL, but then PHP isn't native to Windows ... M$ is no longer providing PHP drivers and neither is PHP folks, from what I have read ... even though the ads say 'M$ Loves Linux'!  

https://docs.moodle.org/310/en/Windows_installation

https://docs.moodle.org/400/en/Complete_install_packages_for_Windows

Docs are outdated and am not sure anyone willing to update them.

Wanna get something easy ... WSL2 (linux subsystem 2) ... easy install of Ubuntu - or so it's said.   But is that a production setup?  or a Tinker machine?

Uhhh .. there is no Windows forums here.   And if you really look, one will see more docs for Ubuntu than any other OS.

Easy install is but tip of iceburg!!!!   Am sure you know that admin'g Windows servers!

'SoS', Ken


In reply to Visvanath Ratnaweera

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

@ Mr. V ... Re: OT and offending me about 'nitch' ...

Curiosity got the best of me ... TK offers a VB image so I loaded it up in my VB on Mac Monterey ... sigh ... networking broken so I really couldn't test git sideload, git update, nor git upgrade for first hand experience, but it appears quite doable.

They have a configsys kinda thing where one can setup the system ... root password, mariadb root password, networking, etc.  And it displays, once configured, the info to access ... like:

http://IP

https://IP

webmin: same with port 12321

PHPMyAdmin same with port 12322

ssh root@same - port 22

Moodle code 3.9.0 preinstalled and configured incorrectly ... that's because of networking.  TK doesn't know how you are going to set it up ... internal lan with private IP under VMWare or whatever.

See screen shot attached.

So with a little effort, OP could get it working.   BUT ... if hiring a consultant just for this ... me thinks 'out of the pan and into the fire'!   To the OP ... it's a 'blackbox' ... I can't tell you the number of Moodle setups I've done and tried to teach those that would be responsible 'just enough' linux/webmin/where scripts were located and what they did (git update/git upgrade/site backups), BUT server remained a 'blackbox'.   In some cases a testament to the punishment a linux server can withstand ...and still run!!!   Normally I'd be contacted 2-x years later, with a plea for assistance ... many already saying in that plea they can't afford much for technical assistance ... hmmmmm ... last I saw they were selling courses @$500.00 a pop!    Hmmmmmmmmm.

As far as 'niche' ... TK might rank better than Bitnami ... but ...

OP is certainly free to do as they see best, however!

'SoS', Ken



Attachment turnkeymdlconfig.png
Average of ratings: Useful (1)
In reply to Ken Task

Re: Upgrade Moodle

by Visvanath Ratnaweera -
Picture of Particularly helpful Moodlers Picture of Translators
Yes, the following code is in config.php:

$protocol='http://';
$hostname='127.0.0.1';
if (isset($_SERVER['HTTPS'])) { $protocol='https://'; }
if (isset($_SERVER['HTTP_HOST'])) { $hostname=$_SERVER['HTTP_HOST']; }
$CFG->wwwroot = $protocol.$hostname;

Very resourceful. You'll learn to love it.
:D

And the origin is here https://github.com/turnkeylinux-apps/moodle/blob/master/conf.d/main, line 78. (Thanks Howard https://moodle.org/mod/forum/discuss.php?d=438038#p1763690.)
In reply to Ken Task

Re: Upgrade Moodle

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
The discussion I had was talking about a application process and a kick back to Moodle HQ. This was a long time ago though - was hoping it would become part of Moodle.net but that is another story!
In reply to James Elsmore

Re: Upgrade Moodle

by Ken Task -
Picture of Particularly helpful Moodlers

Ok, after installing in Virtualbox, I'd say a definite NO! 

TurnKey is for sure an 'appliance' ... uses only TK's repo for updates/installs of Debian software.   Command line tools like dnsutils (which should acquire dig) are handy to have when trouble shooting things.

While there is an option to use 'alternative' - which means Debian native repo's - warn that that could break something - probably would ... but never got that far with this experiment.

Kinda hate to say this, but even BitNami better than TK - IMHO!

So hope you have listened to Emma and are going to do true native instead of something that looks easy on the surface.   Uhhh ... like I said before ... 'tip of iceburg'! smile

'SoS', Ken

Average of ratings: Useful (1)