Thursday, April 16, 2009

Integration between Moodle and MOSS - Part 2

Part 2: Install Moodle

Welcome in part 2 of the article. In part1, I have provided an introduction to the Moodle-MOSS integration. In this part, I would explain the installation and configuration of Moodle.

The next parts would be:
Part 3: Install the Moodle Integration Solution
Part 4: Zoom on the Moodle web parts
Part 5: Extension Thoughts

A. Overview
This section describes the steps needed for installing Moodle using the Complete install packages for Windows. This package allows Moodle to be installed, along with the prerequisites that include a web server (Apache), database (MySQL) and scripting language (PHP).

It is important to note that this package is designed for new installations on a standalone computer. For a production environment it is a good practice to perform a manual installation. The reference section contains links to the corresponding installation guides.

Concerning the Moodle version to be used, we have chosen Moodle 1.8, because according to the documentation of the Moodle Integration Solution…
1- MIS works with Moodle 1.7 or 1.8
2- Upcoming releases might also be working with MIS but this can’t be guaranteed.
3- Older versions of Moodle are not supported.

After completing the Moodle installation, we need to configure the LDAP authentication and finally perform some smoke tests to make sure that all configurations have been performed correctly.

 

B. Downloads

  1. Browse http://download.moodle.org/windows/
  2. Click the Download link beside Moodle 1.8.8+.
  3. Save the file MoodleWindowsInstaller-latest-18.zip to a local directory.

 

C. Moodle Installation

  1. Create a folder for hosting the Moodle application. (e.g. called C:\Moodle1.8)
  2. Unpack the content of MoodleWindowsInstaller-latest-18.zip to C:\Moodle1.8.

Note

  • The extract process will create three files ("Start Moodle", "Stop Moodle", and "README") and a subfolder called "server".
  • Do NOT rename the "server" subfolder.
  • There will also be a folder under this server subfolder, called \moodle which holds the Moodle program.
  1. Stop the IIS Admin service (since Apache usually conflicts with IIS).
  2. Start the webserver using C:\Moodle1.8\Start Moodle.exe.

Note

  • If Moodle doesn’t start properly and display the message APACHE and MYSQL are running..., please refer to the Troubleshooting section for tips.
  • Once the Start Moodle.exe program is open, don't close the window for stopping it. Instead, use Stop Moodle.exe for that purpose.
  1. Start your web browser and type http://localhost. The initial install page will be displayed.
  2. Choose your preferred language (English) and click the Next button.

clip_image002

  1. A diagnostic report is displayed. If all the checks give a PASS, then you can click the Next button to continue. Otherwise, you should address some issues.

clip_image004

  1. Specify the Moodle paths, then click the Next button:
    1. Web Address: http://moodle-machine (Assuming that moodle-machine is the name of the machine hosting Moodle)
    2. Data Directory: C:\Moodle1.8\server/moodledata

image

Note

For the sake of better maintenance, it is recommended to use machine names instead of IP addresses during the installation and configuration of Moodle. For instance, when changing the IP of the host machine.

  1. Specify the database configurations, then click the Next button:
    1. Database: moodle
    2. Password: Password1
    3. Tables prefix: mdl_

clip_image008

  1. The install process checks the server it installs and finally displays the server environment screen. If all the checks give an OK, then you can click the Next button to continue. Otherwise, you should address some issues.

clip_image010

  1. On the Download language pack confirmation screen, click the Next button to continue.

clip_image012

  1. A message is displayed confirming the successful configuration of config.php. Click the Continue button to proceed.

clip_image014

  1. The Moodle copyright / license notices are displayed. Click the “Yes” button to continue.

clip_image016

  1. The current release information is shown. Check the unattended operations box. This will automatically advance through many screens. Click the Continue button to proceed.

clip_image018

  1. This process stops with the Admin user profile settings, which need to be filled out. Fill out the required fields and click on the Update profile button to continue.

clip_image020

  1. The next screen is the Front Page settings page. Each field contains a short description explaining what it is used for. Fill the settings as you wish and click on the Save changes button. Note that these settings can be updated later.

clip_image022

  1. This finishes the installation of Moodle. Type http://moodle-machine in your browser and Moodle will open.

clip_image024

D. Version Summary

This section summarizes the versions of the different software included in the Complete install packages for Windows:

  • Moodle Windows Installer: 2008050400
    • Xampp Lite: 1.7.0
    • Apache 2: 2.11
    • PHP: 5.2.8
    • MySQL: 5.1.30
    • Moodle 1.8.8+ (Build: 20090325) (2007021580).

 

E. LDAP Configuration

This section contains the steps needed for configuring the LDAP authentication for Moodle.

PHP LDAP module
  1. Browse http://moodle-machine/admin/phpinfo.php and login as admin.
  2. Search for ldap and make sure that the LDAP Support is enabled.
  3. If not, you can refer to the following page for installing and enabling the PHP LDAP module: http://docs.moodle.org/en/Active_Directory
