Installing Debian 8 (Jessie) LAMP Server v1.0

botond published 2019/02/09, Sat - 01:50 time

Content

 

Introductory

One is great for running your own websites, web development, creating a test environment, or practicing LAMP server quick compilation. However, to host client websites, I would prefer a more serious server configuration, such as a perfect server configuration for Debian to 8 or the Debian to 9.

In this description, we will install a very simple LAMP server on a Debian 8 (Jessie) operating system, which will include the following components:

All of these components are installed from the official Debian repositories in the versions indicated above. This way, you can update packages later centrally APT package manager It helps.

I will label this Debian 8 (Jessie) LAMP installation with the 1.0 version as we will be adding many more plugins later to make it even more useful and efficient.

Update: 2019-06-21:
Debian 8 (Jessie) archived on March 2019, 20 nem LTS libraries so they no longer receive updates.
Therefore, it is highly recommended to install Debian 9 (Stretch) when building a new server! Instead, this description is for reference only.
A The Debian 9 (Stretch) version of the LAMP server installation description can be viewed here.

 

You need a Debian 8 (Jessie) is a minimal server because we will build this LAMP server there.
Of course, it can also be installed on a desktop computer with a graphical environment; the important thing is that the above components are now first installed on the machine for proper configuration and operation.

 

 

System Update

First, log in to the server as root, then update the Debian packages as usual. apt-get command:

apt-get update
apt-get upgrade

 

Installing MySQL

Install MySQL with the following command:

apt-get -y install mysql-server mysql-client

A dialog will appear during installation:

MySQL Configuration - Set the root password

You will need to enter a root password and ask for confirmation.

 

Install Apache2

Install the Apache2 web server:

apt-get -y install apache2

You can also test how it works by typing in a browser to access the server (at my 192.168.1.120 IP address):

Apache2 default page

The default webroot directory is a / Var / www / html. So by default this is one virtualhoszt is configured during installation, whose configuration file is located here: /etc/apache2/sites-enabled/000-default.conf.

The Apache2 configuration file is: /etc/apache2/apache2.conf.

 

Installing PHP 5.6

The official PHP version shipped with Debian 8 is 5.6. To install it as an Apache module, use the following command:

apt-get -y install php5 libapache2-mod-php5
When using PHP as an Apache module, there are already more advanced server API (SAPI) uses, such as PHP-FPM, which runs the PHP server much more efficiently and securely. However, the primary purpose of this tutorial is to build the simplest web server possible for any (PHP-based) dynamic web page, CMS system We can run.
We will add many more things to this server later, including Installing and deploying PHP-FPM is.

Then restart Apache:

service apache2 restart

Then we can check PHP:

php --version
PHP 5.6.39-0+deb8u1 (cli) (built: Dec 16 2018 21:56:53) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies

Database support and installation of additional modules

In order to use PHP from the database, we need to add another package:

apt-get install php5-mysqlnd

After installation, phpinfo already shows MySQL support:

php --info | grep "MySQL"
MySQL Support => enabled
PDO Driver for MySQL => enabled

Then look at the list of available PHP modules in apt-cache command:

apt-cache search php5-

Here is a long list of PHP plugins we need.

For general PHP usage, you should install this assembly:

apt-get -y install \
    php5-apcu \
    php5-imagick \
    php5-intl \
    php5-json \
    php5-memcache \
    php5-curl \
    php5-gd \
    php5-imap \
    php5-mcrypt \
    php5-pspell \
    php-pear \
    php5-xmlrpc

It includes everything important, but of course you can install any package you need.

Let's restart Apache again:

service apache2 restart

PHP control

Go to the webroot directory and create a php file:

cd /var/www/html/
nano phpinfo.php

Add the following content and save it:

<?php
    phpinfo();
?>

Next, load the file from the web root into your browser:

http://192.168.1.120/phpinfo.php

PHP 5.6 information

 

 

Installing phpMyAdmin

Only the good old phpMyAdmin is installed, which has a convenient interface to efficiently work with databases. To install it, enter the following command:

apt-get -y install phpmyadmin

Here are some questions you might encounter during installation:

We need to select a web server to host the phpMyAdmin interface:

Configure phpMyAdmin - Select a web server

Here, of course, select apache2 and then OK.

The following panel asks if you want to automatically configure your own phpMyAdmin database for you:

Configure phpMyAdmin - Automatically configure a basic database using dbconfig-common

Select Yes.

You will then be prompted for the root password (specified during MySQL installation):

Configure phpMyAdmin - request root password

Give it to him.

You will then be prompted for another password that the phpMyAdmin control user will work with:

Configure phpMyAdmin - Password for Konrtoll (background administration) user

With this user, phpMyAdmin performs background maintenance, structure synchronization, etc., so we won't have to deal with it. This way we can press an enter, it will generate its own password for you.

We are done with that.

Enter phpMyAdmin with your browser a http://<IP-cím>/phpmyadmin Loading Address:

phpMyAdmin - Login

Since we only have root, let's log in with:

phpMyAdmin - Home Page

And a flawless phpMyAdmin interface welcomes us waiting for us to start working on it.

 

Download virtual machine

The finished virtual machine can be downloaded on this page.

 

Conclusion

So here is a completely basic LAMP web server that can now run any PHP and MySQL based website.

We will continue to work on it gradually to become a more useful and efficient server.