29
Installing LAMP Stack on Ubuntu Instance Deploying Play Framework in EC2 - part # 2 kamarul kawnayeen

Installing Lamp Stack on Ubuntu Instance

Embed Size (px)

DESCRIPTION

second part of deploying play framework on amazon web services

Citation preview

Page 1: Installing Lamp Stack on Ubuntu Instance

Installing LAMP Stack on Ubuntu Instance

Deploying Play Framework in EC2 - part # 2

kamarul kawnayeen

Page 2: Installing Lamp Stack on Ubuntu Instance

PrefaceThis is the second part of deploying playframewok in EC2 tutorial series. In the previous part, I’ve showed how to setup a virtual server on AWS. I setup ubuntu 14.04 LTS there. In this part I’m going to complete setting up LAMP stack.

Considering LAMP, I will use :-➢ Apache as web server➢ MySQL as database➢ PHP as programming language

Page 3: Installing Lamp Stack on Ubuntu Instance

First, we are going to configure corresponding security group. The security group acts as a firewall allowing you to choose which protocols and ports are open to computers

over the internet.

Configuring Security Group

Page 4: Installing Lamp Stack on Ubuntu Instance

select your instance & check the security group associated with it

Page 5: Installing Lamp Stack on Ubuntu Instance

click “Security Groups” from left panel and select the one associated with your instance

Page 6: Installing Lamp Stack on Ubuntu Instance

Click on Inbound and then Click Edit

Page 7: Installing Lamp Stack on Ubuntu Instance

Add this 4 rules. The Custom TCP Rule (port 9000) will be needed for play application

Page 8: Installing Lamp Stack on Ubuntu Instance

Setting up Apache

Page 9: Installing Lamp Stack on Ubuntu Instance

Connect with your remote server using terminal & update your ubuntu

sudo apt-get updatesudo apt-get dist-upgrade

Page 10: Installing Lamp Stack on Ubuntu Instance

Install apache using the following command :

sudo apt-get install apache2

Page 11: Installing Lamp Stack on Ubuntu Instance

Now, we have to enable .htaccess file. To do so we have to edit the “000-default.conf” file at “/etc/apache2/sites-available/” directory

So, move to the sites-available directory and execute the following command

sudo nano 000-default.conf

Page 12: Installing Lamp Stack on Ubuntu Instance

look for /var/www/html directory and make sure it contains AllowOverride All

save & exit the nano editor via CTRL-X, “y” and Enter

Page 13: Installing Lamp Stack on Ubuntu Instance

Enable the rewrite module in Apache :sudo a2enmod rewrite

Install PHP 5 sudo apt-get install libapache2-mod-php5

Restart Apachesudo /etc/init.d/apache2 restart

Page 14: Installing Lamp Stack on Ubuntu Instance

Type the ip address of your instance & check whether apache is running

Page 15: Installing Lamp Stack on Ubuntu Instance

Allow ubuntu user to work with the /var/www/html directory:sudo adduser ubuntu www-datasudo chown -R www-data:www-data /var/www/htmlsudo chmod -R g+rw /var/www/html

Page 16: Installing Lamp Stack on Ubuntu Instance

Now we are going to test php installation. Go to the /var/www/html directory and create a file name phptest.php

cd /var/www/htmlsudo vi phptest.php

Page 17: Installing Lamp Stack on Ubuntu Instance

hit i key to enter insert mode and just call the phpinfo() function

hit esc to exit insert mode and type :wq to save and quit vi editor

Page 18: Installing Lamp Stack on Ubuntu Instance

type ip address of your instance/html/phptest.phpat your browser to test php

Page 19: Installing Lamp Stack on Ubuntu Instance

Installing MySQL

Page 20: Installing Lamp Stack on Ubuntu Instance

trysudo apt-get install mysql-serversudo apt-get install php5-mysql

Page 21: Installing Lamp Stack on Ubuntu Instance

Installing PHPMyAdmin

Page 22: Installing Lamp Stack on Ubuntu Instance

sudo apt-get install phpmyadmin

Page 23: Installing Lamp Stack on Ubuntu Instance

select apache2 web server

Page 24: Installing Lamp Stack on Ubuntu Instance

select yes while asking for configuring database for phpmyadmin

Page 25: Installing Lamp Stack on Ubuntu Instance

Enter password of database’s administrative user and hit Ok

Page 26: Installing Lamp Stack on Ubuntu Instance

Enter password for phpmyadmin (optional)

Page 27: Installing Lamp Stack on Ubuntu Instance

Confirming the password

Page 28: Installing Lamp Stack on Ubuntu Instance

Now we have to link phpmyadmin at /var/www/html directorysudo ln -s /usr/share/phpmyadmin /var/www/html

Page 29: Installing Lamp Stack on Ubuntu Instance

check out phpmyadmin at your browser