How to install LAMP Server on Debian 8.8 Jessie

Debian Tutorial – This tutorial will show you how to install LAMP Server on Debian 8.8 Jessie. LAMP stack consist of Linux Operating system. Apache web server, MySQL database server and PHP scripting language. The combination of those provide a reliable web server to host dynamic websites and web applications. Installing LAMP stack on Debian 8 is pretty simple.

Before we started, I assume you have installed Debian server locally or in the cloud. On this tutorial, I installed my Debian server on DigitalOcean.

Steps to install LAMP Server on Debian 8

Step 1. Update Debian

First of all, we need to make sure that our Debian is up to date

apt update && apt upgrade

Step 2. Install Apache

To install Apache web server on Debian 8, use the following command

apt install apache2 apache2-doc

Example

root@debian-512mb-sgp1-01:~# apt install apache2 apache2-doc
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  apache2-bin apache2-data apache2-utils libapr1 libaprutil1
  libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
Suggested packages:
  apache2-suexec-pristine apache2-suexec-custom openssl-blacklist
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-doc apache2-utils libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.1-0 ssl-cert
0 upgraded, 11 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,677 kB of archives.
After this operation, 26.7 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Now open web browser and type the IP address of your Debian server. It should show this apache default page.

install LAMP Server on Debian 8

Step 4. Install MySQL or MariaDB

Use this command to install MySQL Server on Debian 8

apt install mysql-server php5-mysql

Example

root@debian-512mb-sgp1-01:~# apt install mysql-server php5-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.5 mysql-common mysql-server-5.5
  mysql-server-core-5.5 php5-common
Suggested packages:
  libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libipc-sharedcache-perl mailx tinyca php5-user-cache
The following NEW packages will be installed:
  libaio1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl mysql-client-5.5 mysql-common mysql-server mysql-server-5.5
  mysql-server-core-5.5 php5-common php5-mysql
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 9,554 kB of archives.
After this operation, 97.8 MB of additional disk space will be used.
Do you want to continue? [Y/n]

You will be asked to specify the root password for MySQL

Secure MySQL Installation

Follow on screen wizard to secure the MySQL Installation. First execute this command to get started

mysql_secure_installation

MySQL Server will be started automatically. Check the status using this command

root@debian-512mb-sgp1-01:~# systemctl status mysql
● mysql.service - LSB: Start and stop the mysql database server daemon
   Loaded: loaded (/etc/init.d/mysql)
   Active: active (running) since Wed 2017-05-17 13:49:08 UTC; 2min 9s ago
   CGroup: /system.slice/mysql.service
           ├─6661 /bin/sh /usr/bin/mysqld_safe
           └─7005 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/log/mysql/error.log --pid...

May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.help_category                                OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.help_keyword                                 OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.help_relation                                OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.help_topic                                   OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.host                                         OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.ndb_binlog_index                             OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.plugin                                       OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.proc                                         OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7066]: mysql.procs_priv                                   OK
May 17 13:49:09 debian-512mb-sgp1-01 /etc/mysql/debian-start[7134]: Triggering myisam-recover for all MyISAM tables

Step 3. Install PHP

Finally, we need to install PHP on Debian 8.

apt install php5-common libapache2-mod-php5 php5-cli

Example

root@debian-512mb-sgp1-01:~# apt install php5-common libapache2-mod-php5 php5-cli
Reading package lists... Done
Building dependency tree
Reading state information... Done
php5-common is already the newest version.
php5-common set to manually installed.
The following extra packages will be installed:
  libonig2 libqdbm14 php5-json php5-readline
Suggested packages:
  php-pear
The following NEW packages will be installed:
  libapache2-mod-php5 libonig2 libqdbm14 php5-cli php5-json php5-readline
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,698 kB of archives.
After this operation, 20.0 MB of additional disk space will be used.
Do you want to continue? [Y/n]

Now restart apache web server

systemctl restart apache2

At this point we have successfully installed Apache web server, MySQL Server and PHP. Now our Debian system is ready for future web applications such as WordPress, OwnCloud, Nexcloud and many more. Thanks for reading this how to install LAMP Server on Debian 8.8 Jessie

 

1 Comment

1 Trackback / Pingback

  1. How to install OwnCloud 10 on Debian 8 Jessie - Free Tutorials

Leave a Reply

Your email address will not be published.


*