Update your Moodle with only 5 Commands
Vložit
- čas přidán 24. 08. 2024
- Every week, the latest Moodle code is pushed to the GIT repository. Using GIT, it's simple to update your Moodle to the latest code.
The 5 Commands
① cd /path/to/your/moodle
② sudo -u www-data php admin/cli/maintenance.php --enable
③ git pull
④ sudo -u www-data php admin/cli/upgrade.php
⑤ sudo -u www-data php admin/cli/maintenance.php --disable
Note that here I'm updating to the latest weekly build. But this will also work for minor releases (eg. 3.11.1 → 3.11.2).
You're videos are fantastic! I am certainly learning a lot and gaining confidence in using a SSH connection. Many thanks for your sterling work!
Thanks again, SSH is scary at first, but you'll get there. Keep on going!
I am blessed with your video. Thanks a lot and waiting for the next step.
So nice of you to say. Thank you.
Thank you for your excellent explanation, is it possible to pull a specific version of a Moodle update?
Great question! Yes, it is possible. It's easy to checkout any of the branches (for example for 4.2.x with "git checkout MOODLE_402_STABLE"). That will get you the latest code on any given major version. For minor "point" releases it's a bit trickier and you'll need to search "git log" or "git tag" for the specific release you're after. Then to get for example v4.2.4, you would use "git checkout v4.2.4" (however this will not be on a branch and thus updating with "git pull" won't work until you return to a branch). Not a bad idea for a video actually, I'll add it to the to-do list. Cheers!
Hi. Thank you very much for your instructions. Could you please add some instructions for upgrading moodle on docker with docker-compose and nginx?
I will try. Though I need to learn more about Docker myself first. It has been on my to-do list for quite some time though.
Wonderful tips. Could you please do the same for bitnami moodle upgrade on Azure or GCP
An interesting question, thank you. I tend to think that using git is the best way to install and upgrade Moodle. Last I checked, using bitnami to install Moodle will make it more difficult to update/upgrade later. This is mainly because of a need to reinstall any plugins you may have, as well as manually copying config.php if I recall correctly.
So, I might review some of those "one-click" installers at some point (things do change, so it is about time I took another look), but generally my advice up to now has been to stay away from them and use git. After all the command "git pull" is difficult to beat for ease of updating.
Cheers!
Hi there, I have an error log when I try to upgrade, actually I have moved to new server and it does not work with the latest PHP version, so I needed to upgrade. any solution on this one ?
The solution is to upgrade PHP and you have a couple of options. The first is upgrading the actual server software. So if you're on say, Ubuntu 18.04 LTS, you can upgrade the OS to Ubuntu 22.04 LTS. PHP will also get upgraded in that process (caution: you may need to edit your virtualhost file to point to the new PHP manually).
The other option is to update PHP only. I really don't recommend this as none of the other software on the OS will be updated with it. This usually involves adding a new software source (repository) and specifying the version of PHP you want. This route is for masochists or people who for some reason can't upgrade the OS only. If you can't upgrade the OS, fix that problem and get the ability to upgrade the OS. You'll thank me later.
great!
Thank you.
It is possible to update to a specific version?, for example 3.10 to 3.11, or it only update to the last version?
It is possible to go to (almost) any version in Moodle's history. Check out this video where I start at 3.0 and upgrade through each version up to 3.11, setting a world record in the process LOL
czcams.com/video/ga-WOMW42JM/video.html
what if before moodle was updated manually (by changing index.php file) and now when I try to git pull I have an error - not a git repository. What can I do in this situation? thank you beforehand
Great question! I made a video about this exact topic a while back. czcams.com/video/pzqY758UpVI/video.html
Hi, have 4 instances of Moodle running on Debian. I’ve taken this over from a customer site and have it on Esxi. I’m planning on duplicating the vm to have a copy site. And upgrade versions as some are running 3.4 and I’d like to bring them all up to date. Able to perhaps get in touch and assist with the copy site upgrade process. I’m in Australia also
Sure, we should probably do a Zoom call some time and then I can help troubleshoot if something goes awry. Definitely check the environment as 3.4 is almost certainly running on versions of PHP and SQL that won't work with 4.0. The Debian OS will probably need upgrading too.
Send me an email and let's setup a time: adam@wisecat.net
No upgrade needed for the installed version 3.11.8 (Build: 20220711) (2021051708). Thanks for coming anyway!
I would guess that either you haven't run the "git pull" successfully or you were already fully up to date at that time. Maybe try again now.
I am still a newbie on Moodle, may I know how to back up my site? Like, can someone explain it to me thoroughly. Thanks in advance! Great video, btw!
Here is a playlist that's all about backing up your site. Hope it helps!
czcams.com/play/PLUocP1bKm-DuLrOg_HSljgQOpM6Y589Cv.html
Hello, "sudo command not found" What should I do?
Thanks for the video btw.
You may not have sudo access on your server. If you are using a VPS, you should have sudo, but some shared hosting environments work differently. It depends on what kind of hosting you're using.
Hello, how can I find MOODLE path?
The Moodle path will depend on where you (or the installer) installed it.
The easiest way to find out would be to go to:
Site admin > Server > PHP Info
And look down near the bottom for a value with the label:
$_SERVER['DOCUMENT_ROOT']
The document root is the path to your Moodle code.
@@Wise-Cat Thanks a lot. :)
By the way, we are using MOODLE 3.9+ I want to update it following your instructions; a message raises: "It is not necessary any update". Furthermore, when I check its notification, I see a few new versions of MOODLE. It is weird. Is there any recommendation to solve this problem?
@@mutluhanyilmaz6809 Ahh, I see. You have updated your Moodle 3.9 to the latest version on that branch (which is great - bug fixes, security updates are important too), but you wish to move from 3.9 to 3.10 or 3.11, correct?
In that case, I recommend you check a few of my other videos which will guide you in how to do these upgrades safely. First, check your server environment to make sure your server is ready for the future versions of Moodle (see this video czcams.com/video/xd5Y40Nu5FA/video.html ).
Next, if your server is ready check this video on switching branches ( czcams.com/video/wYg3_wxlN28/video.html ). Be sure to take backups before trying anything though, and also make sure your 3rd party plugins are compatible with the newer versions of Moodle.
Hope this helps, and happy upgrading!
@@Wise-Cat Thank you, I am grateful to you for your supports.. :)
I have server on cloudways , how can I update my moodle?
I don't know of cloudways as a service, but it seems they just manage servers on other platforms... Upgrading should be similar to as described in the video, though the path to wwwroot will likely be different.