How to Install LAMP stack on Kali Linux

Lamp stands for linux apache mysql php

So lets get started ,

sudo apt-get update

sudo apt-get install apache2

Enter Y to install the necessary dependencies

sudo apache2 -v 

Server version: Apache/2.4.25 (Debian)
Server built:   2017-01-25T22:59:26

To start , restart or stop the apache service

Open a terminal and enter the following commands

To start :

 $ /etc/init.d/apache2 start 

To stop :

 $ /etc/init.d/apache2 stop 

To restart :

$ /etc/init.d/apache2 restart 

To check whether apache is working or not

visit in your browser 



This should open the default apache2 debian page

Step 2

Install mysql . After installation start mysql service

 sudo /etc/init.d/mysql start 

 sudo mysql_secure_installation 

Follow the Screenshots

Step 3  - Install PHP

sudo apt-get -y install php7.0 libapache2-mod-php7.0 

//Restart server

 systemctl restart apache2

Check whether php 7 is installed

create a new file info.php

 $ cd /var/www 

 sudo gedit info.php 

and enter the following code


and save the file

Now open your browser and go to


The Webpage showing the details of php should be up !

That means , You have successfully installed PHP