Managing Moodle/Apache/MySQL on Linux

Download Report

Transcript Managing Moodle/Apache/MySQL on Linux

Managing
Moodle/Apache/MySQL on Linux
Steve Rippl
Technology Director
Woodland School District
[email protected]
http://www.woodlandschools.org (main District site - Drupal)
http://courses.woodlandschools.org (District Moodle site)
Download this presentation at
http://www.woodlandschools.org/index.php?q=node/6216
Outline of Workshop

Online Documentation

Hardware Requirements

Software Requirements

Quick Linux Introduction

Installing Software

Managing Remotely





File and Database Layout &
Backups
Restores/Create a Test Site
Add-ons - Filters, Modules &
Blocks
User Management
Structuring Site
Layout/Permissions

Install Dependencies

Moodle Installation

Customizing Your Website

Moodle Configuration

Upgrading Moodle
Online Documentation

Linux

The man pages (not strictly online, although they are
available there too!)

http://linux-newbie.sunsite.dk/html/lnag.html - Linux
Newbie Administrator Guide, dated but useful
general intro.

http://www.debian-administration.org/ - great articles
on various topics around managing Debian

http://www.howtoforge.com/ - articles around server
on many different distros (including Ubuntu/Debian)
Online Documentation

Moodle

http://moodle.org/ - Set up an account for
access to forums

http://docs.moodle.org/en/Main_Page Documentation front page

http://docs.moodle.org/en/Administrator_
documentation - Documentation for site
administrators
Online Documentation

Apache


PHP


http://httpd.apache.org/docs/2.2/
http://www.php.net/manual/en/
MySQL

http://dev.mysql.com/doc/
Hardware Requirements
Minimum:


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!
http://docs.moodle.org/en/Installing_Moodle#Hardware
http://docs.moodle.org/en/Installing_Moodle#How_many_users.3F
Software Requirements
An Operating System – Linux
 A Web Server – Apache2
 PHP5
 A Database – MySQL (others possible)

and...

Moodle Source
http://docs.moodle.org/en/Installing_Moodle#Software
Quick Linux Introduction


What is where?

http://linux-newbie.sunsite.dk/html/lnag.html#4.1.Basics|outline

/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 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 pre-packaged software (all online
http://www.debian.org/distrib/packages)


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

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
Remotely

From Windows machine

Putty http://www.chiark.greenend.org.uk/~sgtatham/putty/

WinSCP http://winscp.net/eng/index.php

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 http://download.moodle.org/stable19/moodle-weekly-19.tgz
# 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
http://docs.moodle.org/en/Debian_GNU/Linux_installation
Moodle Installation

http://docs.moodle.org/en/Installing_Moodle

Check web server settings (/etc/apache2/sitesavailable/default)
DirectoryIndex index.php index.html index.htm
AcceptPathInfo on
Moodle Installation

Check PHP settings (/etc/php5/apache2/php.ini) (* not
already default in Debian)
register_globals = 0
safe_mode = 0
memory_limit = 128M
session.save_handler = files
magic_quotes_gpc = 1
magic_quotes_runtime = 0
file_uploads = 1
session.auto_start = 0
session.bug_compat_warn = 0
post_max_size = 16M
upload_max_filesize = 16M
(*)
(* minimum)
(* minimum)
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 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 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!
Er
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
crontab (crontab -e as root)
(all one line) to
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 → Email
Make sure your SMTP server will relay for your Moodle
server.
File and Database Layout &
Backups

So now we have...

/var/www/moodle – see
http://docs.moodle.org/en/Installing_Moodle#Str
ucture_of_moodle_directory for explanation

/srv/moodledata

'moodle' database in MySQL
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 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 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


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!
http://moodle.org/mod/data/view.php?id=6009
Filters, Modules & Blocks

Filters

Modules

Multimedia plugins
(already installed, just
turn on)

Hot Potatoes Quiz
(installed, just turn
on)

Freemind

Book

Geogebra

Feedback

Wiki Page Auto-linking
(already installed, just
turn on)

Questionnaire

Podcase

Slideshow

Tex Notation (already
installed, just turn on)
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 /tmp
wget:
wget http://download.moodle.org/packages19/feedback_packages.zip
mount windows/samba share:
apt-get install smbfs
mkdir /mnt/share
mount -t cifs //remote-server/share_name /mnt/share
cp /mnt/share/file.zip .
spc:
scp root@remote-server:/path/to/share/file.zip .
Filters, Modules & Blocks

Installation of third-party add-ons:

Unpack
apt-get upzip
unzip feedback_package.zip
chown -R www-data:www-data blocks mod
mv blocks/feedback /var/www/moodle/blocks/feedback
mv mod/feedback /var/www/moodle/mod/feedback

Visit your admin page to complete the installation
http://your-server/moodle/admin/index.php
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 Management

Configure LDAP authentication
Host URL:
ldap://AD-server.domain.edu
Version:
3
LDAP encoding:
utf-8
Hide passwords:
yes
Distinguished Name:
cn=ldap_query_user,ou=users,dc=domain,dc=edu
Password:
xxxxxxxx
User type:
MS ActiveDirectory
Contexts:
ou=users,dc=domain,dc=edu
Search subcontexts: Yes
User attribute:
sAMAccountName
Password format:
Plain text
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


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

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:
http://moodle.org/mod/data/view.php?id=6552
Installation instructions:
http://docs.moodle.org/en/Themes_FAQ
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 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.
https://addons.mozilla.org/enUS/firefox/addon/1843
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.
http://docs.moodle.org/en/Upgrading#Install_the_new_Moodle_software
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!