Managing moodle apache mysql on linux
1 / 37

- PowerPoint PPT Presentation

  • Updated On :

Steve Rippl Technology Director Woodland School District [email protected] (main District site - Drupal) (District Moodle site) Download this presentation at

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about '' - adamdaniel

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Managing moodle apache mysql on linux l.jpg

Steve Rippl

Technology Director

Woodland School District

[email protected] (main District site - Drupal) (District Moodle site)

Download this presentation at

Managing Moodle/Apache/MySQL on Linux

Outline of workshop l.jpg

File and Database Layout & Backups

Restores/Create a Test Site

Add-ons - Filters, Modules & Blocks

User Management

Structuring Site Layout/Permissions

Customizing Your Website

Upgrading Moodle

Outline of Workshop

  • Online Documentation

  • Hardware Requirements

  • Software Requirements

  • Quick Linux Introduction

  • Installing Software

  • Managing Remotely

  • Install Dependencies

  • Moodle Installation

  • Moodle Configuration

Online documentation l.jpg
Online Documentation

  • Linux

    • The man pages (not strictly online, although they are available there too!)

    • - Linux Newbie Administrator Guide, dated but useful general intro.

    • - great articles on various topics around managing Debian

    • - articles around server on many different distros (including Ubuntu/Debian)

Online documentation4 l.jpg
Online Documentation

  • Moodle

    • - Set up an account for access to forums

    • - Documentation front page

    • - Documentation for site administrators

Online documentation5 l.jpg
Online Documentation

  • Apache


  • PHP


  • MySQL


Hardware requirements l.jpg


160 MB Disk Space

256MB (min), ~1GB per 50 concurrent users

In Practice:

Be as generous as you can so your end users get a responsive experience, you're not paying for the software so put it in hardware!

Hardware Requirements

Software requirements l.jpg

An Operating System – Linux

A Web Server – Apache2


A Database – MySQL (others possible)


Moodle Source

Software Requirements

Quick linux introduction l.jpg
Quick Linux Introduction

  • What is where?


    • /etc – configuration files

    • /var/log – log files

  • How do we do anything?

    • The bash shell (Bourne Again SHell) – ls, cd, mkdir,touch,locate,ps,top,chown,chmod,rm,vi,pico,nano,cp,scp,mv,shutdown,reboot,more,less,cat,sed,grep... etc...etc...(man command is your friend!)

Quick linux introduction9 l.jpg
Quick Linux Introduction

  • How can we see what's running?

    • ps (ps -e | less, specific process “test” ps -e | grep test, more detail ps -aux)

    • top

  • How do we control processes (on Debian/Ubuntu)?

    • /etc/init.d/process_name (start|stop|restart|status)

