Now you have a LAMP stack set up as shown in the post Install Lamp Stack on WSL, installing Moodle is surprisingly easy.Obtain the Moodle code
You can use GIT here but on Linux running on Windows. it is easy to get it using your Windows browser.
- Download the latest zipped copy of Moodle form here https://download.moodle.org/releases/latest/
- Unzip it in a Windows folder ( I will use C:\moodleTemp as my example – when unzipped this folder will contain a folder called moodle with subdirectories)
- Run this command ( replace the first part with your file location )
sudo cp -R /mnt/c/moodletemp/moodle /var/www/html/
- Check with command
cd /var/www/html/moodleand you should see the file structure.
- Create the data directory
sudo mkdir /var/moodledata
- Set up the permissions
sudo chown -R www-data /var/moodledata
sudo chmod -R 777 /var/moodledata
sudo chmod -R 0755 /var/www/html/moodle
sudo mysql -u root -p
- Enter the MySQL root passsword when requested
CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
create user 'moodleuser'@'localhost' IDENTIFIED BY 'moodlepassword';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON moodle.* TO moodleuser@localhost IDENTIFIED BY 'moodlepassword';
Now go to localhost/moodle in your browser to complete the web based install. You will need to enter your Moodle database user name and password and site details. If you have followed these instructions, server checks should all pass – except for the site not being configured as https. Now you can start setting up your Moodle for learning.