Amazon Web Services – AWS – EC2 – PHP and MYSQL installation commands

Assuming that you have already created your AWS account and launched your EC2 instance using the console, following command will help you to configure/install PHP and MYSQL on the environment.

Launch terminal/control panel/ putty.

CD to the folder where *.pem file is located.

Use following command to launch your AWS server.

ssh -i “*.pem” ec2-user@ec2-xx-xxx-xxx-xxx.us-east-2.compute.amazonaws.com

As soon as you in the AWS terminal “sudo” command needs to be used.

You may need to run following command to update few more packages:

sudo yum update

PHP Installation command:

sudo yum install php-mysql php php-xml php-mcrypt php-mbstring php-cli mysql httpd

MYSQL Installation command:

sudo yum install mysql-server

MYSQL Database start command:

sudo /etc/init.d/mysqld start

MYSQL root password setup:

mysqladmin -u root password ‘[PASSWORD]’

Login to MYSQL as root user:

mysql -u root -p

Httpd.conf is located at:

/etc/httpd/conf folder

Usually your home page in Apache is located at /var/www/html but if you want to change the location, then edit the httpd.conf file to indicate the revised location.

Make sure you are not creating your files in the /home/ec2-user folder (based on my experience browser doesn’t look at it).

Leave a Reply

Your email address will not be published. Required fields are marked *


1 × eight =