LAMP Server

LAMP (Linux, Apache web server, MySQL relational database, PHP programming language) is a bundle of four suites that can handle the complete web service. In other words, it can be considered as the generic software stack model. LAMP is completely open source and free software. In windows, the equivalent bundle suit is named as WAMP, where W belongs to the window. Although the LAMP is bundle suit, it is possible to each component individual installation. That means each component can perform their task irrespective of others also. In Linux, most of the distribution already put LAMP in their repository which means they can be simply install using apt-get.


1. Linux

Linux is based on a Unix-like operating system and it is distributed on the open source software license. Linux was initially developed for personal use and based on Intel X86 architecture. The development of Linux is one of the milestones in open source history. Since this is open source, it can be used, modified and distributed- commercially or non-commercially by anyone under a license such as GNU General Public License. Some of the popular Linux distribution are  Debian, Ubuntu, Kali, CentOS, Fedora and so on. On the commercial side Red Hat, SUSE, etc. are the Linux leaders.

Steps for installation of Debian can be found HERE.

2. Apache

Apache is the most popular web server used now in the world. It is free and open source software, that means the source code is available to anyone and everyone. Apache also offers the service to add or delete the modules as per the needs. In basic meaning, Apache is a software that runs is OS and receive the queries from the client and serve the results back. Apache can be installed in windows, Linux or UNIX also. In windows, the equivalent is Apache.exe and in Unix is called HTTPd. Apache server offers a number of services that clients can use. For example, hypertext transfer control protocol (HTTP) at port 80, domain name services (DNS) at port 53 or so on. Apache works on TCP/IP protocols.

For more detail refer to this PAGE.

3. MySQL

 MySQL is a freely available open source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). SQL is the most popular language for adding, accessing and managing content in a database. It is most noted for its quick processing, proven reliability, ease and flexibility of use.


4. PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML.

Now, let’s move to the installation section. This installation is based on UBUNTU 14.04

1. Install Apache

Open the terminal with ctrl+alt+t ( may be different in your OS) and use the following commands.

sudo apt-get update
sudo apt-get install apache2

you can check if your installation succeeded by going to http://server-ip, where server-IP should be replaced by your server-IP for example or you can use localhost if you are browsing from the same server.

2.Install MySQL

MySQL is a database that holds the content of the website and helps to develop the dynamic website.

sudo apt-get install mysql-server php5-mysql

During installation, you have to provide your new database credentials. This is used for administration of MySQL. Then install the following package to be more secure.

sudo mysql_install_db
sudo mysql_secure_installation

3. Install PHP

This is an important tool, especially when you want your website to be dynamic. Because this connects the MySQL database and retrieve the information and provide it to the web server.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

Here we install some other components that are required for the proper function of PHP.  Then we install all the basic components of a LAMP server. This next step is optional in most case.

The web-server always look for index.html by default. If you want to change it to index.php then

sudo nano /etc/apache2/mods-enabled/dir.conf

Feel free to use nano editor if you prefer it. Then change according to the following code.

<IfModule mod_dir.c>
    DirectoryIndex index.php index.html index.cgi index.xhtml index.htm

Notice that, index.php comes to the first position in directory index.

Then restart the apache2 service by

sudo service apache2 restart

4. Test PHP in a web server


Anup Chhetri

IT system administrator

You may also like...

error: Content is protected !!