Amazon EC2クラウドサービスインストレーション

提供:MoodleDocs
移動先:案内検索

作成中です - Mitsuhiro Yoshida (トーク)

これは基本的にクラウド内のLinuxボックスに関する記事ですが、私がこれを書いている時点でLinuxカテゴリに入れたくありません。Linuxカテゴリより、もっと一般的なことに思えるからです。このインストールガイドに詳細が不足している場合、または正常に動作しない場合、このページに付属しているコメントをご覧ください。私はこのドキュメントを前提のもとに始めて、そしてcli (Command Line Interface コマンドラインインターフェース)を使用したフルインストールに入ります。前提としまして、あなたがAmazon 32 bit EC2 Linuxサーバ契約済みであり、sshおよびhttpでアクセスできるものとします。

すべての必要条件をインストールする (Install all the requirements)

cli ( command-line interface) からrootまたはsudoにより以下のコマンドを実行します。

yum install httpd
yum install mysql-server 
yum install git
yum install php
yum install php-gd 
yum install php-pear
yum install php-mbstring
yum install memcached 
yum install php-mcrypt 
yum install php-xmlrpc 
yum install php-soap 
yum install php-intl 
yum install php-zip 
yum install php-zts
yum install php-xml

または入力を保存して、ターミナルにコピー&ペーストしてください。以下のコマンドよりMoodleインストレーションで必要なすべてがインストールされます:

sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs git httpd memcached mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mcrypt php-mysql php-pdo php-pear php-pecl-zip php-pspell php-soap php-xml php-xmlrpc php-zip php-zts unzip zip zip.so

起動時のmysqlおよびhttpdの動作を確実にする (To ensure that mysql and httpd come up on boot.)

chkconfig mysqld on 
chkconfig httpd on

MySQLでUTF8を確実に使用する (To ensure that utf8 is used by mysql)

下記の設定内容をを確認するため、/etc/my.cnf を編集します (場合によって、設定内容が変化するようです)。 最初に次のコマンドで、my.cnfをバックアップします:

cp /etc/my.cnf /etc/mycnf.original

そして、下記内容を確認するため編集画面を表示します:

[mysqld]
default-character-set=utf8
default-collation=utf8_unicode_ci
character-set-server=utf8
collation-server=utf8_unicode_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[client]
default-character-set=utf8

下記コマンドでMySQLの再起動を確認します:

service mysqld restart

FC16 (Fedora Core 16) では、my.cnfを読めるようにする必要があるようです。

[mysqld]
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under different user or group, 
# customize your systemd unit file for mysqld according to the
# instructions in http://fedoraproject.org/wiki/Systemd
character-set-server=utf8
collation-server=utf8_unicode_ci
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

httpd起動時にPHPが確実にインクルードされるために (In order to make sure php is included when httpd comes up)

下記のようなコンテンツのファイル「/etc/httpd/conf.d/php.conf」が存在していることを確認してください。

<IfModule prefork.c>
LoadModule php5_module modules/libphp5.so
</IfModule> <IfModule worker.c>
LoadModule php5_module modules/libphp5-zts.so
</IfModule>
AddHandler php5-script .php AddType text/html .php
DirectoryIndex index.php


このドキュメントを執筆しています2012年1月26日現在、php-commonには提供する必要のあるzipが含まれていません。そのため、私はフォーラム記事の添付としてコピーを置きました (http://moodle.org/mod/forum/discuss.php?d=194589)。恐らく、wiki buffがこの問題を改善することでしょう。

あなたがzipを取得できた場合、「/usr/lib/php/modules」ディレクトリ内に入れてください。

同時にあなたのphp.ini (/etc内) に下記設定を追加してください:

extension=zip.so

データベース、データベースおよびアクセス権を作成する (Create the database, database user and access rights)

下記コマンドを実行します:

mysql_secure_installation

すべてに質問に対して控えめに答えてください (例: localよりあなたはテストデータベースを必要としませんし、rootはMySQLに対するアクセスをlocalより持っているため、あなたはテストデータベースを必要としません)。ここではあなたにMySQLのrootパスワードを作成します。 MySQLユーザはUnixユーザに対して、あなたと一緒に何もする必要はありません。

下記のコマンドを実行します:

 mysql -u root -p
<あなたが上記で設定したパスワード>

あなたはMySQLに関して、以下の作業が必要です:

1. データベースを作成してください。あなたの好きなデータベース名にしてください。私はデータベース名に「moodledb」を使用しています。

2. データベースユーザを作成してください。あなたの好きなデータベースユーザ名にしてください。私はデータベースユーザ名に「moodledbuser」を使用しています。

3. そのユーザにlocalhostからのデータベースアクセス権限を与えてください。

4. localhost以外のデータベースアクセスは必要ではありません。


    • Now you are in mysql and all the commands are mysql commands and could equally be run on a windows instance of mysql. Do not forget the ";" after each command.
create database moodledb;
grant all privileges on moodledb.* to moodledbuser@localhost identified by '<put a pw here>';
quit

TEST the above by doing

mysql -u moodledbuser -p
<password>

If you get connected OK then you can go on and quit.

moodledataフォルダを作成する (Create moodledata folder)

mkdir /var/www/moodledata

The default root folder for apache is /var/www/html and so moodledata is not accessible from the web. Next, give the apache user all the access rights to moodledata. This is better than chmod 777 which some users seem to do.

chown apache:apache /var/www/moodledata

Moodleを取得する (Fetch moodle)

cd /var/www/html
git clone git://git.moodle.org/moodle.git

This should put all of moodle in a directory called moodle in the correct folder /var/www/html. It takes a while but you get %age feedback.

There are more sophisticated git commands, see git docs in moodle docs for more info. Also, you may give the apache user ownership of the site, this way, when you install, the script will be able to create the config.php file. If you leave the owner as root, you will have to paste the suggested config.php into /var/www/html/moodle

To give apache ownership do

chown -R apache:apache /var/www/html/moodle

インストールを実行する (Do the install)

Visit http://<your amazon host>/moodle

Well, it worked for me!

他のリソース (Other Resources)

For another method of using Amazon EC2 for Moodle hosting you can utilize the free image created by Bitnami.org: http://bitnami.org/stack/moodle which makes creating a Moodle server on Amazon a snap (no command line necessary)