Home » Blog » General » How to install the Lamp server in Linux OS

How to install the Lamp server in Linux OS

posted in: General 0
To run the server side PHP program the easy PHP is needed in the windows OS, but in Linux OS, we should install the lamp server to run the server side program.
There are six steps to be followed to install the lamp server.

STEP 1: Install Apache

To install the Apache we should install the meta package of apache2.It is possible by searching and installing in the Software Center, or by running the following command.

(sudo apt-get install apache2)

STEP 2: Install MySQL

To install MySQL we should install the meta package of the MySQL server. We must install the Metapackage MySQL-server. It is possible by searching and installing in the Software Center, or by running the following command.

(sudo apt-get install mysql-server)

STEP 3: Install PHP

To install PHP we should install the meta package of the php5 and libapache2-mod-php5. This can be done by searching and installing in the Software Centre, or by running the following command.

(sudo apt-get install php5 libapache2-mod-php5)

STEP 4: Restart Server

The 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)

STEP 5: Check Apache

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

STEP 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 “\n\nYour PHP installation is working fine.\n\n\n”;‘)

Leave a Reply