How to install lamp on ubuntu

A “LAMP” stack is a group of open source software that is typically installed together to enable a server to host dynamic websites and web apps. This term is actually an acronym which represents the Linux operating system, with the Apache web server. The site data is stored in a MySQL database, and dynamic content is processed by PHP.

In this guide, we’ll get a LAMP stack installed on an Ubuntu. Ubuntu will fulfil our first requirement: a Linux operating system.

1. Install Apache

To install Apache you must install the Meta package apache2. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install apache2

2. Install MySQL

To install MySQL you must install the Meta package mysql-server. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install mysql-server

3. Install PHP

To install PHP you must install the Meta packages php5 and libapache2-mod-php5. This can be done by searching for and installing in the Software Centre, or by running the following command.

sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

4. Restart Server

Your server should restart Apache automatically after the installation of both MySQL and PHP. If it doesn’t, execute this command.

sudo /etc/init.d/apache2 restart

5. Check Apache

Open a web browser and navigate to http://localhost/. You should see a message saying It works!

6. Check PHP

You can check your PHP by executing any PHP file from within /var/www/. Alternatively you can execute the following command, which will make PHP run the code without the need for creating a file

php -r 'echo "Hello";'
admin

Comments are closed.

Help-Desk