Implementing Moodle on Ubuntu 12.04

Moodle (www.moodle.org), is one of the most popular open source Learning Management Systems and thousands of Universities and corporates use this system internally for managing various training programmes. This blog talks about one of the possible ways of implementing Moodle on Ubuntu 12.04.

Pre-requisites

  1. Ubuntu 12.04 LTS server
  2. Update & upgrade ( sudo apt-get install update && sudo apt-get upgrade)
  3. Basic Software
    • Apache Web server (sudo apt-get install apache2)
    • MY SQL Database (sudo apt-get install mysql-server-5.5)
    • PHP (sudo apt-get install php5 phpmyadmin php5-ldap)
    • Installing Moodle dependencies
      • sudo apt-get install php5-curl php5-intl php5-xmlrpc
  4. Internal IP: 192.168.65.18
  5. Machine hostname: moodle
  6. Site name: test.moodle.com

Downloading and Preparing the Moodle Server

  1. Download the installable (http://download.moodle.org/)
  2. Extract the installable and rename the folder as moodle in var/www
  3. The folder hierarchy should be : /var/www/moodle
  4. Create a folder moodledata. It could be /moodledata or /var/www/moodledata
  5. Change the ownership of moodledata folder to apache user (www-data): sudo chown –R www-data:www-data </path/of/moodledata/folder>

Configuring Apache for virtual hosting and using self signed certificate of apache for SSL

  1. cd /etc/apache2/sites-available
  2. sudo cp default-ssl test.moodle.com
  3. sudo nano /etc/apache2/sites-available/test.moodle.com
    1. Below is the excerpt of the test.moodle.com apache configuration file

    <IfModule mod_ssl.c>
    <VirtualHost _default_:443>
    ServerAdmin  webmaster@test.moodle.com
    ServerName      test.moodle.com
    ServerAlias       test
    DocumentRoot /var/www/moodle
    <Directory />
    Options FollowSymLinks
    AllowOverride None
    </Directory>
    <Directory /var/www/moodle/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>

  4. sudo a2ensite test.moodle.com
  5. sudo a2enmod ssl

Configuring MY SQL database

  1. Open a browser and type : http://192.168.65.18/phpmyadmin
  2. Use ‘root’ as uid and the password you kept while installing MySQL
  3. Click on ‘Privileges’
  4. Click on ‘Create User’ and add ‘moodle’ as a user
  5. Click on create a database with the name same as the user
  6. Add ‘Grant’ rights for ‘moodle’ on database ‘moodle’

Configuring Moodle

  1. Open a browser and type: https://test.moodle.com and accept the self signed certificate warning
  2. For the above link to work, you either need to
    • Make a host file entry on your local machine OR
    • NAT the server to a public IP and make a web dns entry pointing the A record to the public IP address of the server
  3. Follow on screen instructions to complete the moodle installation

Finalizing the installation

  1. Enable ufw (sudo ufw enable)
  2. sudo ufw allow ssh
  3. sudo ufw default deny
  4. sudo ufw allow 443

We have completed the installation of Moodle with https. Happy Moodling Smile

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s