installing lamp stack on ubuntu instance
DESCRIPTION
second part of deploying play framework on amazon web servicesTRANSCRIPT
![Page 1: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/1.jpg)
Installing LAMP Stack on Ubuntu Instance
Deploying Play Framework in EC2 - part # 2
kamarul kawnayeen
![Page 2: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/2.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/3.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/4.jpg)
select your instance & check the security group associated with it
![Page 5: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/5.jpg)
click “Security Groups” from left panel and select the one associated with your instance
![Page 6: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/6.jpg)
Click on Inbound and then Click Edit
![Page 7: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/7.jpg)
Add this 4 rules. The Custom TCP Rule (port 9000) will be needed for play application
![Page 8: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/8.jpg)
Setting up Apache
![Page 9: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/9.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/10.jpg)
Install apache using the following command :
sudo apt-get install apache2
![Page 11: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/11.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/12.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/13.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/14.jpg)
Type the ip address of your instance & check whether apache is running
![Page 15: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/15.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/16.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/17.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/18.jpg)
type ip address of your instance/html/phptest.phpat your browser to test php
![Page 19: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/19.jpg)
Installing MySQL
![Page 20: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/20.jpg)
trysudo apt-get install mysql-serversudo apt-get install php5-mysql
![Page 21: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/21.jpg)
Installing PHPMyAdmin
![Page 22: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/22.jpg)
sudo apt-get install phpmyadmin
![Page 23: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/23.jpg)
select apache2 web server
![Page 24: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/24.jpg)
select yes while asking for configuring database for phpmyadmin
![Page 25: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/25.jpg)
Enter password of database’s administrative user and hit Ok
![Page 26: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/26.jpg)
Enter password for phpmyadmin (optional)
![Page 27: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/27.jpg)
Confirming the password
![Page 28: Installing Lamp Stack on Ubuntu Instance](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/28.jpg)
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](https://reader034.vdocument.in/reader034/viewer/2022052315/554baf01b4c905b3618b5803/html5/thumbnails/29.jpg)
check out phpmyadmin at your browser