Move your LAMP stack on AWS
The combination of Linux, Apache, MySQL, and Python or PHP (LAMP) is one of the most common software stacks for web servers, even for high-end web applications. In this course, the experienced sysadmin David Clinton will teach you how to install and configure a LAMP stack on AWS EC2 and RDS, also discussing security issues and selecting the right instance type for your application.
This course will cover all the steps in the process: from creating an instance to building a website-hosting LAMP stack. You'll find everything you need to configure your webserver using EC2 (Elastic Cloud Compute) and RDS (Amazon Relational Database) to power your MySQL instance.
Who should take this course
This is a beginner course that aims to introduce basic AWS concepts to anyone looking for a quick guide to building a web server in the AWS cloud. We'll take you through all the basic steps, from configuring your Linux installation to using Amazon RDS to take advantage of AWS scalability.
You should have some basic Linux knowledge. If you are new to Amazon Web Services, why not watch our AWS Basics course or some of the other introductory courses to the common AWS services, like Amazon RDS
And feel free to test your knowledge on the basic topics covered in this course by taking a quiz.
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
About the Author
David taught high school for twenty years, worked as a Linux system administrator for five years, and has been writing since he could hold a crayon between his fingers. His childhood bedroom wall has since been repainted.
Having worked directly with all kinds of technology, David derives great pleasure from completing projects that draw on as many tools from his toolkit as possible.
Besides being a Linux system administrator with a strong focus on virtualization and security tools, David writes technical documentation and user guides, and creates technology training videos.
His favorite technology tool is the one that should be just about ready for release tomorrow. Or Thursday.
Hi and welcome to our course on building a LAMP server on an EC2 instance on Ubuntu. What is LAMP? L-A-M-P stands for Linux, the operating system, A - Apache, which is a web server framework, M - MySQL, which is a database and P for programming language, usually either PHP or Python.
These are the tools that work really well together and for you to build your web server. Let's start by installing the LAMP stack on Ubuntu. This is a Ubuntu instance running on Amazon EC2 server. It's actually the low-end free instance of Ubuntu 1404 server edition. I should put in a good word for software repositories and particularly the software repositories that are managed through the Debian family of distribution sof Linux, which includes Ubuntu and a number of other distributions.
Through the process called App Get, which we're going to see a little bit of in a minute. You can acquire software, all three software. It is delivered, downloaded directly to your computer. It's installed properly, ready to go and it's maintained. There's a security update upstream that has to be delivered, it will be delivered automatically. If there are upgrades that just make the software more functional, that'll happen too. If you download and compile software using your own methods, manually or sometimes you have to but it's a shame because you lose the real functionality of the Debian App Get distribution system, the repositories.
So let's work with the repositories. Just to show you what I mean, let's update all the software packages on the system using the Apt Get facility and the word update.
Under pseudo, which gives us administration rights. In a few seconds or sometimes in minutes, all the packages that have been installed are not updated necessarily but any updates that are necessary in any new software that is placed in the repositories now becomes, at least, known to your system. Now that we have the latest updates available, let's install the Linux stack, I should say the LAMP stack and we'll do that with a single command that Ubuntu makes available, that is pseudo task cell install LAMP server.
With that one line, all the packages necessary to create a web server on this particular version of Ubuntu will be installed. We'll let the installation go on its own.
Now, everything's installed. Let's make sure that the various programs that have been installed are actually up and running. To do that, let's check the service of MySQL, the database and rather than start or stop or restart, which are commands that worked well with pseudo service, we'll just check the status. It's running, it's installed and running just the way it should be. Let's do the same thing with Apache. However, since we are using Apache version 2 so rather than just Apache, the service is actually called Apache 2 and it's running.
Python, the programming language doesn't have a service so it won't actually show up as a service request.
Rather let's try a witch against Python and we see in fact that there is a Python program installed where it belongs in user bin, ready to be use. So let's give it a shot. Let's actually create a small Python program. Let's create a file called Hello and any of you at all familiar with programming, will recognize hello as the hello world, the simple demonstration program just to make sure that you've got all the tools in place to work so we can use Nano, which by the way is a terminal-based text editor, happens to be my favorite. It's a favorite of a lot of people and this brings us to an empty file called Hello.py.
We'll begin with what every Python program needs at its top, the pointer to the Python program and let's say print hello world, with a semi colon. It control x, y for yes to save this file as hello python, hello.py and then to run it from the command line, Python hello.py and hello world is produced. So Python is up and running just the way it should be.
Let's see where our web server will take us. Now, here's a page that says Apache 2 is running and this is the default page you'll find on Apache 2 when it runs on Ubuntu, which includes, if you scroll down, instructions on setting up your web server just the way you want it but it's not anything that we've yet contributed ourselves, it's just the standard default page.
So we know that Apache is sharing the html, the browser files that we've created with the world. Unfortunately we haven't yet created any browser files.
Let's go and edit the html file by cd, change directory to var/www. LS means list all the files in that directory. We don't see any files but see one directory itself called html. Let's sit in to html and list the files in html and all we have is index.html with that will, if you take a look inside, be the contents that produced the web page we just saw. However, we're now going to get rid of it. We're going to move it. Html, actually we should be pseudo, we need the administrator rights to move a file in the var directory. Let's move it to index.html old and pseudo nano, let's create a new index of html file with a- Let's create a nicely aligned title, which is bold and just for fun, a close vision and types in some more text and control x, Y to save it. Let's take a look now to see if it actually has changed the main page of our web service.
So let's point our browser, in this case Firefox, to the IP address that Amazon has assigned to our instance. Enter and in fact we found the web page that we just created. So we now know that MySQL is working, Python is working, Apache now we see most definitely is working, it's provided us with this new web page. We're all up and running and ready in our next classes to see what we can do with this web server. Hope to see you then.