Tuesday, November 23, 2010

Installing a web server on an Amazon AWS free VM

In the previous post I described how you get a free linux VM in the Amazon AWS cloud up and running. This post will describe how you can use it for something practical.

Apt-get is not installed on this Micro Instance VM. So at first I tried to do a manual install of Apache by simply uploading the .tar.gz files to the VM via WinSCP and tried to run the .configure file. This didn't work as a C compiler was not installed on the system. I went on to look for GCC and got that installed and then I could install Apache. For some reason it didn't quite work, though. And also it's mayby a little too much work to get a web server up and running...

Then I stumbled upon the Yum command which is similar to Apt-get and which is actually pre-installed in the VM and is working out of the box.

With Yum, installation is a breeze. Issue the following commands:

#sudo yum install httpd
#sudo chkconfig httpd on
#sudo /etc/init.d/httpd start

The sudo command will not prompt you for a password but will let you execute commands as root. You can't su -root... (alternatively, you can try sudo -i to get a root shell)

If it complains about a missing C compiler, then install it this way:

#sudo yum install gcc

The web server installs its .conf file in /etc/httpd/conf/httpd.conf. There's is the usual test page displayed until you place an index.html file in the /var/www/html folder.

3 comments:

  1. awesome, that helped me out.
    Can write more about setting up the Amazon server. I've never done it before and im a tad confused on setting up MySQL php etc...

    ReplyDelete
  2. the Yum command does the trick. Check out this post: http://blog.eukhost.com/webhosting/amping-a-server-in-10-minutes-using-yum/

    ReplyDelete
  3. Hi, I wish to run the Apache web server on AWS free tier server, found your blog very informative. I get the error c compiler not found error... could u please guide me as to how to get the respective binaries for the free tier AMI.

    Thanks in advance

    ReplyDelete

Note: Only a member of this blog may post a comment.