Setting up Amazon Web Services

To setting up Amazon Web Services, the process of setting up an EC2 on Amazon Web Services (AWS) is not complicated, all you need to get a server up and running are Apache, PHP,  MySQL. Here are some initial steps that help you get started:

###1. SSH connect to you EC2 instance. To connect to your instance, you need the private key and the elastic IP address that associate with your instance. You can create an associated elastic IP address right in your Amazon Console Management.

ssh -i [FILE NAME].pem ec2-user@[IP ADDRESS]

###2. Once you're connected, install update on your instance.

sudo yum -y update

3. Install PHP & its package.

sudo yum install php php-mysql php-xml php-mcrypt php-mbstring php-cli php-devel php-pdo php-pear
sudo pear install Log
sudo yum install -y pcre-devel

4. Install Apache http.

sudo yum install httpd

5. Install MySQL

sudo yum install mysql-server mysql-devel mysql

6. Install PHP APC module

sudo yum install php-pecl-apc

7. Configure MySQL and PHP

 Before you get everything running, make sure to check the PHP and MySQL configuration files.

  • The PHP configuration file is php.ini, which is located under /etc/php.ini. Open the php.ini and increase memory limit to: 128M (or bigger if you wish to).

  • The MySQL configuration file is my.cnf located under /etc/my.cnf. Change it to this:

Now you have all packages installed, you can start your web server by starting mysql-server and httpd.

sudo service mysqld start
sudo service httpd start

Auto start mysql server, and httpd.

sudo /sbin/chkconfig --levels 235 mysqld on
sudo /sbin/chkconfig --levels 235 httpd on