Installing moodle on Pi


The latest builds for Moodle on debian only support PHP7.0.0 and above so first we add the repositories for PHP7.0 to Raspbian since only PHP5.4.6(?) is the latest supported version for PHP that comes with Jessie.

Follow the instructions here.

Next follow the instructions for installing Moodle here. The only changes would be the following:

  • Use php7.0 instead of 7.1 when installing the packages (don’t forget php7.0-xml which is not included in the tutorial)
sudo apt-get install apache2 php7.0 mysql-server php7.0-mysql libapache2-mod-php7.0 php7.0-gd php7.0-curl php7.0-xmlrpc php7.0-intl php7.0-zip php7.0-xml php7.0-mbstring
  • To download the tar file via wget use the following command:
wget --no-check-certificate
  • During your installation of mysql-server you will be prompted to input the password for the root installation, if you already followed the previous post regarding OpenEMR then use the same info there. No need to install this into a separate Pi just because.
  • On Step 6, I opted to create a new file in /etc/apache2/sites-available/ named moodle.conf
<VirtualHost *:80> 
    ServerAdmin webmaster@localhost 
    DocumentRoot /var/www/moodle 
    ErrorLog ${APACHE_LOG_DIR}/error.log 
    CustomLog ${APACHE_LOG_DIR}/access.log combined
  • however if you are using this on the same server as the one with OpenEMR then you have to modify the openEMR sites-available config file to add the alias to Moodle.
<VirtualHost *:80>
 DocumentRoot /var/www 
Alias /openemr /var/www/openemr 
Alias /moodle /var/www/moodle 
WSGIScriptAlias /flask /var/www/Flask/flaskapp.wsgi 
<Directory /var/www/> 
Options Indexes FollowSymLinks 
AllowOverride All 
Require all granted 
 ErrorLog ${APACHE_LOG_DIR}/error.log 
CustomLog ${APACHE_LOG_DIR}/access.log combined
  • And then you have to disable the default site config of apache.
sudo a2dissite 000-default
sudo a2ensite moodle
sudo service apache2 reload

Following all of those steps and accessing the IP address of the node will give you this.

Screen Shot 2018-02-02 at 00.05.59.png

Of course the web address will be different depending on your own local IP.

  • Click Next.
  • When prompted for the Database driver select: Improved MySQL (if not already selected), Next
  • If you receive an error and you install a php package or adjust the php.ini, be sure to restart apache after.
  • You can change name of the mdl_ table to something better, but I pressed next by accident and it just continue with the setup, so be careful (not that it would do harm)
  • Once you get the following screen, you’re nearly done

Screen Shot 2018-02-02 at 00.15.18.png

  • You will encounter a long list of OK’s and some check’s but hopefully no errors, like so:


  • The failing test information “mysql_full_unicode_support#File_format, File_per_table, Large_prefix must be fixed before continuing. Luckily they explained the solution here.
  • Once fixed the only problem should be the https but if you are only using this for prototyping, no need to increase security.
  • So click continue and wait a bit. It will start to show a looooong list of packages(?) and info whether they were successfully installed or not. Be patient, this took a long time for me. Maybe 10 min? Just press continue when it fully loads
  • Enter some information for the administrator
  • Then wait for a long while again
  • Edit some front page settings.
  • Afterwards you will be asked if you want to register with but you can skip it.
  • Once done you can select site administration from the side bar and then manage courses to create some tests.

I’ll update if i encounter some problems. I’ll continue adding tests tomorrow.

Problems encountered:

  • If you will move the raspberry pi or change the ip address, you would have to edit the config.php file inside the moodle folder as stated here. Restart apache2 and it should work.
  • I keep on forgetting my password, run this command within /var/www/moodle
sudo php admin/cli/reset_password.php

Creating quiz:

  1. Site Home
  2. Create course
    1. Go to site administration and courses
    2. Create a course
    3. Go to course settings (gear on top right when in Course page)
    4. Click Turn Editing On
    5. Go to General
    6. Add an activity or resource
  3. Adding a quiz
    1. Select Quiz and click add

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.