How to Install Nginx, Maria DB, PHP ( LEMP ) on CentOS 7 - IT Specialist

How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist

How to Install Nginx, Maria DB, PHP (LEMP) on CentOS 7 - IT Specialist. LEMP is an abbreviation of Linux, Nginx, Maria DB, and PHP. LEMP functions to make website and application servers become dynamic. It functions the same as XAMPP in the Windows operating system.

By using LEMP, CentOS 7 can become a fairly reliable system server. Maria DB functions as a database on a web server. Whereas Nginx is used as a web server itself. Finally, PHP is used to process dynamic content. In this article we will discuss about how to install LEMP CentOS 7 in full.

Things to Be Prepared

Before following this guide, you must have access to your IP server. To get an IP server the way to do this is to follow the initial VPS Centos 7 configuration guide.

How to Install LEMP on CentOS 7

Following are the steps to install LEMP on CentOS 7:

Step 1: Install Nginx

Nginx is an HTTP and proxy web server with open source code that can also function as an IMAP / POP3 proxy. Why use Nginx? Because Nginx offers small memory usage with high concurrency. So that it will speed you up to complete all processes on the server. Following are the steps on how to update CentOS 7 and install Nginx.

Update on CentOS 7

First, all you need to do is update CentOS 7 using the following command:
# sudo yum update

Install Nginx

Next, start the process with Nginx installation using this command.
# sudo yum install nginx
Because this is the sudo command, the system will run with root privileges. This access will ask for the root user password to verify.
After entering the password, you will be told which package to install and how much additional disk space you will use. Press Y and ENTER to continue.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist


Check the Nginx Installation

After the Nginx installation process is complete, you need to check whether your Nginx installation was successful. However, before that you have to activate Nginx on VPS hosting by using the below.
# sudo systemctl start nginx
Next is, you can do this checking process using a browser. Write the Internet Protocol (IP) address in the browser.
http: // Enter_IP_Your_Here
Then, the browser will display the default Nginx CentOS 7 page. Like the example in the image below.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist


Step 2:  Install Maria DB

After successfully installing Nginx, you can now install MariaDB. MariaDB is a database management system. Basically MariaDB will organize and provide access to the database where your site is located. The following are the steps to install mariadb.

Install MariaDB

To start the MariaDB installation, use the following command:
# sudo yum install mariadb-server maria db
This command will also display a list of packages to be installed along with the amount of disk space to be used. Press Y and ENTER to continue.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist

Activate Maria DB

When the installation is complete, you need to activate MariaDB using the following command.
# sudo systemctl start maria db

Install MariaDB Security Script

After you activate MariaDB, the MariaDB database is already running on your server.
Next, you need to run a security script that will clear some of MariaDB's default settings and lock access to your database system. Enter the following command to do this.
# sudo mysql_secure_installation
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist
Next, you will get a confirmation that you already have a root password so you can safely answer ‘n’. However, if you want to change the password press Y. In this tutorial choose the n option because we don't want to change the root password.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist
Then, press ENTER to accept the default. This command will delete some anonymous users.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist
Then, press ENTER to accept the default. This command will delete some anonymous users....
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist
At this stage you will be given the choice whether you want to delete the test database and remove access to the database.
In this tutorial we chose to delete the database by clicking Y / YES because the test database is only the database used to test whether the database is running well or not.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist

Next is the choice to reload the privilege table, the goal is to ensure the changes you have made. Press Y on this command to reload the changes that have been made.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist

Create a new user on MariaDB

To create a new account called admin with the same function as the root account. Enter the following command
# sudo mariadb

Now, you can create new users with root privileges and password-based access. In this tutorial we use the admin username and password admin1234. You can create a username and password freely. Enter this command.
MariaDB [(none)]> GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY 'admin1234' WITH GRANT OPTION;

Then, enter the Flush Privileges command to ensure that the user and password are stored and available in the database.
MariaDB [(none)]> FLUSH PRIVILEGES;
After that, exit MariaDB using the following command:
MariaDB [(none)]> exit;
Now, by following the steps above you have succeeded in creating a new user. So when you want to access your database by using a new User, you must enter the password that you just set. Enter the following command to enter the database with a new user.
# mariadb -u admin -p

Step 3: Install PHP

After the database system installation is successful and set up, you can continue to install PHP. PHP is used to run websites that are accessed online. PHP will manage the program code into website page views. In this case the website page. Enter the following command in the SSH Terminal to install PHP.
# sudo yum install php php-mysql

After the PHP installation is complete, you need to restart Nginx so that PHP works optimally by using the following command.
# sudo systemctl restarts httpd.service

PHP Installation Check

The function of checking PHP installation here is to ensure that the php installation performed on the server is successful. To check the PHP installation you can do this by creating a .php file that is added to the web server's root folder. This file is commonly called public_html.
On the CentOS operating system, the public_html folder is in the / var / www / html / directory. Open the / var / www / html / directory and create a public_html file.
The following steps to check whether PHP is running on the server properly.
First, enter the web server's root directory using the command.
# cd / var / www / html /
After that, in the www directory create a .php file using the touch command (Example info.php).
# touch info.php
Next, enter the command below to open the info.php file that was created.
# nano info.php
Then, enter the following script code.
<? php
nfo ();
?>
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist
Then save it using the command CTRL + X> Y> ENTER. The file will be saved and you will automatically exit the editor.
To ensure the success of adding php files to the html directory, you can open your browser and access your server's IP address like this.
http://196.33.55.32/info.php
If the PHP installation is successful, the results will be like in the image below.
How to Install Nginx, MariaDB, PHP (LEMP) on CentOS 7 - IT Specialist

Conclusion

After following the guidelines in this article, you can already install LEMP on the server. Furthermore, you can take further action to develop online-based systems such as websites. LEMP has fulfilled all the requirements needed for website development.
Thus the article about how to install LEMP on CentOS 7. If you still have questions do not hesitate to General Solusindo

Network Installation Services

CCTV Camera Installation Services

Fiber Optic Splicing Service

Server Installation Services