Install Linux, Nginx , MariaDB, PHP.

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

Step 1: Nginx
sudo apt install nginx

Then run the following commands to nginx always start when the computer is turned on. sudo systemctl stop nginx.service
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

See all logs of nginx via commands: sudo gedit /var/log/nginx/error.log

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 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


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