How to Easily Install a LAMP Server on Ubuntu

- - No comments
LAMP, which stands for Linux Apache MySQL and PHP, is an open-source web development stack that is used to run many websites. Often known as LAMP stack, the beauty of this software stack is that it contains components that are completely open source. Usually comprising Linux as the operating system, this software setup is used by many system administrators for their web servers. Among the sysadmin community, this type of setup is often known as a 'lamp box'. A lamp box mainly uses Linux as the operating system with Apache acting as the HTTP server. MySQL serves the database needs while an object oriented programming language like PHP, Perl, or Python takes care of the server-side programming. Though there are also different stacks like WAMP, which stands for Windows Apache MySQL PHP, and MAMP, which uses a Macintosh system, LAMP's popularity is growing quite rapidly thanks to its low cost and open-source nature. 

LAMP setups can come in handy if you want to host a website on your server. If you are a novice coder however, you don't need a server to get a website up and running. You can install LAMP on your own Ubuntu desktop as well. There are 2 ways to do this. One is the shorter one and the other is the longer one. That said, you would find both the steps pretty simple and straightforward even if you haven't started coding yet. 

Method 1.

This is a simple, one-step install that you'll love. First, type in the following command to install Tasksel:

sudo apt-get install tasksel

Next, open tasksel by issuing the following command:

sudo tasksel

Once that is done, an ncurses menu will show up letting you choose between different packages. Use your arrow keys to navigate the menu and choose LAMP from the list. Move the red cursor over a box besides LAMP and select the entry using the spacebar. Then, press tab so that the cursor rolls over to OK. 

This will install the entire LAMP stack Ubuntu. To test whether it is working or not, simply type in the address in your browser's address bar and see if you get a page that displays the message "It works!"

If you don't see the message then type in the following command in your terminal and try again: 

sudo /etc/init.d/apache2 start

Method 2. 

This is a slightly longer method and does pretty much the same thing as the aforementioned method. However, this can be useful for people who like to go through each and every step.

Install Apache by typing in the following command in your terminal:

sudo apt-get install apache2

This will install Apache on Ubuntu. To check if it has installed properly, type localhost in your browser's address bar. You should get an "It Works!" message if it is properly installed. If you don't get a message then try this command: 

sudo /etc/init.d/apache2 start

Installing MySQL and PHP:

To install MySQL and PHP, type in the following commands:

sudo apt-get install mysql-server php5 libapache2-mod-php5

That's it, you're done!

Written by: Abhishek, a regular TechSource contributor and a long-time FOSS advocate.

No comments

Post a Comment