I read somewhere that it should be possible to install Moodle on a Raspberry Pi. Since I just received my model 3, which is spiffy enough to run the Raspberry Pi blog, I wanted to see how easy it to set up and operate a Moodle server on my Pi.
First, we need to set up LAMP, which is short for Linux (OS), Apache (web server), MySQL (database) and PHP (scripting language). We can use Raspian, the default Raspberry Pi OS to fulfill the “L” and the “AMP” can be set up using the suggestions on the Raspberry Pi website. Those instructions also show how wordpress can be installed (which is cool, but not needed here), so we don’t need to go that far.
Moodle is going to require some additional PHP extensions, which can be installed with sudo apt-get install php5-mysql php5-curl php5-gd php5-xmlrpc php5-intl .
Before starting the Moodle part, it is a good idea to set up a moodle data directory (/var/www/moodledata) and also set the group and permissions of the /var/www directory so that the install goes smoothly. To do so:
cd /var/www sudo mkdir moodledata sudo chgrp -R www-data ./ cudo chmod -R 775 ./
Now you can do sudo usermod -a -G www-data pi to allow the typical Pi username to access the web directory.
I followed these directions for downloading Moodle via git. They are pretty straightforward. It does take a good 10-15 minutes, especially since I’m using the built-in wifi on my Raspberry Pi 3 (woo hoo!).
File size considerations
Since I want to be able to upload larger files (I intend to use this system to back up my actual courses), I needed to alter the php configuration file in order to allow file uploads larger than 2 MB. Read through that material carefully as this is a system-wide modification. Since my system only consists of Moodle, it’s not a problem for me.
Now, pointing a browser to http://localhost/moodle (or the appropriate hostname/IP address if you have your home network configured) you can run through the setup, which requires some basic information about the administrator, name of the site, database credentials, and some configuration checks. Once the installation is complete, you are done, and ready to start adding courses and content to your site.
With the change to the PHP config file mentioned above, I was able to easy restore a Moodle backup (a *.mbz file) from my University’s moodle site to my Raspberry Pi site. We don’t have any fancy additional extensions (with the exception of a plagiarism tool, and I de-selected those activities from my backup) and there seems to be no difference between my Raspberry Pi Moodle and the official course. Our university site has a “collapsible” topic format which must be an add-on, and when I restored to my Raspberry Pi, it defaulted to a topical format without a problem. The website also looks wonderful on a small phone screen with no additional configuration. With one user, the response time is pretty good, and I might put the server in my briefcase and “lug” it to school one day to see if it can handle my class, but for now, it seems to be doing what I wanted it to (which in part was to teach me how I could become a Moodle site administrator….).