Handling of big data of tests with PHP/MariaDB in server with Debian GNU Linux

GNU Linux is essential to be able to do these tests. The acronym LAMP refers to a group of 4 technologies: Linux operating system, an Apache web server, a MySQL database and PHP programming language.

These technologies form a stack, which you can use to host dynamic websites like WordPress and Drupal. LAMP stacks are now the ones used to host web applications.

Here’s how to configure a LAMP server on Debian 9 and Ubuntu 18.

Primary requirements:

• Knowledge of administration in Linux.

• SSH access

• Access to edit text by command (eg Vim, nano, Emacs)

• Ability to install a Linux shred (here we are using Debian 9.4, but the steps for Ubuntu 18.4 are identified)

• A server or a virtual machine with a Linux distribution (a VPS, a dedicated server or a Public Cloud instance)

• Administrator access to the server (root)

OVHCloud offers services for which you are responsible. In fact, since we do not have administrative access to these machines, we do not have support for administrators, and we cannot offer you. This means that it is up to you to manage the software and security on a daily basis. We have provided this guide to help you with common tasks. However, we recommend that you contact a specialized provider if you have difficulties or questions about the administration, use or security of the server.

Step 1: Update your system

If you are using a Debian or Ubuntu distribution, we recommend that you reinstall your server from scratch (if possible). Please note that this action may delete all information.

Connect via SSH as root user. If you are not sure how to do it, you can find the information in this Introduction to SSH guide.

Once you have installed the operating system, we recommend that you update it:

apt-get update && apt-get upgrade -y

With this step, we make sure that it will have the last update.

Step 2: Create a new user with sudo privileges.

For security and good practice reasons, it is better to configure and manage a LAMP server with a separate user, which does not have root privileges. If you already have a user with sudo privileges but do not have root access, you can skip step 2. This type of feature is already available in the latest version of Ubuntu.

If you only have one root user, you can create a new user:

adduser mynewuser

The same information is required as a password. Other information may be optional, ahem. Name or phone.

Next, you will need to add the user to the group ’sudo’

usermod -aG sudo mynewuser

Next, log in with the new user:

su - mynewuser

Step 3: installing an Apache 2 server

In the first steps, you have configured the first block for the LAMP: Linux Distribution.

Now we will install the second block – Apache 2 web server – along with its documentation:

sudo apt-get install apache2 apache2-doc

If you have installed the server correctly, you will be able to access Apache’s default page by entering your IP address (or the name of the server) in your browser as follows: http://server_IP. Don’t worry if you don’t connect via HTTPS, as there is no certificate added at this stage.

This page is informative and will provide an overview of the Apache 2 configuration file, as well as its specific features. We recommend reading this information.

You can check if the Apache server is working properly with the following command:

sudo service apache2 status

It should appear, active status (running)

The apache server can be managed as follows:

service apache2 start => starts the service

apache2 service stop => stops the service

apache2 service restart => relaunches or reloads the service

Step 4: PHP Installation

Next, we will install the third block: PHP programming language

To install the PHP package, use the following command:

sudo apt-get install php

To test the installation, in the /var/www/html directory, create an info.php file with the following content:

cd /var/www/html

sudo nano index.php

Add the following lines to the file:

`php

<? php
phpinfo ();
?>

Then access the file directly from the browser: http: //server_IP/info.php.

You will be able to see the page that details all the specifications of your PHP environment (version 7.0.30 in your case):

Once you have reviewed this page, we strongly recommend that you delete the index.php file. This is because we always recommend that the details of your configuration are not public.

By default, the Apache web server does not prioritize PHP files over HTML. Here, at the root address, we have the index.html file and the index.php file. If we go back to the browser, at http: // server_IP, Apache will redirect us to the index.html page instead of index.php. This prioritization will not affect most content management systems, such as WordPress or Drupal. However, this rule can be modified if necessary.

Step 5: Install the MySQL / MariaDB database

This is the fourth and last step for our LAMP – database system.

In 2009, after Oracle acquired MySQL, the founder of MySQL created a more open community. His name is MariaDB, after his daughter. All MySQL commands are fully compatible with MariaDB, as one of the most popular web applications. The Debian Linux distribution offers MariaDB by default. If you are using Debian, you will see “MariaDB” in your terminal for this step.

This is the command you need to use (you will be prompted for the password):

sudo apt-get install mysql-server

By default, the MySQL / MariaDB administrator password will be the same as your username. To customize the security of your database, use the following command:

mysql_secure_installation

Enter the root password and change the password

Change the root password? [Y / n] => y New password:

Remove anonymous users

Remove anonymous users? [Y / n] => y

Disable remote root login:

Disallow root login remotely? [Y / n] => y

Now you must delete the “test” database that is created by default

Remove test database and access to it? [Y / n] => y

Now you can load the new settings:

Reload privilege tables now? [Y / n] => y

To test access to your database, use the following command:

mysql -u root -p
MariaDB \ [(none)]> show databases; MariaDB \ [(none)]> exit

We recommend that you create a specific user account and dedicate it to the web application. If necessary, you can refer to the following MySQL guide and [MariaDB] (https://mariadb.com/kb/en/library/user-account-management/ {.external}.

Step 6: Install phpMyAdmin (optional)

Your LAMP server is already configured. This step is optional. With the open source phpMyAdmin interface, you will be able to manage your databases more easily through a web interface.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.