Setting up a Moodle server in Debian
Getting university IT departments to install Moodle plugins is not always trivial. In order to try out the STACK question type, I decided to set up my own Moodle server on a spare computer running Debian 9 (stretch).
There are some instructions here which are much more helpful than the official Moodle instructions because they cover setting up the LAMP stack you need.
In section 6, there’s now a newer version of Moodle: you should download
https://download.moodle.org/download.php/stable36/moodle-latest-36.tgz
instead of the file they suggest. The latest version is always listed
here. Also, I think
it’s better to create
/var/moodledata/
(and then chown
and chmod
it appropriately)
rather than /var/www/html/moodledata/
.
If like me you are just going
to use Moodle on your server, rather than serving it across the network,
when you hit section 8 you must create
/etc/apache2/sites-available/localhost.conf
with the contents they
suggest (replacing yourdomain.com
with localhost
of course). You
don’t need the line about server alias. If you don’t make this file,
Apache won’t be able to see your Moodle files (apart from the index)
even if the permissions are right.
If you’ve set DocumentRoot /var/www/html/moodle
then opening
localhost
in a browser will then take you direct to the Moodle web
installation page. Alternatively, you can run the installer on the
command line which the official Moodle instructions recommend for some
reason. This is in /var/www/html/moodle/admin/cli/
and should be run
as sudo -u www-data /usr/bin/php install.php
. Whichever way you do
it, you will need to give the web address as http://localhost
not just
localhost
which will be rejected.