How to install LEMP stack on Centos 7


There are many methods to install LEMP stack (Linux, Nginx, MariaDB & PHP-FPM) on Centos 7. Here we present to you method by using VPSSIM script.

First, check your version of the OS of your server by using two command lines below:

uname -a
cat /etc/*release*

Example result:

[root@tutorialspots ~]# uname -a
Linux tutorialspots.com 3.10.0-327.22.2.el7.x86_64 #1 SMP Thu Jun 23 17:05:11 UTC 2016
 x86_64 x86_64 x86_64 GNU/Linux
[root@tutorialspots ~]# cat /etc/*release*
CentOS Linux release 7.2.1511 (Core)
Derived from Red Hat Enterprise Linux 7.2 (Source)
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.2.1511 (Core)
CentOS Linux release 7.2.1511 (Core)
cpe:/o:centos:centos:7

check centos

We use Centos 7.2 64bits for example.

Now, begin to install LEMP stack on your OS.

Step 1: Use this command line:

yum -y install wget && wget https://vpssim.com/install  && sh install

Result:

[root@vultr ~]# yum -y install wget && wget https://vpssim.com/install  && sh in
stall
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
epel/x86_64/metalink                                     | 6.9 kB     00:00
epel                                                     | 4.3 kB     00:00
extras                                                   | 3.4 kB     00:00
updates                                                  | 3.4 kB     00:00
(1/7): epel/x86_64/group_gz                                | 170 kB   00:00
(2/7): epel/x86_64/updateinfo                              | 585 kB   00:00
(3/7): base/7/x86_64/group_gz                              | 155 kB   00:01
(4/7): extras/7/x86_64/primary_db                          | 149 kB   00:01
(5/7): epel/x86_64/primary_db                              | 4.2 MB   00:02
(6/7): base/7/x86_64/primary_db                            | 5.3 MB   00:07
(7/7): updates/7/x86_64/pr 89% [==============  ] 438 kB/s |  15 MB   00:04 ETA
...

We will see this screen:

install lemp step 1

=========================================================================
                     Choose Language For VPSSIM
=========================================================================
1) EngLish
2) VietNamese
3) Cancel
Type in your choice:

Type 1 or 2 depend on your language.

Step 2:

Now we see this screen:

==========================================================================
Default VPSSIM will setup PHP 5.6 for your server. If you want to use
--------------------------------------------------------------------------
other PHP versions, after Setup finished, change PHP version by using
--------------------------------------------------------------------------
[ Change PHP Version ] in [ Update System ] on VPSSIM Menu
--------------------------------------------------------------------------
PHP Version support: PHP 7.0, PHP 5.6, PHP 5.5 & PHP 5.4
==========================================================================
Server's Parameters:
--------------------------------------------------------------------------
Server Type: kvm
CPU Type:  Virtual CPU 714389bda930
CPU Core: 1
CPU Speed:  2399.996 MHz
Memory: 992 MB
Disk: 20G
IP: 45.32.20.103
--------------------------------------------------------------------------
Fill Out Your Information:
==========================================================================
Type In Your Domain [ENTER]: tutorialspots.com
Type In Phpmyadmin Port [ENTER]: 44522
=========================================================================
Choose MariaDB Version
=========================================================================
1) MariaDB 10.0 (Recommend)
2) MariaDB 5.5
Type in your choice:

Type your domain then type your phpmyadmin’s port. Then Choose MariaDB Version (10 or 5.5).

Step 3:

The current screen:

=========================================================================
VPSSIM Will Setup Your Server Follow The Information Below:
=========================================================================
Manage Domain: sim.tutorialspots.com
-------------------------------------------------------------------------
phpMyAdmin Port: 44522
-------------------------------------------------------------------------
MariaDB Version: 10.0
-------------------------------------------------------------------------
phpMyAdmin Version: 4.6.3
-------------------------------------------------------------------------
Nginx Version: 1.11.2
-------------------------------------------------------------------------
PHP Version: 5.6
=========================================================================
1) Agree
2) Do Not Agree
Type in your choice:

Type 1.

Step 4:

Current screen:

==========================================================================
Default VPSSIM will setup PHP 5.6 for your server. If you want to use
=========================================================================
Manage Infomation:
=========================================================================
phpMyAdmin: http://45.32.20.103:44522
-------------------------------------------------------------------------
View Server status: http://45.32.20.103:44522/SVstatus
-------------------------------------------------------------------------
Zend Opcache Manage: http://45.32.20.103:44522/ocp.php
-------------------------------------------------------------------------
Memcache Manage: http://45.32.20.103:44522/memcache.php
=========================================================================
If you pointed sim.tutorialspots.com to 45.32.20.103
-------------------------------------------------------------------------
Link Phpmyadmin (II): http://sim.tutorialspots.com:44522
=========================================================================
Command to call VPSSIM: vpssim
=========================================================================
Press [Enter] to continue ...

Press [Enter] to continue, then wait a few minutes.

...
 Installing : perl-Pod-Usage-1.63-3.el7.noarch                           17/86
 Installing : 4:perl-libs-5.16.3-286.el7.x86_64                          18/86
 Installing : perl-threads-1.87-4.el7.x86_64                             19/86
 Installing : perl-Carp-1.26-244.el7.noarch                              20/86
 Installing : 4:perl-Time-HiRes-1.9725-3.el7.x86_64                      21/86
 Installing : perl-threads-shared-1.43-6.el7.x86_64                      22/86
 Installing : perl-Scalar-List-Utils-1.27-248.el7.x86_64                 23/86
 Installing : perl-Storable-2.45-3.el7.x86_64                            24/86
 Installing : perl-Filter-1.49-3.el7.x86_64                              25/86
 Installing : perl-Exporter-5.68-3.el7.noarch                            26/86
 Installing : perl-constant-1.27-2.el7.noarch                            27/86
 Installing : perl-File-Temp-0.23.01-3.el7.noarch                        28/86
 Installing : perl-File-Path-2.09-2.el7.noarch                           29/86
 Installing : perl-PathTools-3.40-5.el7.x86_64                           30/86
 Installing : 4:perl-macros-5.16.3-286.el7.x86_64                        31/86
 Installing : perl-Time-Local-1.2300-2.el7.noarch                        32/86
 Installing : perl-Socket-2.010-3.el7.x86_64                             33/86
 Installing : 1:perl-Pod-Simple-3.28-4.el7.noarch                        34/86
 Installing : perl-Getopt-Long-2.40-2.el7.noarch                         35/86
 Installing : 4:perl-5.16.3-286.el7.x86_64                               36/86
 Installing : perl-Thread-Queue-3.02-2.el7.noarch                        37/86
 Installing : 1:perl-Error-0.17020-2.el7.noarch                          38/86
 Installing : perl-TermReadKey-2.30-20.el7.x86_64                        39/86
 Installing : perl-Data-Dumper-2.145-3.el7.x86_64                        40/86
 Installing : autoconf-2.69-11.el7.noarch                                41/86
 Installing : perl-XML-Parser-2.41-10.el7.x86_64                         42/86
 Installing : kernel-devel-3.10.0-327.22.2.el7.x86_64                    43/86
...
--2016-07-20 09:18:52--  https://github.com/openresty/headers-more-nginx-module/
archive/master.zip
Resolving github.com (github.com)... 192.30.253.112
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/openresty/headers-more-nginx-module/zip/ma
ster [following]
--2016-07-20 09:18:53--  https://codeload.github.com/openresty/headers-more-ngin
x-module/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.253.120
Connecting to codeload.github.com (codeload.github.com)|192.30.253.120|:443... c
onnected.
HTTP request sent, awaiting response... 200 OK
Length: 40266 (39K) [application/zip]
Saving to: `/usr/local/vpssim/headers-more-nginx-module.zip'

100%[======================================>] 40,266       112KB/s   in 0.4s

2016-07-20 09:18:54 (112 KB/s) - `/usr/local/vpssim/headers-more-nginx-module.zi
p' saved [40266/40266]
...
Total download size: 74 M
Installed size: 331 M
Downloading packages:
(1/9): MariaDB-10.0.26-centos7-x86_64-client.rpm           |  10 MB   00:03
(2/9): MariaDB-10.0.26-centos7-x86_64-devel.rpm            | 6.3 MB   00:00
(3/9): MariaDB-10.0.26-centos7-x86_64-compat.rpm           | 1.4 MB   00:04
(4/9): libaio-0.3.109-13.el7.x86_64.rpm                    |  24 kB   00:01
(5/9): perl-Net-Daemon-0.48-5.el7.noarch.rpm               |  51 kB   00:00
(6/9): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm               | 140 kB   00:02
(7/9): perl-DBI-1.627-4.el7.x86_64.rpm                     | 802 kB   00:02
(8/9): perl-PlRPC-0.2020-14.el7.noarch.rpm                 |  36 kB   00:01
(9/9): MariaDB-10.0.26-centos7-x86_64-server.rpm           |  55 MB   00:04
--------------------------------------------------------------------------------
Total                                              8.5 MB/s |  74 MB  00:08
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libaio-0.3.109-13.el7.x86_64                                 1/9
  Installing : MariaDB-client-10.0.26-1.el7.centos.x86_64                   2/9
  Installing : perl-Net-Daemon-0.48-5.el7.noarch                            3/9
  Installing : perl-PlRPC-0.2020-14.el7.noarch                              4/9
  Installing : perl-DBI-1.627-4.el7.x86_64                                  5/9
  Installing : perl-DBD-MySQL-4.023-5.el7.x86_64                            6/9
  Installing : MariaDB-server-10.0.26-1.el7 [####                         ] 7/9
...

Step 5:

=========================================================================
Set Root Password MySQL  ...
=========================================================================



Press [ENTER] to continue setup

Press [ENTER] to set password for user root MySQL

Enter root password MYSQL then retype.
Note: You must use only numbers, letters to set password !

Done, the server will auto restart and ready to use.

Now, you can use the command vpssim to manager your server.

vpssim

=========================================================================
            VPSSIM - Manage VPS/Server by VPSSIM.COM (3.4.1)
=========================================================================
                             VPSSIM Menu
=========================================================================
 1) Add Website & Code        14) CSF Firewall Manage
 2) Remove Website            15) IPtables Firewall Manage
 3) Backup & Restore Code     16) BitTorrent Sync Manage
 4) Database Manage           17) VPS Backup Manage
 5) PhpMyadmin Manage         18) Linux Malware Detect
 6) Zend OPcache Manage       19) Setup File Manager
 7) Memcached Manage          20) Setup SSL (https)
 8) Redis Cache Manage        21) Check & Block IP DOS
 9) FTP Server Manage         22) Tools - Addons
10) Swap Manage               23) Update System
11) Cronjob Manage            24) Clear All Caches
12) Log File Manage           25) Server Status
13) WordPress Blog Tools      26) Exit
Type in your choice:

You can see all setup information in: /home/VPSSIM-Setup-info.txt

Leave a Reply