In the previous blog post we saw how to install Ubuntu on AWS EC2. Today we will see how to install a web server on this Ubuntu instance.
Here is a video of me installing all the necessary “stuff” on the Ubuntu instance. Below I’ll cover the install in more detail.
Once you have SSH’ed into your server, you can install Apache, MySQL, and PHP with pretty much a one line command. Apache is the web server which “serves” or delivers web pages to the user. MySQL is a database management software. PHP is the server side programming language for processing and communicating with MySQL. These programs along with Linux form the popular LAMP (Linux Apache MySQL PHP) stack. Here is the one line command that will install everything for you –
sudo apt-get install apache2 mysql-server php5 php5-mysql libapache2-mod-php5
The install should take 2-3 minutes. Once the installation is complete, go to the server IP address (remember, we set the IP address when setting up Ubuntu) and you should see a web page saying “It works” in the browser. Congratulations!
To add more pages and pretty much edit anything on your website, you will have to go the directory ‘/var/www’. This is the directory you should put all your web files initially.