Difference between revisions of "Cool Solution - Install Moodle"

From Univention Wiki

Jump to: navigation, search
(add further links)
 
(28 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Cool Solutions Disclaimer|Repository=no|UCS=4.0|school=4.0}}
+
This page has been moved to the Knowledge Base Cool Solutions in the Forum.
  
== Introduction ==
+
[https://help.univention.com/t/cool-solution-install-moodle/12258 Cool Solution - Install Moodle]
This article introduces you to the usage of Moodle. It covers the installation on a dedicated school server, as well as the users authentication with the LDAP. If further integration packages are needed, like loading classes from the LDAP or using the Microsoft Windows authentication for already logged in users, feel free to contact Univention for assistance.
 
 
 
== Installation ==
 
 
 
This section will cover the preparation and installation of Moodle on the system. Please make sure that every command is executed as root user.
 
 
 
To install necessary packages, execute the following command to install apache2, php5 and mysql
 
<pre> apt-get install apache2 php5 mysql-server php5-mysql libapache2-mod-php5 php5-gd php5-curl php5-xmlrpc php5-intl
 
</pre>
 
 
 
The MySQL database modules must be included in PHP. Add the following two lines into the '''/etc/php5/apache2/php.ini''' file:
 
<pre>
 
extension=mysql.so
 
extension=gd.so
 
</pre>
 
 
 
To use Moodle effectively, it is recommended to raise the maximum size for uploads, e. g. 20 MB, to provide small programs to students. The changes must be done in the '''/etc/php5/apache2/php.ini''' file:
 
<pre>
 
post_max_size = 20M
 
upload_max_filesize = 20M
 
</pre>
 
 
 
For the changes to take effect, the Apache webserver must be restarted:
 
<pre>
 
/etc/init.d/apache2 restart
 
</pre>
 
 
 
 
 
== Configuration ==
 
 
 
This section handles the basic configuration and LDAP connection for Moodle and how to delete users in Moodle that are not in the LDAP anymore.
 
 
 
=== Basic configuration ===
 
 
 
To setup the MySQL Database, execute the following command:
 
 
 
<pre>
 
mysql -u root -p
 
</pre>
 
Enter your password
 
 
 
Create the Moodle database
 
<pre>
 
mysql> CREATE DATABASE moodle;
 
</pre>
 
 
 
Then ensure that the database is set to UTF8 which is required by later distributions of Moodle
 
<pre>
 
mysql> ALTER DATABASE moodle charset=utf8;
 
</pre>
 
Then exit the database
 
<pre>
 
mysql> exit;
 
</pre>
 
You can restart mysql by
 
<pre>
 
/etc/init.d/mysql restart
 
</pre>
 
 
 
The next step is, to download Moodle:
 
<pre>
 
wget https://download.moodle.org/download.php/direct/stable28/moodle-2.8.5.tgz
 
</pre>
 
Unpack the file with the following command:
 
<pre>
 
tar -zxvf <your-file>
 
</pre>
 
The file will probably be located in your current folder. Move the 'Moodle' file to ''/var/www'':
 
<pre>
 
mv moodle /var/www
 
</pre>
 
 
 
Switch to the correct directory
 
<pre>
 
cd /var/www
 
</pre>
 
Set ownership and permissions so that Apache can access the files
 
<pre>
 
chown -R www-data:www-data moodle \
 
chmod -R 755 moodle
 
</pre>
 
 
 
Switch the directory again
 
<pre>
 
cd /var/
 
</pre>
 
Create a directory for user and course files
 
<pre>
 
mkdir moodledata
 
</pre>
 
Set ownership and permissions so that Apache can access the files
 
<pre>
 
chown -R www-data:www-data moodledata
 
</pre>
 
Now the Moodle service can be reached and configured by opening the web page in a webbrowser:
 
<pre>
 
http://<server>/moodle
 
</pre>
 
 
 
 
 
=== LDAP authentification ===
 
 
 
After the basic configuration is done, https should be activated in '''Security''' -> '''HTTP security'''. Next, in '''Web Administration''' -> '''Plugin''' -> '''Authentication''' the option '''Email-based self-registration''' should be deactivated and '''LDAP server''' should be activated.
 
 
 
Next, a simple authentication account should be created using the UDM. This account can then be used for an authenticated bind. To find the DN of the account issue the following command on the command line:
 
<pre>
 
udm users/user list --filter username=<NAME of the account> | grep DN
 
</pre>
 
 
 
Now the LDAP connection can be configured under '''Settings'''. The table gives information which default settings must be changed:
 
 
 
{|class="wikitable"
 
!Key
 
!Value
 
|-
 
!colspan="2"|LDAP server settings
 
|-
 
|Host URL
 
|ldap://<school server's FQDN>:7389
 
|-
 
|Version
 
|3
 
|-
 
!colspan="2"|Bind settings
 
|-
 
|Distinguished Name
 
|<DN of the authentication account>
 
|-
 
|Password
 
|<Password of the authentication account>
 
|-
 
!colspan="2"|User lookup settings
 
|-
 
|Contexts
 
|cn=users,ou=<school>,dc=<domain>
 
|-
 
|Search subcontexts
 
|Yes
 
|-
 
|User Attribute
 
|uid
 
|-
 
!colspan="2"|Course creator
 
|-
 
|Creators
 
|cn=lehrer,cn=users,ou=<school>,dc=<domain>
 
|-
 
!colspan="2"|Cron synchronization script
 
|-
 
|Removed ext user
 
|Full delete internal
 
|-
 
!colspan="2"|Data mapping
 
|-
 
|Update local
 
|On Every Login
 
|-
 
|Update external
 
|Never
 
|-
 
|Lock value
 
|Locked
 
|}
 
 
 
''Hint:'' To obtain the LDAP basis, execute the following command on the school server:
 
<pre>
 
ucr get ldap/base
 
</pre>
 
 
 
''Hint:'' To obtain the system's FQDN, execute the following command on the relevant system:
 
<pre>
 
hostname -f
 
</pre>
 
 
 
=== LDAP mapping ===
 
 
 
Furthermore, the following mapping applies for LDAP entries:
 
 
 
{|class="wikitable"
 
!Key
 
!Value
 
|-
 
|First name
 
|givenName
 
|-
 
|Surname
 
|sn
 
|-
 
|Email address
 
|mail
 
|-
 
|Phone 1
 
|telephoneNumber
 
|-
 
|Phone 2
 
|homePhone
 
|-
 
|City/town
 
|l
 
|-
 
|Country
 
|c
 
|}
 
 
 
 
 
Note: Some fields like Email address are mandatory for moodle, so you should make sure all moodle users have a valid email in UCS.
 
 
 
=== Cronjob for deleting users ===
 
 
 
In order for Moodle to remove users from its database that are deleted in the LDAP, a cronjob must be defined in the UDM.
 
 
 
ucr set cron/moodle/command='wget -q -O /dev/null http://localhost/moodle/admin/cron.php'\
 
cron/moodle/time='*/10 * * * *'
 
 
 
== Restrictions ==
 
 
 
#'''OU''': At this time it is not possible for Moodle to search for all users using the LDAP base DN.
 
#'''Class mapping''': This article does not handle mappings between UCS@School classes and Moodle groups. If you need assistance to create the respective mapping or would like to have the setup packaged, feel free to contact Univention for an offer to create either.
 
 
 
== References ==
 
 
 
* Moodle - https://moodle.org/
 
* Moodle LDAP - https://docs.moodle.org/28/en/LDAP_authentication
 
* Moodle 2.8 Documentation - https://docs.moodle.org/28/en/New_features
 
 
 
== Further links ==
 
*[https://docs.moodle.org/28/en/Installing_Moodle_on_Debian_based_distributions]
 
  
 
[[Category:EN]]
 
[[Category:EN]]
 +
[[Category:Howtos]]

Latest revision as of 12:08, 4 September 2019

This page has been moved to the Knowledge Base Cool Solutions in the Forum.

Cool Solution - Install Moodle

Personal tools