User Tools

Site Tools


computing:moodle

  • moodle
  • Jonathan Haack
  • Haack's Networking
  • netcmnd@jonathanhaack.com

Installing moodle on a Debian system.


Make sure you have LAMP/FEMP and TLS set up first. Visit here for help with doing that: Apache Survival Tutorial. Okay, here are the pre-requisite packages:

sudo apt-get install aspell graphviz php-curl php-gd php-intl php-ldap php-mysql php-pspell php-xml php-xmlrpc php-zip php-soap php-mbstring libapache2-mod-php

Next, let's download the latest moodle and place it in the web-root:

cd ~/Downloads
curl -L https://download.moodle.org/download.php/direct/stable32/moodle-latest-32.tgz > moodle.tgz
sudo tar -xvzf moodle.tgz -C /var/www/lms.haacksnetworking.com/
sudo mv /var/www/lms.haacksnetworking.com/moodle /var/www/domain.com/public_html

Create your moodle's data directory (one directory outside of web-root) and provide it proper permissions and make it writeable by www-data user:

sudo mkdir /var/www/lms.haacksnetworking.com/moodledata
sudo chown www-data -R /var/www/lms.haacksnetworking.com/moodledata
sudo chmod 0770 -R /var/www/lms.haacksnetworking.com/moodledata

Now, it is time to ser up your database:

sudo mysql -u root -p
> CREATE DATABASE database DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; 
create user 'databaseuser'@'localhost' IDENTIFIED BY 'passwordhere';
> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,CREATE TEMPORARY TABLES,DROP,INDEX,ALTER ON database.* TO 'databaseuser'@'localhost' IDENTIFIED BY 'passwordhere';
> FLUSH PRIVILEGES;
> QUIT;

Now the database is set up, so let's restart the mysql service and while we are at it, let's restart apache2 for good measure:

sudo systemctl restart apache2
sudo systemctl restart mysql

Now we need to temporarily make the Moodle server world writeable so that we can configure it from our web browser:

sudo chmod -R 777 /var/www/domain.com/public_html/moodle

You may get a glitch with Debian which is covered on Moodle.net Forums. If so, navigate here, and edit the php.config file before you continue set-up:

cd /var/www/domain.com/public_html/moodle/
sudo nano php.config

In the first five lines, the configuration specifies “mysqli” and this needs to be changed to “mariadb” instead. Once this is done, you should be able to complete the installation options given on the web page. Once moodle is running, set up permissions:

[Updating Now - please be patient]

1. moodledata directory and all of its contents (and subdirectories, includes sessions):

sudo find /var/www/lms.haacksnetworking.com/moodledata -type d -exec chmod g+s {} \;

owner: apache user (apache, httpd, www-data, whatever; see above) group: apache group (apache, httpd, www-data, whatever; see above) permissions: 700 on directories, 600 on files

2. moodle directory and all of its contents and subdirectories (including config.php):

owner: root group: root permissions: 755 on directories, 644 on files.

If you allow local logins for regular users, then 2. should be:

owner: root group: apache group (apache, httpd, www-data, whatever; see above) permissions: 750 on directories, 640 on files.

This tutorial is a designated “Invariant Section” of the “Technotronic” section of Haack's Wiki as described on the Start Page.

oemb1905 2019/08/01 01:44

computing/moodle.txt · Last modified: 2021/11/20 21:35 by oemb1905