Installing software l.jpg
Installing Software

  • Installing pre-packaged software (all online

    • GUI based tools, Synaptic (Gnome tool, but can install in KDE too)

    • Command line, apt-cache search/policy/showpkg..., apt-get install/remove/purge...

  • Compiling from source (not needed often)

    • Configure; make; make install

Managing accessing server remotely l.jpg
Managing/Accessing Server Remotely

  • From another Linux machine

    • ssh (Secure Shell)

    • Fish (Konqueror) (or sftp in Firefox?)

    • Can share the root file system through Samba or nfs (not as secure)

    • VNC – if the server has a GUI

Managing accessing server remotely12 l.jpg
Managing/Accessing Server Remotely

  • From Windows machine

    • Putty -

    • WinSCP -

    • Again, if server filesystem is shared through Samba you can access it that way.

Install dependencies l.jpg

On Debian (or Ubuntu)

As root...

# apt-get install apache2 php5 mysql-server php5-gd phpmyadmin

# cd /var/www

# wget

# tar -xzvf moodle-weekly-19.tgz

# rm moodle-weekly-19.tgz

# chown -R www-data:www-data moodle

Other useful software...

# apt-get install ssh ntp vim

Install Dependencies

Moodle installation l.jpg
Moodle Installation


  • Check web server settings (/etc/apache2/sites-available/default)

    DirectoryIndex index.php index.html index.htmAcceptPathInfo on

Moodle installation15 l.jpg
Moodle Installation

  • Check PHP settings (/etc/php5/apache2/php.ini) (* not already default in Debian)

    register_globals = 0safe_mode = 0 memory_limit = 128Msession.save_handler = files magic_quotes_gpc = 1 magic_quotes_runtime = 0 file_uploads = 1session.auto_start = 0 session.bug_compat_warn = 0 (*)post_max_size = 16M (* minimum)upload_max_filesize = 16M (* minimum)

Moodle installation16 l.jpg
Moodle Installation

  • Restart web server after any Apache or PHP config changes (/etc/init.d/apache2 restart)

  • Set up database (easiest through phpMyAdmin)

    • Set a root password if not already done.

    • Create moodle database and user 'moodleuser' with rights to that db.

      ***Important performance configuration***

      Increase the size of the query_cache_size in /etc/mysql/my.cnf

Moodle installation17 l.jpg
Moodle Installation

  • Create data directory

    Need a large (many gigs) data directory outside of DocumentRoot

    # mkdir /srv/moodledata# chown nobody:www-data /srv/moodledata# chmod 770 /srv/moodledata

  • Run Moodle installer script

    • http://yourserver/moodle/install.php

    • Enter db and data directory details

    • Install any missed dependencies – apt-cache search php5 extension_name, apt-get install package, restart apache.

Moodle installation18 l.jpg
Moodle Installation

  • Run Moodle installer script

    • Run through through table setup watching for errors

    • Setup admin account

    • Enter basic site information

      Hopefully now you see your Moodle site!


Moodle configuration l.jpg
Moodle Configuration

Checklist of basic Moodle options to enable/disable (not conclusive or necessarily necessary!)

  • Reduce time to keep logs (Server → Cleanup)

  • Turn off messaging (Security → Site Policies)

  • Disable Blogs (Security → Site Policies)

  • Setup cron

    • Set password in Security → Site Policies

    • Add */5 * * * * wget -q -O /dev/null http://yourserver/moodle/cron.php?password=PASSWORD (all one line) to crontab (crontab -e as root)

Moodle configuration20 l.jpg
Moodle Configuration

  • Adjust file upload limits

    • Security → Site policies → Maximum uploaded file size = Server Limit

    • In /etc/php5/apache2/php.ini upload_max_filesize = 32M

  • Set up connection to an SMTP server

    • Server → EmailMake sure your SMTP server will relay for your Moodle server.

File and database layout backups l.jpg
File and Database Layout & Backups

  • So now we have...

    • /var/www/moodle – see for explanation

    • /srv/moodledata

    • 'moodle' database in MySQL

File and database layout backups22 l.jpg
File and Database Layout & Backups

  • Set up those backups!

    • Use a script to dump the database on a daily basis (cron)

      On Linux mysqldump moodle > moodle_bkup.sql --user=root --password=PASSWORD

      On Windows C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqldump.exe" wsd > moodle_bkup.sql --user=root –password=PASSWORD

    • Use whatever backup system you have to scoop up both the main directories and the database dump file (maybe your apache conf?).

    • Restore just involves putting directories and db back

Restore create a test site l.jpg
Restore/Create a Test Site

  • Restore is easy (as long as you have backups!)

    • Put directories back in place (check permissions if your backup process doesn't preserve them)

    • Restore db mysql --username=root --password=PASSWORD moodle < moodle_bkup.sql

  • There is a built in course backup function – mostly for archiving/moving courses from one site to another.

Restore create a test site24 l.jpg
Restore/Create a Test Site

  • Can use the same method to create copy/clone of site for test purposes

    • cp -Rp /var/www/moodle /var/www/moodle_test

    • cp -Rp /srv/moodledata /srv/moodledata_test

    • In phpMyAdmin make a copy of db called moodle_test

    • Edit /var/www/moodle_test/config.php$CFG->wwwroot = 'http://.../moodle_test'$CFG->dirroot = '/var/www/moodle_test'$CFG->dataroot = '/srv/moodledata_test'

Filters modules blocks l.jpg
Filters, Modules & Blocks

  • Turn on or install additional filters, modules and blocks.

  • Lots of community created add-ons are available to increase functionality – none come with a guarantee so test if not sure!

Filters modules blocks26 l.jpg


Hot Potatoes Quiz (installed, just turn on)






Filters, Modules & Blocks

  • Filters

    • Multimedia plugins (already installed, just turn on)

    • Freemind

    • Geogebra

    • Wiki Page Auto-linking (already installed, just turn on)

    • Tex Notation (already installed, just turn on)

Filters modules blocks27 l.jpg
Filters, Modules & Blocks

  • Blocks - Quickmail

  • Installation of third-party add-ons:

    • Download the source, how do we get it onto our command line server?cd /tmpwget:wget windows/samba share:apt-get install smbfsmkdir /mnt/sharemount -t cifs //remote-server/share_name /mnt/sharecp /mnt/share/ .spc:scp [email protected]:/path/to/share/ .

Filters modules blocks28 l.jpg
Filters, Modules & Blocks

  • Installation of third-party add-ons:

    • Unpackapt-get upzipunzip feedback_package.zipchown -R www-data:www-data blocks modmv blocks/feedback /var/www/moodle/blocks/feedbackmv mod/feedback /var/www/moodle/mod/feedback

    • Visit your admin page to complete the installation


User management l.jpg
User Management

  • The easiest approach is to let your users setup their own account and use your network user directory for authentication.

    • Users → Authentication → Manage Authentication

    • Turn off Email-based self-registration

    • Turn on LDAP server

    • Configure (for Active Directory authentication?)

    • Make sure PHP LDAP module is present apt-get install php5-ldap/etc/init.d/apache2 restart

User management30 l.jpg
User Management

  • Configure LDAP authentication

    Host URL: ldap://AD-server.domain.eduVersion: 3LDAP encoding: utf-8Hide passwords: yesDistinguished Name: cn=ldap_query_user,ou=users,dc=domain,dc=eduPassword: xxxxxxxxUser type: MS ActiveDirectoryContexts: ou=users,dc=domain,dc=eduSearch subcontexts: YesUser attribute: sAMAccountNamePassword format: Plain text

User management31 l.jpg
User Management

  • Can import all users yourself if you wish

    Users → Accounts → Add a new user or Upload users

    Exactly how this is managed is very dependent on your Network setup, but try to minimize your involvement here, you've got other things to do!

Structuring site layout permissions l.jpg
Structuring Site Layout/Permissions

  • Think about clarity for end users and consider the fact that permissions are inherited down from where you set them.

  • Can set permissions globally

    Users → Permissions → Assign system roles

    and at each level.

    'Assign roles' within a course or category

Customizing your website l.jpg
Customizing Your Website

  • Most Moodle sites are distinctively “Moodle-esq”, but you can choose amongst various themes and customize them as you please.

    • Appearance → Themes → Theme Selector

    • Can find many more to download here:

      Installation instructions:

Customizing your website34 l.jpg
Customizing Your Website

  • Digging deeper into themes – either use chameleon theme

    • In moodle/themes/chameleon/config.php set $THEME->chameleonenabled = true;

    • In the Theme Selector choose the Chameleon theme

    • 'Shift + click' on an element to get css properties (Firefox “firebug” also useful)

Customizing your website35 l.jpg
Customizing Your Website

  • Or edit the html/css of one you like...

    • Can start with header.html and footer.html and go on from there... again the Firebug plugin for Firefox will greatly help to identify page node id and classes which you can then hunt out in the theme files.

Upgrading moodle l.jpg
Upgrading Moodle

  • Don't get left behind! You've got backups of everything so there's nothing to be afraid of!

    • Make sure all updates are current

    • Move (rename) your old moodle folder and unpack the new one in it's place.

    • Copy across config.php and any custom themes, check permissions (chown www-data …) and then visit your admin page.

The end l.jpg
The End?

  • Train a few keen teachers who can then in turn train others (Moodle Bootcamp?)

  • Sit back and take the credit for bringing this powerful tool into your School/District!