managing moodle apache mysql on linux l.
Skip this Video
Loading SlideShow in 5 Seconds..
Managing Moodle/Apache/MySQL on Linux PowerPoint Presentation
Download Presentation
Managing Moodle/Apache/MySQL on Linux

Loading in 2 Seconds...

play fullscreen
1 / 37

Managing Moodle/Apache/MySQL on Linux - PowerPoint PPT Presentation

  • Uploaded on

Steve Rippl Technology Director Woodland School District (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 'Managing Moodle/Apache/MySQL on Linux' - 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

Steve Rippl

Technology Director

Woodland School District (main District site - Drupal) (District Moodle site)

Download this presentation at

Managing Moodle/Apache/MySQL on Linux
outline of workshop
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
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
Online Documentation
  • Moodle
    • - Set up an account for access to forums
    • - Documentation front page
    • - Documentation for site administrators
online documentation5
Online Documentation
  • Apache
  • PHP
  • MySQL
hardware requirements


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

An Operating System – Linux

A Web Server – Apache2


A Database – MySQL (others possible)


Moodle Source

Software Requirements
quick linux introduction
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
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
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
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
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

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
Moodle Installation
  • Check web server settings (/etc/apache2/sites-available/default)

DirectoryIndex index.php index.html index.htmAcceptPathInfo on

moodle installation15
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
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
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
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
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
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
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
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
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
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
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

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
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 root@remote-server:/path/to/share/ .
filters modules blocks28
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
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
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
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
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
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
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
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
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
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!