/var/log/messages

Mar 17, 2017 - 2 minute read - Comments - misc

さくら vps に moodle [まとめ]

とりあえず手順を控えておくことに。

前提としては

  • さくら vps
  • Ubuntu 16.04

とします。導入はさくらのコンパネより「標準OSインストール」にて。基本的な方針としては

  • でびあんパケジの moodle を使う

です。以下な前処理を経て、というかたちなのかどうか。

  • ssh なログインの設定
  • iptables の設定
  • moodle パケジの導入
  • postgres の準備
  • apache2 の設定
  • php-pgsql, php-zip, php-mbstring, php-soap, php-intl 導入
  • moodledata ディレクトリの用意
  • /usr/share/moodle/config.php の用意

で、DocumentRoot にアクセスしたら導入画面が表示されたはず。詳細は以下にて。

導入後

とりあえずパスワードにて ssh 接続できる状態です。接続して

  • 公開鍵を scp して ~/.ssh/authorized_keys 投入
  • /etc/ssh/sshd_config にてパスワードによるログインは行なわない設定を盛り込む

次に iptables 云々ですが、以下。

  • iptables-persistent 導入
  • /etc/iptables/rules.v4 にルール追加
  • /etc/network/if-pre-up.d/iptables をよしなに修正
#!/bin/sh
iptables-restore < /etc/iptables/rules.v4
exit 0

デフォルトなルールでは ssh のみが許可されています。ここでは 80 なポートへのアクセスを許可する設定を

-A INPUT -j REJECT --reject-with icmp-host-prohibited

の前に盛り込みます。

moodle 導入

基本的には

$ sudo apt-get install moodle

です。そして postgres な DB 作って云々な初期設定。

  # su - postgres
  > psql -c "create user moodleuser createdb;" template1
  > psql -c "alter user moodleuser with encrypted password 'yourpassword';" template1

まで実行したところで、別端末にてログインして /etc/postgresql/9.1/main/pg_hba.conf

local   all             postgres                                peer

local   all             all                                     peer

という箇所を以下にして postgresql なサービスを再起動。

local   all             postgres                                md5

local   all             all                                     md5

で、以下を実行します。(先に設定したパスワードの入力が必要)

  > psql -c "create database moodle with encoding 'unicode';" -U moodleuser template1

で、先の設定を戻して以下を実行します。

  > psql -c "alter user moodleuser nocreatedb;" template1

その後、postgresql なサービスを再起動。ちなみに接続パスワードはよしなに修正しましょう。

最後に

moodle が依存しているパケジを導入します。

$ sudo apt-get install  php-pgsql, php-zip, php-mbstring, php-soap, php-intl

で、moodledata ディレクトリの用意をします。

$ sudo mkdir /path/to/moodledata
$ sudo chmod 777 /path/to/moodledata

最後に /usr/share/moodle/config.php をよしなに設定しつつ、apache2 の DocumentRoot を /usr/share/moodle に向ければ準備 OK なはずです。

TODO

自動設定なナニを作りたいのですがどうしたものか。

さくら vps に moodle 漫画

comments powered by Disqus