This guide is no longer maintained. This guide might still be useful as a reference, but may not work on other Ubuntu releases. If available, we strongly recommend using a guide written for the version of Ubuntu you are using. You can use the search functionality at the top of the page to find a more recent version. About this guide Moodle is a very popular and seasoned learning platform used by many institutions. While it is easy to set up a working moodle platform, it is a lot harder to run it smoothly for many concurrent users.
Therefore some of the design choices taken in this guide try to solve this issue and offer a clean and fast solution for common use cases. Log into your server via ssh this depends on your IP and whether you enabled a root certificate for ssh: Install php, along with some modules moodle likes to have available: In this tutorial, we will use most preconfigured settings to keep it simple and easy to reproduce.
We will now install moodle there: Now you can do many things a lot easier. For example, if you moved from another hosting provider to DigitalOcean, you can just "check out" the version you last used and then check out the latest version. Or you can just stick with stable releases. There is a whole world of simple code management open for you. For this tutorial, we will simply check out the latest stable version which is "tagged" in git. To find out which version is latest for you, do this: So I will simply check this tag out because we're starting with a clean install: Once git has finished its job, we're in a moodle directory that replicates version 2.
If you ever need to update, you can do so in a few simple steps: Then you continue with a database update by heading to the moodle admin page. Adjustments In your moodle directory there is a file called config-dist. Open and edit it: After you have changed the values, you can save it as config. Further Steps The changes just performed set the pace for these next steps.
You need to set up a moodle data directory and a cache directory: The cache store helps to preserve files for faster caching. Now it's time to set up the database for moodle. To do so use the postgres user to create a new role called moodle which then will be able to handle the moodle database you are about to create: Exit user postgres and then, in a last step, tell nginx how to serve your files.
To do so create an nginx host file: Point your browser to your domain or your server's IP address. Moodle will ask you a few questions while it installs. Cronjobs are very important for moodle and running them offsite is not as effective as running them locally.
You can add a short command to your www-data user's cron tab: Add the following line, which will run the cron script every ten minutes for you: Your moodle platform should now be blazingly fast.