Active Directory configurations
  1. Connect to the Active Directory server.
  2. Browse Start > Administrative Tools > Active Directory Users and Computers.
  3. Under Users, create a new user for the binding to LDAP with the following data:
    1. First Name: LDAP
    2. Last name: User
    3. Full Name: ldapuser
    4. User logon name: ldapuser
    5. Password: Password
    6. Password Never Expires
  4. Create a new organizational unit to hold all the Moodle users:
    • In the console tree, right-click on domain node.
    • Point to New, and then click Organizational Unit.
    • Type moodleusers as the name of the organizational unit.
    • Add some users to this organizational unit.
  5. Create a new group containing the Teachers:
    • Right-click on the moodleusers node.
    • Point to New, and then click Group.
    • Type Teachers as the group name and click OK.
    • Add a subset of the moodle users to this group.
Getting the DNs for Contexts and Creators

For a proper binding to the LDAP, any object is identified by a so-called Distinguished Name (DN).

In this section, you should specify the DN values for the objects created in the previous section:

  • The LDAP User.
  • The moodleusers organizational unit.
  • The Teachers security group.

Note

The LDAP Browser is a very nice tool for browsing and analyzing LDAP directories easily and effectively.

You can download the LDAP browser from the following URL: http://www.ldapadministrator.com/download.htm

When you try to install the software, it asks you to install the MS Core XML services first, if they are not already installed.

You can download the MS Core XML Services from the following URL: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=993c0bcf-3bcf-4009-be21-27e85e1857b1

Moodle configurations
  1. Login to Moodle as admin.
  2. From the Site Administration box, browse Users > Authentication.
  3. In the table that appears, enable the LDAP Server option by clicking on the closed eye to make it open.
  4. Click on the corresponding Settings link.
  5. Fill the proper values for the LDAP server settings parameters. The following table should help.

Field name

Remarks

Value

LDAP Server Settings

Host URL

Some people have trouble connecting with the “ldap://server-URL” syntax, especially on MS Windows servers. In this case, one can use “server-URL” only.

moss-machine

Version

Unless you are using a really old LDAP server, version 3 is the one you should choose.

3

LDAP Encoding

Specify encoding used by LDAP server. Most probably utf-8.

utf-8

Bind settings

Hide passwords

 

Yes

Distinguished Name

This is the distinguished name of the bind user defined above.

CN=ldapuser, CN=Users, DC=mydomain, DC=com

Password

This is the password of the bind user.

Password1

User lookup settings

User type

 

MS ActiveDirectory

Contexts

The DN of the container where all Moodle users are found.

OU=moodleusers, DC=mydomain, DC=com

Search subcontexts

 

No

Dereference aliases

 

No

User attribute

 

sAMAccountName

Member attribute

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Member attribute uses dn

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Object class

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Force change password

Force change password

 

No

Use standard Change Password Page

 

No

Password Format

 

Plain text

Password change URL

   

LDAP password expiration settings

Expiration

 

No

Expiration warning

 

10

Expiration attribute

   

Grace logins

 

No

Grace login attribute

   

Enable user creation

Create users externally

 

No

Context for new users

   

Course creator

Creators

The DN of the Teachers group.

CN=Teachers, OU=moodleusers, DC=mydomain, DC=com

Cron synchronization script

Removed ext user

 

Keep internal

Data Mapping

First name

 

givenName

Surname

 

sn

Email address

 

mail

Phone 1

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Phone 2

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Institution

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Department

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Address

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

City/town

 

l

Country

 

c

Description

 

description

ID Number

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Language

This parameter is optional. So unless you need something special, you don't need to fill this in.

 

Import Users

Run the import users script located under \server\moodle\auth\ldap\auth_ldap_sync_users.php

  1. Open the Command Prompt window
  2. Type in the following command:

C:\Moodle1.8\server\php\php.exe -f C:\Moodle1.8\server\moodle\auth\ldap\auth_ldap_sync_users.php

  1. The result should look similar to this:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:\Moodle1.8\server\php\ext\php_pdf.dll' - The specified module could not be found.
in Unknown on line 0
Configuring temp table
Creating temp table mdl_extuser
Connecting to ldap...
+ 4 users
Got 4 records from LDAP
No updates to be done
User entries to add: 4
Inserted user moodle.student1 id 3
Inserted user moodle.student2 id 4
Inserted user moodle.teacher1 id 5
Inserted user moodle.teacher2 id 6

F. Smoke Tests

  1. Login to Moodle using the admin user and check that the Active Directory users have been imported successfully.
  2. Create some courses.
  3. Assign teachers and students to the different courses.
  4. From the Site Administration block, browse on Front Page > Front Page Settings.
  5. Check the parameter Include a topic section and click the Save changes button.
  6. On the Front Page, click on the Turn editing on button.
  7. You should see a small edit link appear on the left side of the middle column.
  8. Click the edit link and type a welcome message.
  9. Add the Latest News and Online Users blocks.
  10. Add some topics to the Latest News block.
  11. Click the Turn editing off button.

G. Troubleshooting

Error in binding to port 80

When running Start Moodle.exe, you might get an error message that port 80 is already in use and finally the application shuts down.

