データベースの準備
echo "create dabases moodle;" | mysql -p -u root
初期設定を確認して、必要な箇所を書き換える。
外部サーバーからのアクセスの場合、16行目の localhost が相当鬱陶しいので消しておく
/etc/moodle/config.php
1 <?
2 # This file has been generated by debconf
3 # You can find a commented config file in /usr/share/doc/moodle/
4
5 unset($CFG);
6
7 $CFG->dbtype = 'mysql';
8 $CFG->dbhost = 'localhost';
9 $CFG->dbname = 'moodle';
10 $CFG->dbuser = 'root';
11 $CFG->dbpass = '1234';
12 $CFG->prefix = 'mdl_';
13
14 $CFG->dbpersist = "false";
15
16 #$CFG->wwwroot = 'http://localhost/moodle'; #外部からのアクセスなのでlocalhostはいやだ
17 $CFG->wwwroot = 'http://takuya.utena.example.jp/moodle';
18 $CFG->dirroot = '/usr/share/moodle';
19 $CFG->dataroot = '/var/lib/moodle';
20 $CFG->directorypermissions = 0750;
21 $CFG->admin = 'admin';
22
23 $CFG->respectsessionsettings = true;
24
25 if (file_exists("$CFG->dirroot/lib/setup.php")) { // Do not edit
26 include_once("$CFG->dirroot/lib/setup.php");
27 } else {
28 if ($CFG->dirroot == dirname(__FILE__)) {
29 echo "<p>Could not find this file: $CFG->dirroot/lib/setup.php</p>";
30 echo "<p>Are you sure all your files have been uploaded?</p>";
31 } else {
32 echo "<p>Error detected in config.php</p>";
33 echo "<p>Error in: \$CFG->dirroot = '$CFG->dirroot';</p>";
34 echo "<p>Try this: \$CFG->dirroot = '".dirname(__FILE__)."';</p>";
35 }
36 die;
37 }
38 ?>
ただMoodleをインストールしただけではつまらないので。
OpenSSOと認証連携をしてID/PWを統合して権限を統合してみるSaml認証を試してくる
参考
九州工業大学:OpenSSO , SAML (simpleSAMLphp)を利用した認証基盤を構築 - Open Source Solution Technology Corporation
SAMLプラグインを取得する
1.9 以上で動きます。
wget http://download.moodle.org/stable19/moodle-1.9.9.tgz tar zxvf moodle-1.9.9.tgz sudo cp -r moodle /var/www/moodle19 cd /tmp ;wget http://download.moodle.org/plugins/auth/saml.zip; unzip saml.zip MOODLE_HOME=/var/www/moodle19/ cp -r /tmp/saml $MOODLE_HOME/auth
19
20 Requirements:
21 - SimpleSAML (http://rnd.feide.no/simplesamlphp). Tested with version 1.4
22
27 1. unpack this archive into the /auth/ directory as you would for any Moodle
28 auth module (http://docs.moodle.org/en/Installing_contributed_modules_or_plugins).
[http://docs.moodle.org/en/Installing_contributed_modules_or_plugins:title]を参考にZIPを展開してプラグインの/auth/に展開してください
29 2. Login to Moodle as an administrator, and activate the module by navigating
30 Users -> Authentication -> Manage authentication and clicking on the enable icon.
Moodleに管理者でログインして、モジュールの有効化をクリックしてください。
アイコンは Users -> Authentication -> Manage authentication にあります。(
日本語版は ユーザ->認証->認証の管理)
31 3. Configure the settings for the plugin - it will not work unless you specify
32 the saml library path, the saml config path, the SP, and username attribute
33 mapping - this is the link between the SAML user identifier, and the Moodle user.
34 The configuration exists in two places - in the /auth/saml/config.php file, and
35 the standard User Authentication module configuration screens - please check
36 both!
プラグインの設定をする。SamlライブラリパスとSAML設定とユーザーマッピング設定するまでは動作しない。
MoodleユーザーとSAMLのユーザ名の対応表である。それは/auth/saml/config.php にあるんだけど、
37 - 4. If you only want auth/saml as login option, change login page to point to auth/saml/index.php
auth/saml のログインオプションを変更するなら index.phpを触る
38 - 5. If you want to use another authentication method together with auth/saml,
39 in parallel, change the 'Instructions' in the 'Common settings' of the
40 'Administrations >> Users >> Authentication Options' to contain a link to the
41 auth/saml login page (-- remember to check the href and src paths --):
42 <br>Click <a href="auth/saml/index.php">here</a> to login with SSO
43 - 4 Save the changes for the 'Common settings'
simplesamlphpをインストールする。
これもAptから入れる。Aptって本当に便利ですね。
sudo aptitude install simplesamlphp