How do I setup moodle on Linode?
1 Reply
This is a document in progress and installation instructions may not work as-is
Moodle requirements
Moodle has some decent documentation for setup, and I was able to find the hardware requirements in their Installation Guide. Here's a Moodle forum post re: hardware and users, and according to one user, they recommend 1GB of RAM per 50 concurrent users. However, these types of performance benchmarks will depend on your particular use-case.
For software, they need you to already have a functioning webserver, running Apache, Nginx or something similar. Here are the rest of the server requirements: https://docs.moodle.org/dev/Moodle_3.8_release_notes#Server_requirements
Please also see this performance recommendations guide provided by Moodle.
Linode plan recommendations
I was going to suggest a Standard Linode plan, which falls under your use-case (web app). Depending on your optimization, you may be able to get away with a 2GB Standard instance, but otherwise a Standard 4GB will meet your needs.
Please be aware that you can resize your plan at any time. This will let you play around with the plan type. If you follow the steps for stress-testing (found below), this will help you determine your optimal plan size.
Setup
We can get you started with our One-Click app for LAMP stacks. LAMP stacks are an Apache webserver with a MySQL database and PHP already installed. According to the referenced Moodle docs, you can install Moodle on a LAMP stack. Our One-Click App will install on Debian 9.
If you want to setup your LAMP stack manually so you know how all the pieces fit together, here's a manual setup guide for LAMP stacks: https://www.linode.com/docs/web-servers/lamp/how-to-install-a-lamp-stack-on-debian-10/
Installing Moodle
Once you have your LAMP stack installed, you will make sure all your packages are up to date:
# apt update && apt upgrade
Next you will want to install Git so you can use it to obtain the code for Moodle.
# apt-get install git
Set Hostname
# hostnamectl set-hostname moodle
Add a Limited User Account
# adduser moodle
You will be asked to create a password for the moodle user
# adduser moodle sudo
This will allow moodle to use adminstrative priviledges.
This page provides the instructions I followed for installing Moodle after setting up my LAMP stack with One-Click Apps.
# cd /var/www/html
# git clone git://git.moodle.org/moodle.git
# cd moodle
# git branch -a
# git branch --track MOODLE_38_STABLE origin/MOODLE_38_STABLE
# git checkout MOODLE_38_STABLE
The version of Moodle we just installed requires at least PHP 7.1.0. You should be good to go if you manually installed a LAMP stack, but Debian 9 provides PHP 7.0.33, so we will have to upgrade it.
If you are running Debian 9, you will need to use the SURY package repository which offers PHP 7.4 / 7.3 / 7.2 / 7.1 for Debian operating system. We will install version 7.3 to keep things consitant because that is what is provided by Debian 10. I got the instructions for installing PHP7.3 here.
# cd
# apt install -y curl wget gnupg2 ca-certificates lsb-release apt-transport-https
# wget https://packages.sury.org/php/apt.gpg
# apt-key add apt.gpg
# echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | tee /etc/apt/sources.list.d/php7.list
# apt update
# apt install -y php7.3 php7.3-cli php7.3-common
# update-alternatives --set php /usr/bin/php7.3
# apt install -y php7.3-mysql
You will now want to configure Apache2 to use PHP7.3
# a2dismod php7.0
# a2enmod php7.3
# systemctl restart apache2
You will want to follow the instructions here to
You should now be able to go to your browser and use your IP address to start using Moodle:
http://YOUR_IP_ADDRESS_HERE/moodle
Optimization and testing
After getting your LAMP stack and Moodle installed, you'll want to work on optimization and stress-testing.
I'd refer back to the Moodle performance page, but here are some additional resources:
- Boosting Moodle Performance – Tips To Speed Up Your Moodle Website
- Cloudways Tips To Speed Up Your Moodle Website
- 5 simple ways to reduce Moodle load times
You can then stress-test your website to get an idea of how well it's performing. Our Community Post - How Do I Test My Websites Performance to Find Max # of Users should be enough to get you started.