Perform the following checks:

  1. Is Apache already running?
    1. => No action is needed!
  2. Is the IIS Admin service running?
    1. => Stop it.
  3. Is Skype running?
    1. => Exit Skype or change the port settings in Skype as follows
    2. Browse Tools > Options.
    3. Click the Connection tab.
    4. Uncheck the option: Use port 80 and 443 for incoming connections.
    5. Click Save.
  4. Check for another application which may be using port 80 as follows:
    1. Open the Command Prompt window
    2. Type in the following command: netstat -o -n -a | findstr 0.0:80
    3. The result should look similar to this:

TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 870

    1. The last column is the process ID (or PID)
    2. Open the Task Manager
    3. Go to Processes tab and browse View > Select Columns….
    4. In the Select Process Page Columns dialog, select the checkbox for PID (Process Identifier), and click OK.
    5. Match the PID number returned from the netstat command to identify the application running on port 80

Run Moodle on a port other than port 80

If you need to let Apache listen on another port than 80, you should perform the following steps:

  • Open the file httpd.conf under C:\Moodle1.8\server\apache\conf and change the port from 80 to 8080.
  • Change line 53 as follows: Listen 8080
  • Change line 169 as follows: ServerName localhost:8080

The application does not start

The msvcr71.dll library file is required, in order to run Xampp.
Check if it exists under the following path: C:\Windows\system32.
If you don’t find it, then you should download it and place it in C:\Moodle1.8\server\apache\bin.

 

H. References

Download Standard Moodle Packages
http://download.moodle.org/

Installing Moodle
http://docs.moodle.org/en/Installing_Moodle

Windows installation
http://docs.moodle.org/en/Windows_installation

Complete install packages for Windows
http://docs.moodle.org/en/Complete_install_packages_for_Windows

Installation FAQ
http://docs.moodle.org/en/Installation_FAQ

Installation problems forum
http://moodle.org/mod/forum/view.php?id=28

LDAP authentication
http://docs.moodle.org/en/LDAP_authentication

Active Directory
http://docs.moodle.org/en/Active_Directory

LDAP Properties for CSVDE and VBScript
http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm

LDAP Namespace Structure
http://www.informit.com/articles/article.aspx?p=101405&seqNum=7

Front Page Customization in Moodle
http://www.packtpub.com/article/front-page-customization-in-moodle

4 comments:

Samar Hossam said...

Hi Hamza,

I would first suggest that you omit the "port number" from the "Host URL" parameter.
So let's say your domain controller machine has the name "dc-01.test.com"; in this case you should try the following values for the "Host URL" parameter:
(a) dc-01
(b) ldap://dc-01
By the way, my system is working with option (a).

If this did not fix the problem, I would recommend that you revise the followng configurations:
1. Make sure that the PHP LDAP module is enabled (please refer to section "PHP LDAP module").

2. Check that the user, who is used for the LDAP binding has...
(1) a password that never expires
(2) a non-privileged account, i.e. the user is only a member of the "Domain Users" security group.

3. Make sure that you have provided the correct DNs for the...
(1) binding LDAP User.
(2) moodleusers organizational unit.
(3) Teachers security group.
Use the LDAP Browser tool for getting the correct DN values for the different objects. You can download the LDAP browser from the following URL: http://www.ldapadministrator.com/download.htm

I hope this helps.

Salam,
Samar

Hamza Farooq said...

Thanks, :) It worked yesterday but with a supprizing new setting which is to use "user@domain.com" in "Distinguished Name". I know its suprizing when moodle put it as descriptions "If you want to use bind-user to search users, specify it here. Something like 'cn=ldapuser,ou=public,o=org' "

I tried that software its good thanks for mentioning it.

Hamza Farooq said...

Just stuck on last step i belive...

Im getting this error in the webservice error log.


=============================
WEBSERVICE ERROR: The format of the file 'MySql.Data' is invalid.; Inner Exception: ; Inner source:
Stack Trace:
at ProgXimity.Moodle.DAL.DbConnector..ctor(String configKey)
at ProgXimity.Moodle.DataConnectors.WebServiceQueryHandler.ExecuteQuery()
at MoodleWebService.Execute(WebServiceQuery webServiceQuery)


=============================

I installed the Mysql.data connector version 6. Any suggestions?? which version of mysql.data you installed?

Samar Hossam said...

Hi Hamza,

I was integrating Moodle and MOSS just as a proof-of-concept. Thus, I didn't really care about the performance.

I am saying this, because my team has also encountered problems with the MySQL Connector. Therefore, we have removed it and used the "MySql ODBC Connector 5.1.5" instead.

Concerning the problems of the MySQL Connector, here are our notes:
- We tried to use the MySQL 5.1 .NET connector.
- The web service failed to work.
- After some digging into the MIS code, we found out that the web service is checking for Mysql.data.dll version 1.0.8.0, which is not the same version of the dll installed by the.NET connector.

I would like to suggest a solution, although I haven't tried it myself:
- Move the value of the version of the Mysql.data.dll to the configuration file of the web service.
- In the check of this version, use the value retrieved from the configuration file.
- In the configuration file, set the value of the newly created config parameter by the correct version of the installed Mysql.data.dll.
- Rebuild and deploy the updated web service.