- In order to connect to the instance we need to assign an IP address. In the left menu in the EC2 Management Console select Elastic IPs under Network & Security. Allocate a new address and assign it to your instance. Elastic IPs are free as long as they are assigned to an instance, so remeber not to leave any unallocated IP addresses as you will get charged by the hour. Remember the assigned IP.
- On your local machine use the pem key to SSH into your instance. On OS X change the permission of the key to 600 and use following command in terminal:
ssh -i yourkeyname.pem ubuntu@yourelasticip
and boom you are in. - Update the Ubuntu package manager and the installed packages:
sudo apt-get update sudo apt-get dist-upgrade
- Install Apache:
sudo apt-get install apache2
- Enable .htaccess files by editing the /etc/apache2/sites-available/default file, fx with vi or nano. Look for the /var/www directory and make sure it contains AllowOverride All. <Directory /var/www/>Options Indexes FollowSymLinks MultiViewsAllowOverride AllOrder allow,denyallow from all</Directory>
- Enable the rewrite module in Apache:
sudo a2enmod rewrite
- Install PHP5:
sudo apt-get install libapache2-mod-php5
- Restart Apache:
sudo /etc/init.d/apache2 restart
- Ensure that Apache is running by typing the instance IP in your browser.
- Allow the Ubuntu user to work with the /var/www folder:
sudo adduser ubuntu www-data sudo chown -R www-data:www-data /var/www sudo chmod -R g+rw /var/www
Logout and login again to pick up the new user group. Test by creating a directory and deleting it again in www without having to sudo. This will make your life easier since permissions will get messed up less once you start adding frameworks and tools to your web service. - Test PHP by cd into /var/www folder and typing sudo vi phptest.php. Hit i key to enter insert mode and just write a simple php script with a phpinfo() call.
Hit ESC to exit insert mode and type :wq to save and quit the vi editor. Go to instanceIP/phptest.php in your browser and you should see the phpinfo displayed. - Install MySQL:
sudo apt-get install mysql-server sudo apt-get install php5-mysql
Insert root password for the database and remember it. - To test MySQL let’s install PHPMyAdmin:
sudo apt-get install phpmyadmin
Next I think you need to install git.I don't prefer to use FTP client.
sudo apt-get install git