Configure, Linux, Apache 2, MariaDB, PHP.

This article will guide to setup and configure basic Web development environment.

Step 1: Apache 2
sudo apt install apache2

Then run the following commands to apache2 always start when the computer is turned on.
sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service
After running, go to http: // localhost or to check, if there is an apache screen, the installation is successful.


Step 2: MariaDB
MariaDB is more advanced, more widely supported and more popular on the server than Mysql.

sudo apt-get install mariadb-server mariadb-client

Similar to MariaDB start when starting Ubuntu

sudo systemctl stop mysql.service
sudo systemctl start mysql.service
sudo systemctl enable mysql.service
Run the following commands in turn to install and configure MariaDB at the machine
sudo mysql_secure_installation
Note: The root password is simply set, so it matches the password ubuntu (123456) to avoid forgetting to re-install it when reinstalling.

Enter current password for root (enter for none): press enter.
Set root password? [Y/n]: Y
New password: 123456
Re-enter new password: 123456
Remove anonymous users? [Y/n]: Y
Disallow root login remotely? [Y/n]: Y
Remove test database and access to it? [Y/n]:  Y
Reload privilege tables now? [Y/n]:  Y

Restart MariaDB
sudo systemctl restart mysql.service

To check if MariaDB is working, open the Terminal and login MariaDB Console

sudo mysql -u root -p

Step 3: PHP 7.1 or 7.2
Recommend using php7.1 because it will be compatible with more 2 magento versions.
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Install php7.1 and the necessary libraries for magento 2
sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-zip php7.1-curl php7.1-bcmath

Or install php 7.2

sudo apt install php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-zip php7.2-curl php7.2-bcmath

After installing the above steps, proceed to configure php to optimize for Magento 2

Run command: sudo gedit /etc/php/7.1/apache2/php.ini
Locate and modify

file_uploads = On
allow_url_fopen = On
memory_limit = 1024M
upload_max_filesize = 100M
post_max_size = 100M
max_input_time = 360
max_execution_time = 360

Save file end restart apache 2: sudo service apache2 restart

Create one file phpinfo.php in folder /var/www/html/phpinfo.php

echo phpinfo();
If you see the PHP parameter screen displayed, it means that the PHP code is already running


Copyright © 2020-present, Inc. All rights reserved.