Note: You are currently viewing documentation for Moodle 3.2. Up-to-date documentation for the latest stable version of Moodle is probably available here: Amazon EC2 Cloud Services Installation.

Amazon EC2 Cloud Services Installation: Difference between revisions

From MoodleDocs
Line 26: Line 26:




chkconfig mysqld on  
chkconfig mysqld on  
 
chkconfig httpd on
chkconfig httpd on


= To ensure that utf8 is used by mysql =
= To ensure that utf8 is used by mysql =

Revision as of 15:23, 26 January 2012

This is essentially a linux box in the cloud but at the time of writing I did not like to add it to that category. If this install lacks detail or doesn't work then see comments attached to this page. I start this off with some assumptions and then go though a full install using the cli. Assumptions you have an Amazon 32 bit EC2 server setup and you have ssh & http access to it.

Install all the requirements

From the cli as root or 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 php-mcrypt 
yum install php-mbstring 
yum install memcached 
yum install php-mcrypt 
yum install php-zts 
yum install php-xmlrpc 
yum install php-soap 
yum install php-intl 
yum install php-zip 
yum install php-zts
yum install php-xml

To ensure that mysql and httpd come up on boot.

chkconfig mysqld on 
chkconfig httpd on

To ensure that utf8 is used by mysql

edit /etc/my.cnf to read as follows

[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

  1. 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

In order to make sure php is included when httpd comes up

make sure you have a file called /etc/httpd/conf.d/php.conf whose contents are like the following

<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


At the time of writing 26-01-2012) (php-common should provide zip.zo but it doesn't so I have put a copy here {http://moodle.org/mod/forum/discuss.php?d=194589] Attached to a forum post.) Perhaps a wiki buff could fix that better.

Once you have got zip.so, put it in /usr/lib/php/modules

Also you need to add

extension=zip.so

to your php.ini (in /etc)

Create the database, database user and access rights

run

mysql_secure_installation

Answer all the questions conservatively. (e.g. You will not need test databases or for root to have any other mysql access than local.) This will create a root mysql pw for you. Mysql users are nothing whatsoever to do with you unix users.

run

 mysql -u root -p
<password you set above>

In mysql you need to

1. make a database. The name can be anything you like. I used moodledb

2. make a database user. The name can be anything you like. I used moodledbuser.

3. give that user rights to access the database from the localhost.

4. No db access is required by anyone from any other host than the 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.

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.

chown apache:apache /var/www/moodledata

Fetch and do permissions on moodle

cd /var/www/html

git clone git://git.moodle.org/moodle.git

This should put all of moodle in a file called moodle in the correct folder /var/www/html

There are more sophisticated git commands, see git docs in moodle docs for more info.

chown -R apache:apache ./moodle


Do the install

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

Well, it worked for me!