Debian 9 LAMP

  • Post author:
  • Post category:Linux

I finally made the switch from Centos to Debian which I felt has more updated packages and much larger community.

Here are the steps I took to setup one of my web servers.



To install MaridaDB on Stretch, just use apt to install the packages.


apt-get update

apt install mariadb-client mariadb-server


After Installation is complete run the following command to secure Mariadb





Apache 2

To install Apache run the following command

apt-get install apache2


To run virtual host in a custom directory you will need to edit httpd.conf add the following lines


Let says your going to create a user called www and you want to run all your virtual host inside that directory. You will need to add the following to allow apache to serve the web files

<Directory /home/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted




To install PHP 7 run the following command


apt install php7.0 php7.0-mysql php7.0-pear php7.0-xml



Now Enable MariaDB and Apache to start up when the system boots up.


systemctl enable apache2

systemctl enable mysql

Lets starts up the services

systemctl start apache2

systemctl start mysql


Now lets test it works

Create a file called test.php

Copy code and paste code


echo phpinfo();


Save and hit your IP address for example


You should see all the PHP module you have installed