「AmazonEC2でのインストール方法」の版間の差分

提供:MoodleDocs
移動先:案内検索
 
84行目: 84行目:
Now you need to :
Now you need to :


* Install the version of Moodle required. I recommend using CVS to install Moodle. See [[管理者用CVS]].
* Install the version of Moodle required. I recommend using CVS to install Moodle. [[管理者用CVS]] または [[管理者用Git]] を見てください。
* Create Moodle site database
* Create Moodle site database
* [[Creating Moodle site data directory]]
* [[Creating Moodle site data directory]]

2012年6月2日 (土) 09:33時点における最新版

EC2インスタンスは、アマゾンから時間単位で借りることができる仮想ウェブサーバです。 レンタル料は、契約するインスタンスの性能によって変わります。

Amazon Web Services (AWS) でウェブサーバをセットアップする方法については、数ある書籍やウェブでの記事も参考にしてください。

下記の説明は、EC2インスタンス上でMoodleをセットアップする方法の一例です。

EC2インスタンスのレンタル契約をする

Amazon Web Services (AWS) のアカウントを作成してEC2インスタンスのレンタル契約をするのは、 The Amazon Web Service Console で行うことができます。

以下の例では、Elastic Block Store を用いた Amazon Linux AMI のインスタンスを使用しました。 Elastic Block Store を用いたインスタンスを使用すると、後であなたのディスクをバックアップするために、より多くのオプションが利用可能となります。 "Amazon Linux AMI"は、CentOSをベースとして必要最低限ものだけを含んだlinuxですので、セキュリティ的にも比較的安心です。 yumコマンドを使用すれば、何でも追加でインストールすることができます。

Elastic IP アドレスを関連づけてファイヤーウォール上の必要なポートを開ける

これも The Amazon Web Service Console において、

  • Elastic IP アドレスを作成し、Amazon Linux AMI で起動した EC2 インスタンスに関連付けます。
  • 22番と80番のポートを開けます。https 経由でのアクセスを行わない場合はこれで充分です。

作成したElastic IP アドレスに対応するドメイン名が欲しい場合は、DNSのサービスを利用する必要があります。Amazon は、この原稿執筆時点では、そのようなサービスは提供していません。

EC2インスタンスに putty 等の ssh クライアントで接続する

Through the The Amazon Web Service Console you can set up an ssh key and attach it to the ec2 instance you have running.

Your username for an ec2 instance using the Linux AMI will be ec2-user and no password will be required if you have the private key set up correctly.

putty ssh クライアントでのEC2インスタンスへのアクセス

In order for this key to work with putty on Windows you need to import it using puttygen and then save the private key in a safe location possibly with a pass phrase (local password) to protect it. You can then associate the key file with the ssh connection in putty by opening settings in Connection/SSH/Auth and browsing for the correct 'Private Key for Authentication'

Amazon Linux AMI 上でウェブサーバをセットアップする

Make sure all your currently installed packages are up to date.

   sudo yum -y update

You use yum to install all the software you need on your server. You can use the following command to install apache, mysql and php and the php extensions and all dependencies required by Moodle with this command :

   sudo yum -y install aspell aspell-en aspell-fr aspell-es cvs httpd mysql mysql-server php php-cli php-gd php-intl php-mbstring php-mysql php-pdo php-soap php-xml php-xmlrpc php-pspell

You can list all your installed packages (including dependencies) with this command :

   sudo yum list installed

サービスを開始し、再起動時にも自動的に起動するように設定する

Configure the new services to start automatically.

   sudo  /sbin/chkconfig httpd on
   sudo   /sbin/chkconfig mysqld on
   
   sudo  /sbin/service httpd start
   sudo   /sbin/service mysqld start

httpd.conf の編集

If you need to edit httpd.conf it is in /etc/httpd/conf

But by default the directory /var/www/html/ is the root web directory and you can install Moodle in there.

If you do edit httpd.conf then you must restart apache using this command for the changes to take effect :

   sudo  /sbin/service httpd restart

MYSQLのセットアップ

sudo mysqladmin -u root password 'new-password'

Make additional security-related changes to mysql. This can be done very easily with the command "mysql_secure_installation" and answering conservatively.

sudo mysql -u root -p
mysql> DROP DATABASE test;                            [removes the test database]
mysql> DELETE FROM mysql.user WHERE user = ;        [Removes anonymous access]
mysql> FLUSH PRIVILEGES;

Moodleのインストール

Now you need to :

Install Moodle by going to http://youelasticipaddress/roottoyourmoodleserver/ (if you have set up a domain name to point to your elasticip address then you should use that of course)

Copy the config.php that the installer creates and then go to the root of your moodleserver and do :

   sudo vi config.php

Then type i to put vi in insert mode and on putty you can use the right mouse key to paste the contents of the clipboard, then delete the former contents.

Then go again to the root of your Moodle installation http://youelasticipaddress/roottoyourmoodleserver/ and complete the automatic installation of your Moodle db.