Install LAMP On Debian based Linux

Submitted by editor on Fri, 07/01/2016 - 20:10

How to Install LAMP (Linux, Apache, MySQL and PHP) stack On Debian based Linux systems (Debian, Ubuntu, Mint ...) ?

Install Apache 2 server

sudo apt-get install apache2

#Test Apache 2
#Open : http://localhost/

Install PHP 5.6

Note : To use Drupal 8, you must install atlest PHP 5.5.9. If you need to install other Version Visit this Tuto.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php5.6

If you have this message add-apt-repository: command not found
run : apt-get install software-properties-common

Install PHP5.6 Modules

sudo apt-get install libapache2-mod-php5.6 php5.6-cgi php5.6-cli php5.6-curl php5.6-imap php5.6-gd php5.6-mysql php5.6-pgsql php5.6-sqlite3 php5.6-mbstring php5.6-json php5.6-bz2 php5.6-mcrypt php5.6-xmlrpc php5.6-gmp php5.6-xsl php5.6-soap php5.6-xml php5.6-zip php5.6-dba

#For PHP to work and be compatible with Apache you must restart Apache.
sudo /etc/init.d/apache2 restart


Install MySQL Server

sudo apt-get install mysql-server

In order for other computers on your network to view the server you have created, you must first edit the "Bind Address". Begin by opening up Terminal to edit the my.cnf file (/etc/mysql/my.cnf).
Change the line

bind-address =
Change the to your IP address.

Change Mysql root password

mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('yourpassword');


Run As a LAMP Install script

sudo apt-get install apache2
sudo apt-get install php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo apt-get install mysql-server

LAMP Install script

You can download and use my LAMP install script.
1. Extract the file.
2. change file mode. sudo chmod +x *.sh
3. Run the script. sudo ./


Add new comment