installing lamp stack on ubuntu instance
DESCRIPTION
second part of deploying play framework on amazon web servicesTRANSCRIPT
Installing LAMP Stack on Ubuntu Instance
Deploying Play Framework in EC2 - part # 2
kamarul kawnayeen
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
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
select your instance & check the security group associated with it
click “Security Groups” from left panel and select the one associated with your instance
Click on Inbound and then Click Edit
Add this 4 rules. The Custom TCP Rule (port 9000) will be needed for play application
Setting up Apache
Connect with your remote server using terminal & update your ubuntu
sudo apt-get updatesudo apt-get dist-upgrade
Install apache using the following command :
sudo apt-get install apache2
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
look for /var/www/html directory and make sure it contains AllowOverride All
save & exit the nano editor via CTRL-X, “y” and Enter
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
Type the ip address of your instance & check whether apache is running
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
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
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
type ip address of your instance/html/phptest.phpat your browser to test php
Installing MySQL
trysudo apt-get install mysql-serversudo apt-get install php5-mysql
Installing PHPMyAdmin
sudo apt-get install phpmyadmin
select apache2 web server
select yes while asking for configuring database for phpmyadmin
Enter password of database’s administrative user and hit Ok
Enter password for phpmyadmin (optional)
Confirming the password
Now we have to link phpmyadmin at /var/www/html directorysudo ln -s /usr/share/phpmyadmin /var/www/html
check out phpmyadmin at your browser