EC2: Installing Updates and LAMP

Welcome to one of the last posts on EC2. Installing updates and LAMP is the easiest part of setting up an EC2 instance; it’s even easier on Ubuntu. I’m going to show you how to update both apt and yum based systems and install LAMP to get you up quick.

To get started, go ahead and open up terminal or PuTTY. Login to your server and you’ll be presented with something like this:

This particular box is running Ubuntu 10.10, an apt based system. Let’s install updates first. Enter this command:

sudo apt-get update

You’ll see a whole bunch of falling lines like this:

After that, run this command:

sudo apt-get upgrade -y

and voi la! Your server is updating any out of date software. It’s really easy.

On yum-based boxes, to update run this:

sudo yum update

you’ll see this:

at the prompt, type

y

then hit enter and you’ll see this:

That’s it! You’ve updated your server.

Now, let’s look at installing LAMP. It’s super easy. On Ubuntu enter:

sudo apt-get install lamp-server^

Don’t forget the carat! It’s actually important. If you want to install every package manually, you can enter:

sudo apt-get install apache2 php5 libabache2-mod-php5 php5-mysql mysql-server

Answer any questions it has, and you should be golden!

On YUM-based systems, copy and paste each line separately and then hit enter. Doing all of them at once isn’t recommended.

sudo yum install httpd
sudo yum install php
sudo yum install mysql-server
sudo yum install php-mysql
sudo yum install php-pecl-apc
sudo /etc/init.d/mysqld start
sudo /etc/init.d/httpd start

That’s it! You’re done! You can now host a website on your EC2 instance.

If you have any questions, let me know in the comments!