LNMP架构+WordPress博客平台部署

    文章在linux操作系统上搭建LNMP架构,在此基础上部署WordPress博客平台。

一、架构

  • Linux:Centos操作系统。
  • nginx:Web 服务器。
  • Mysql:Mysql数据库服务器。
  • PHP:php编程语言运行环境。
  • WordPress:使用PHP语言开发的博客平台,也可以把 WordPress当作一个内容管理系统(CMS)来使用。下载地址:https://cn.wordpress.org/download/releases/

 

二、软硬件环境

节点

功能

操作系统

IP

软件

备注

Web Server

LNMP+WordPress

CentOS7.9

192.168.80.10/24

php-fpm(7.4.30)、Nginx(1.20.1)、mysql(mysql-community-server : 8.0.30);WordPress(6.0.1)

Internet源

Client

客户端浏览器

任意

192.168.80.x/24

浏览器

三、实施

1、基础环境配置

#VMware虚拟机网络为NAT模式,网关为:192.168.80.2

#测试访问internet是否正常

[root@localhost ~]# ping www.baidu.com

PING www.baidu.com (183.232.231.174) 56(84) bytes of data.

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=1 ttl=128 time=9.22 ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=2 ttl=128 time=8.83 ms

64 bytes from 183.232.231.174 (183.232.231.174): icmp_seq=3 ttl=128 time=8.04 ms

^C

--- www.baidu.com ping statistics ---

3 packets transmitted, 3 received, 0% packet loss, time 11037ms

rtt min/avg/max/mdev = 8.040/8.702/9.229/0.494 ms

#更改计算机名

[root@localhost ~]# hostnamectl set-hostname lnmp

[root@localhost ~]# bash

#关闭防火墙

[root@lnmp ~]# systemctl stop firewalld && systemctl disable firewalld

Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.

Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.

#关闭selinux

[root@lnmp ~]# setenforce 0

[root@lnmp ~]# vi /etc/selinux/config

# This file controls the state of SELinux on the system.

# SELINUX= can take one of these three values:

#     enforcing - SELinux security policy is enforced.

#     permissive - SELinux prints warnings instead of enforcing.

#     disabled - No SELinux policy is loaded.

SELINUX=disabled

# SELINUXTYPE= can take one of three values:

#     targeted - Targeted processes are protected,

#     minimum - Modification of targeted policy. Only selected processes are protected.

#     mls - Multi Level Security protection.

SELINUXTYPE=targeted

 

2、php-fpm安装

#Centos系统默认的yum源

[root@lnmp ~]# yum repolist

Loaded plugins: fastestmirror

Determining fastest mirrors

 * base: mirrors.aliyun.com

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

base                                                                                                                                  | 3.6 kB  00:00:00    

extras                                                                                                                                | 2.9 kB  00:00:00    

updates                                                                                                                               | 2.9 kB  00:00:00    

(1/4): extras/7/x86_64/primary_db                                                                                                     | 247 kB  00:00:00    

(2/4): base/7/x86_64/group_gz                                                                                                         | 153 kB  00:00:00    

(3/4): base/7/x86_64/primary_db                                                                                                       | 6.1 MB  00:00:00    

(4/4): updates/7/x86_64/primary_db                                                                                                    |  17 MB  00:00:01     

repo id                                                                   repo name                                                                    status

base/7/x86_64                                                             CentOS-7 - Base                                                              10,072

extras/7/x86_64                                                           CentOS-7 - Extras                                                               512

updates/7/x86_64                                                          CentOS-7 - Updates                                                            4,135

repolist: 14,719

#安装epel-release源,remi源所需要的前提源

[root@lnmp ~]# rpm -ivh http://dl.fedoraproject.org/pub/epel/7/aarch64/Packages/e/epel-release-7-12.noarch.rpm

Retrieving http://dl.fedoraproject.org/pub/epel/7/aarch64/Packages/e/epel-release-7-12.noarch.rpm

warning: /var/tmp/rpm-tmp.iEUoM0: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:epel-release-7-12                ################################# [100%]

[root@lnmp ~]# yum clean all

Loaded plugins: fastestmirror

Cleaning repos: base epel extras updates

Cleaning up list of fastest mirrors

[root@lnmp ~]# yum repolist

Loaded plugins: fastestmirror

Determining fastest mirrors

epel/x86_64/metalink                                                                                                                  | 5.5 kB  00:00:00    

 * base: mirrors.aliyun.com

 * epel: mirrors.bfsu.edu.cn

 * extras: mirrors.aliyun.com

 * updates: mirrors.aliyun.com

base                                                                                                                                  | 3.6 kB  00:00:00    

epel                                                                                                                                  | 4.7 kB  00:00:00    

extras                                                                                                                                | 2.9 kB  00:00:00    

updates                                                                                                                               | 2.9 kB  00:00:00    

(1/7): base/7/x86_64/group_gz                                                                                                         | 153 kB  00:00:00    

(2/7): epel/x86_64/group_gz                                                                                                           |  97 kB  00:00:00     

(3/7): extras/7/x86_64/primary_db                                                                                                     | 247 kB  00:00:00    

epel/x86_64/updateinfo         FAILED                                                                                      ]  0.0 B/s | 4.9 MB  --:--:-- ETA

https://ftp.riken.jp/Linux/fedora/epel/7/x86_64/repodata/29483dc7e2210ffa0c0985c66b85d40860de843cb67fc287e9da271f077652f0-updateinfo.xml.bz2: [Errno 14] HTTPS Error 404 - Not Found

Trying other mirror.

To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

(4/7): base/7/x86_64/primary_db                                                                                                       | 6.1 MB  00:00:00    

(5/7): epel/x86_64/updateinfo                                                                                                         | 1.0 MB  00:00:00    

(6/7): updates/7/x86_64/primary_db                                                                                                    |  17 MB  00:00:01    

(7/7): epel/x86_64/primary_db                                                                                                         | 7.0 MB  00:00:02    

repo id                                                     repo name                                                                                  status

base/7/x86_64                                               CentOS-7 - Base                                                                            10,072

*epel/x86_64                                                Extra Packages for Enterprise Linux 7 - x86_64                                             13,758

extras/7/x86_64                                             CentOS-7 - Extras                                                                             512

updates/7/x86_64                                            CentOS-7 - Updates                                                                          4,135

repolist: 28,477

#安装remi源,里面包括的php-fpm的各个版本

[root@lnmp ~]# rpm -ivh http://rpms.remirepo.net/enterprise/remi-release-7.rpm

Retrieving http://rpms.remirepo.net/enterprise/remi-release-7.rpm

warning: /var/tmp/rpm-tmp.vr8XCx: Header V4 DSA/SHA1 Signature, key ID 00f97f56: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:remi-release-7.9-3.el7.remi      ################################# [100%]

[root@lnmp ~]# yum clean all

Loaded plugins: fastestmirror

Cleaning repos: base epel extras remi-safe updates

Cleaning up list of fastest mirrors

[root@lnmp ~]# yum repolist

Loaded plugins: fastestmirror

Determining fastest mirrors

epel/x86_64/metalink                                                                                                                  | 5.5 kB  00:00:00    

 * base: mirrors.aliyun.com

 * epel: mirrors.bfsu.edu.cn

 * extras: mirrors.aliyun.com

 * remi-safe: mirrors.tuna.tsinghua.edu.cn

 * updates: mirrors.aliyun.com

base                                                                                                                                  | 3.6 kB  00:00:00    

epel                                                                                                                                  | 4.7 kB  00:00:00    

extras                                                                                                                                | 2.9 kB  00:00:00    

remi-safe                                                                                                                             | 3.0 kB  00:00:00    

updates                                                                                                                               | 2.9 kB  00:00:00    

(1/8): epel/x86_64/group_gz                                                                                                           |  97 kB  00:00:00    

(2/8): base/7/x86_64/group_gz                                                                                                         | 153 kB  00:00:00    

(3/8): extras/7/x86_64/primary_db                                                                                                     | 247 kB  00:00:00    

(4/8): base/7/x86_64/primary_db                                                                                                       | 6.1 MB  00:00:00    

(5/8): epel/x86_64/primary_db                                                                                                         | 7.0 MB  00:00:00    

(6/8): epel/x86_64/updateinfo                                                                                                         | 1.0 MB  00:00:01    

(7/8): updates/7/x86_64/primary_db                                                                                                    |  17 MB  00:00:01    

(8/8): remi-safe/primary_db                                                                                                           | 2.2 MB  00:00:01    

repo id                                               repo name                                                                                        status

base/7/x86_64                                         CentOS-7 - Base                                                                                  10,072

*epel/x86_64                                          Extra Packages for Enterprise Linux 7 - x86_64                                                   13,758

extras/7/x86_64                                       CentOS-7 - Extras                                                                                   512

remi-safe                                             Safe Remi's RPM repository for Enterprise Linux 7 - x86_64                                        4,864

updates/7/x86_64                                      CentOS-7 - Updates                                                                                4,135

repolist: 33,341

[root@lnmp ~]# ll /etc/yum.repos.d/

total 108

-rw-r--r--. 1 root root 1664 Oct 23  2020 CentOS-Base.repo

-rw-r--r--. 1 root root 1309 Oct 23  2020 CentOS-CR.repo

-rw-r--r--. 1 root root  649 Oct 23  2020 CentOS-Debuginfo.repo

-rw-r--r--. 1 root root  314 Oct 23  2020 CentOS-fasttrack.repo

-rw-r--r--. 1 root root  630 Oct 23  2020 CentOS-Media.repo

-rw-r--r--. 1 root root 1331 Oct 23  2020 CentOS-Sources.repo

-rw-r--r--. 1 root root 8515 Oct 23  2020 CentOS-Vault.repo

-rw-r--r--. 1 root root  616 Oct 23  2020 CentOS-x86_64-kernel.repo

-rw-r--r--. 1 root root 1050 Sep 18  2019 epel.repo

-rw-r--r--. 1 root root 1149 Sep 18  2019 epel-testing.repo

-rw-r--r--. 1 root root  446 Feb 15  2022 remi-glpi91.repo

-rw-r--r--. 1 root root  446 Feb 15  2022 remi-glpi92.repo

-rw-r--r--. 1 root root  446 Feb 15  2022 remi-glpi93.repo

-rw-r--r--. 1 root root  446 Feb 15  2022 remi-glpi94.repo

-rw-r--r--. 1 root root  855 Feb 15  2022 remi-modular.repo

-rw-r--r--. 1 root root  456 Feb 15  2022 remi-php54.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php70.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php71.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php72.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php73.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php74.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php80.repo

-rw-r--r--. 1 root root 1314 Feb 15  2022 remi-php81.repo

-rw-r--r--. 1 root root 2605 Feb 15  2022 remi.repo

-rw-r--r--. 1 root root  750 Feb 15  2022 remi-safe.repo

#安装php-fpm和扩展

[root@lnmp ~]# yum install -y php74-php php74-php-fpm php74-php-cli php74-php-common php74-php-devel php74-php-gd php74-php-pdo php74-php-mysql php74-php-mbstring php74-php-bcmath php74-php-xml php74-php-pecl-redis php74-php-process php74-php-intl php74-php-xmlrpc php74-php-soap php74-php-ldap php74-php-opcache

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * epel: mirrors.bfsu.edu.cn

 * extras: mirrors.aliyun.com

 * remi-safe: mirrors.tuna.tsinghua.edu.cn

 * updates: mirrors.aliyun.com

Resolving Dependencies

。。。。。。

Installed:

  php74-php.x86_64 0:7.4.30-1.el7.remi                                                   php74-php-bcmath.x86_64 0:7.4.30-1.el7.remi                        

  php74-php-cli.x86_64 0:7.4.30-1.el7.remi                                               php74-php-common.x86_64 0:7.4.30-1.el7.remi                       

  php74-php-devel.x86_64 0:7.4.30-1.el7.remi                                             php74-php-fpm.x86_64 0:7.4.30-1.el7.remi                          

  php74-php-gd.x86_64 0:7.4.30-1.el7.remi                                                php74-php-intl.x86_64 0:7.4.30-1.el7.remi                         

  php74-php-ldap.x86_64 0:7.4.30-1.el7.remi                                              php74-php-mbstring.x86_64 0:7.4.30-1.el7.remi                     

  php74-php-opcache.x86_64 0:7.4.30-1.el7.remi                                           php74-php-pdo.x86_64 0:7.4.30-1.el7.remi                          

  php74-php-pecl-mysql.x86_64 0:1.0.0-0.23.20190415.d7643af.el7.remi                     php74-php-pecl-redis5.x86_64 0:5.3.7-1.el7.remi                   

  php74-php-process.x86_64 0:7.4.30-1.el7.remi                                           php74-php-soap.x86_64 0:7.4.30-1.el7.remi                         

  php74-php-xml.x86_64 0:7.4.30-1.el7.remi                                               php74-php-xmlrpc.x86_64 0:7.4.30-1.el7.remi                        

Dependency Installed:

  apr.x86_64 0:1.4.8-7.el7                         apr-util.x86_64 0:1.5.2-6.el7                         audit-libs-python.x86_64 0:2.8.5-4.el7             

  autoconf.noarch 0:2.69-11.el7                    automake.noarch 0:1.13.4-3.el7                        checkpolicy.x86_64 0:2.5-8.el7                     

  cpp.x86_64 0:4.8.5-44.el7                        dejavu-fonts-common.noarch 0:2.33-6.el7               dejavu-sans-fonts.noarch 0:2.33-6.el7              

  environment-modules.x86_64 0:3.2.10-10.el7       fontconfig.x86_64 0:2.13.0-4.3.el7                    fontpackages-filesystem.noarch 0:1.44-8.el7        

  fribidi.x86_64 0:1.0.2-1.el7_7.1                 gcc.x86_64 0:4.8.5-44.el7                             gcc-c++.x86_64 0:4.8.5-44.el7                      

  gd3php.x86_64 0:2.3.3-7.el7.remi                 glibc-devel.x86_64 0:2.17-326.el7_9                   glibc-headers.x86_64 0:2.17-326.el7_9              

  graphite2.x86_64 0:1.3.10-1.el7_3                harfbuzz.x86_64 0:1.7.5-2.el7                         httpd.x86_64 0:2.4.6-97.el7.centos.5               

  httpd-tools.x86_64 0:2.4.6-97.el7.centos.5       jbigkit-libs.x86_64 0:2.0-11.el7                      kernel-headers.x86_64 0:3.10.0-1160.76.1.el7       

  keyutils-libs-devel.x86_64 0:1.5.8-3.el7         krb5-devel.x86_64 0:1.15.1-54.el7_9                   libX11.x86_64 0:1.6.7-4.el7_9                      

  libX11-common.noarch 0:1.6.7-4.el7_9             libXau.x86_64 0:1.0.8-2.1.el7                         libXpm.x86_64 0:3.5.12-1.el7                       

  libcgroup.x86_64 0:0.41-21.el7                   libcom_err-devel.x86_64 0:1.42.9-19.el7               libicu69.x86_64 0:69.1-4.el7.remi                  

  libjpeg-turbo.x86_64 0:1.2.90-8.el7              libkadm5.x86_64 0:1.15.1-54.el7_9                     liblzf.x86_64 0:3.6-7.el7                          

  libmpc.x86_64 0:1.0.1-3.el7                      libraqm.x86_64 0:0.7.0-4.el7                          libselinux-devel.x86_64 0:2.5-15.el7               

  libsemanage-python.x86_64 0:2.5-14.el7           libsepol-devel.x86_64 0:2.5-10.el7                    libsodium.x86_64 0:1.0.18-1.el7                    

  libstdc++-devel.x86_64 0:4.8.5-44.el7            libtiff.x86_64 0:4.0.3-35.el7                         libtool.x86_64 0:2.4.2-22.el7_3                    

  libverto-devel.x86_64 0:0.2.5-4.el7              libwebp7.x86_64 0:1.0.3-1.el7.remi                    libxcb.x86_64 0:1.13-1.el7                          

  libxml2-devel.x86_64 0:2.9.1-6.el7_9.6           libzstd.x86_64 0:1.5.2-1.el7                          m4.x86_64 0:1.4.16-10.el7                          

  mailcap.noarch 0:2.1.41-2.el7                    mpfr.x86_64 0:3.1.1-4.el7                             oniguruma5php.x86_64 0:6.9.8-1.el7.remi            

  openssl-devel.x86_64 1:1.0.2k-25.el7_9           pcre-devel.x86_64 0:8.32-17.el7                       perl.x86_64 4:5.16.3-299.el7_9                     

  perl-Carp.noarch 0:1.26-244.el7                  perl-Data-Dumper.x86_64 0:2.145-3.el7                 perl-Encode.x86_64 0:2.51-7.el7                    

  perl-Exporter.noarch 0:5.68-3.el7                perl-File-Path.noarch 0:2.09-2.el7                    perl-File-Temp.noarch 0:0.23.01-3.el7              

  perl-Filter.x86_64 0:1.49-3.el7                  perl-Getopt-Long.noarch 0:2.40-3.el7                  perl-HTTP-Tiny.noarch 0:0.033-3.el7                

  perl-PathTools.x86_64 0:3.40-5.el7               perl-Pod-Escapes.noarch 1:1.04-299.el7_9              perl-Pod-Perldoc.noarch 0:3.20-4.el7               

  perl-Pod-Simple.noarch 1:3.28-4.el7              perl-Pod-Usage.noarch 0:1.63-3.el7                    perl-Scalar-List-Utils.x86_64 0:1.27-248.el7       

  perl-Socket.x86_64 0:2.010-5.el7                 perl-Storable.x86_64 0:2.45-3.el7                     perl-Test-Harness.noarch 0:3.28-3.el7              

  perl-Text-ParseWords.noarch 0:3.29-4.el7         perl-Thread-Queue.noarch 0:3.02-2.el7                 perl-Time-HiRes.x86_64 4:1.9725-3.el7              

  perl-Time-Local.noarch 0:1.2300-2.el7            perl-constant.noarch 0:1.27-2.el7                     perl-libs.x86_64 4:5.16.3-299.el7_9                

  perl-macros.x86_64 4:5.16.3-299.el7_9            perl-parent.noarch 1:0.225-244.el7                    perl-podlators.noarch 0:2.5.1-3.el7                

  perl-threads.x86_64 0:1.87-4.el7                 perl-threads-shared.x86_64 0:1.43-6.el7               php74-php-json.x86_64 0:7.4.30-1.el7.remi          

  php74-php-mysqlnd.x86_64 0:7.4.30-1.el7.remi     php74-php-pecl-igbinary.x86_64 0:3.2.7-1.el7.remi     php74-php-pecl-msgpack.x86_64 0:2.1.2-1.el7.remi   

  php74-php-sodium.x86_64 0:7.4.30-1.el7.remi      php74-runtime.x86_64 0:1.0-3.el7.remi                 policycoreutils-python.x86_64 0:2.5-34.el7         

  python-IPy.noarch 0:0.75-6.el7                   scl-utils.x86_64 0:20130529-19.el7                    setools-libs.x86_64 0:3.3.8-4.el7                  

  tcl.x86_64 1:8.5.13-8.el7                        xz-devel.x86_64 0:5.2.2-2.el7_9                       zlib-devel.x86_64 0:1.2.7-20.el7_9                 

Dependency Updated:

  glibc.x86_64 0:2.17-326.el7_9        glibc-common.x86_64 0:2.17-326.el7_9      krb5-libs.x86_64 0:1.15.1-54.el7_9     libxml2.x86_64 0:2.9.1-6.el7_9.6   

  openssl.x86_64 1:1.0.2k-25.el7_9     openssl-libs.x86_64 1:1.0.2k-25.el7_9     xz.x86_64 0:5.2.2-2.el7_9              xz-libs.x86_64 0:5.2.2-2.el7_9     

  zlib.x86_64 0:1.2.7-20.el7_9       

Complete!

Installed:

  php74-php.x86_64 0:7.4.30-1.el7.remi                                                   php74-php-bcmath.x86_64 0:7.4.30-1.el7.remi                       

  php74-php-cli.x86_64 0:7.4.30-1.el7.remi                                               php74-php-common.x86_64 0:7.4.30-1.el7.remi                       

  php74-php-devel.x86_64 0:7.4.30-1.el7.remi                                             php74-php-fpm.x86_64 0:7.4.30-1.el7.remi                           

  php74-php-gd.x86_64 0:7.4.30-1.el7.remi                                                php74-php-intl.x86_64 0:7.4.30-1.el7.remi                         

  php74-php-ldap.x86_64 0:7.4.30-1.el7.remi                                              php74-php-mbstring.x86_64 0:7.4.30-1.el7.remi                     

  php74-php-opcache.x86_64 0:7.4.30-1.el7.remi                                           php74-php-pdo.x86_64 0:7.4.30-1.el7.remi                          

  php74-php-pecl-mysql.x86_64 0:1.0.0-0.23.20190415.d7643af.el7.remi                     php74-php-pecl-redis5.x86_64 0:5.3.7-1.el7.remi                   

  php74-php-process.x86_64 0:7.4.30-1.el7.remi                                           php74-php-soap.x86_64 0:7.4.30-1.el7.remi                         

  php74-php-xml.x86_64 0:7.4.30-1.el7.remi                                               php74-php-xmlrpc.x86_64 0:7.4.30-1.el7.remi                       

Dependency Installed:

  apr.x86_64 0:1.4.8-7.el7                         apr-util.x86_64 0:1.5.2-6.el7                         audit-libs-python.x86_64 0:2.8.5-4.el7             

  autoconf.noarch 0:2.69-11.el7                    automake.noarch 0:1.13.4-3.el7                        checkpolicy.x86_64 0:2.5-8.el7                     

  cpp.x86_64 0:4.8.5-44.el7                        dejavu-fonts-common.noarch 0:2.33-6.el7               dejavu-sans-fonts.noarch 0:2.33-6.el7              

  environment-modules.x86_64 0:3.2.10-10.el7       fontconfig.x86_64 0:2.13.0-4.3.el7                    fontpackages-filesystem.noarch 0:1.44-8.el7        

  fribidi.x86_64 0:1.0.2-1.el7_7.1                 gcc.x86_64 0:4.8.5-44.el7                             gcc-c++.x86_64 0:4.8.5-44.el7                       

  gd3php.x86_64 0:2.3.3-7.el7.remi                 glibc-devel.x86_64 0:2.17-326.el7_9                   glibc-headers.x86_64 0:2.17-326.el7_9              

  graphite2.x86_64 0:1.3.10-1.el7_3                harfbuzz.x86_64 0:1.7.5-2.el7                         httpd.x86_64 0:2.4.6-97.el7.centos.5               

  httpd-tools.x86_64 0:2.4.6-97.el7.centos.5       jbigkit-libs.x86_64 0:2.0-11.el7                      kernel-headers.x86_64 0:3.10.0-1160.76.1.el7       

  keyutils-libs-devel.x86_64 0:1.5.8-3.el7         krb5-devel.x86_64 0:1.15.1-54.el7_9                   libX11.x86_64 0:1.6.7-4.el7_9                      

  libX11-common.noarch 0:1.6.7-4.el7_9             libXau.x86_64 0:1.0.8-2.1.el7                         libXpm.x86_64 0:3.5.12-1.el7                       

  libcgroup.x86_64 0:0.41-21.el7                   libcom_err-devel.x86_64 0:1.42.9-19.el7               libicu69.x86_64 0:69.1-4.el7.remi                  

  libjpeg-turbo.x86_64 0:1.2.90-8.el7              libkadm5.x86_64 0:1.15.1-54.el7_9                     liblzf.x86_64 0:3.6-7.el7                          

  libmpc.x86_64 0:1.0.1-3.el7                      libraqm.x86_64 0:0.7.0-4.el7                          libselinux-devel.x86_64 0:2.5-15.el7               

  libsemanage-python.x86_64 0:2.5-14.el7           libsepol-devel.x86_64 0:2.5-10.el7                    libsodium.x86_64 0:1.0.18-1.el7                    

  libstdc++-devel.x86_64 0:4.8.5-44.el7            libtiff.x86_64 0:4.0.3-35.el7                         libtool.x86_64 0:2.4.2-22.el7_3                    

  libverto-devel.x86_64 0:0.2.5-4.el7              libwebp7.x86_64 0:1.0.3-1.el7.remi                    libxcb.x86_64 0:1.13-1.el7                         

  libxml2-devel.x86_64 0:2.9.1-6.el7_9.6           libzstd.x86_64 0:1.5.2-1.el7                          m4.x86_64 0:1.4.16-10.el7                          

  mailcap.noarch 0:2.1.41-2.el7                    mpfr.x86_64 0:3.1.1-4.el7                             oniguruma5php.x86_64 0:6.9.8-1.el7.remi            

  openssl-devel.x86_64 1:1.0.2k-25.el7_9           pcre-devel.x86_64 0:8.32-17.el7                       perl.x86_64 4:5.16.3-299.el7_9                     

  perl-Carp.noarch 0:1.26-244.el7                  perl-Data-Dumper.x86_64 0:2.145-3.el7                 perl-Encode.x86_64 0:2.51-7.el7                    

  perl-Exporter.noarch 0:5.68-3.el7                perl-File-Path.noarch 0:2.09-2.el7                    perl-File-Temp.noarch 0:0.23.01-3.el7              

  perl-Filter.x86_64 0:1.49-3.el7                  perl-Getopt-Long.noarch 0:2.40-3.el7                  perl-HTTP-Tiny.noarch 0:0.033-3.el7                

  perl-PathTools.x86_64 0:3.40-5.el7               perl-Pod-Escapes.noarch 1:1.04-299.el7_9              perl-Pod-Perldoc.noarch 0:3.20-4.el7               

  perl-Pod-Simple.noarch 1:3.28-4.el7              perl-Pod-Usage.noarch 0:1.63-3.el7                    perl-Scalar-List-Utils.x86_64 0:1.27-248.el7       

  perl-Socket.x86_64 0:2.010-5.el7                 perl-Storable.x86_64 0:2.45-3.el7                     perl-Test-Harness.noarch 0:3.28-3.el7              

  perl-Text-ParseWords.noarch 0:3.29-4.el7         perl-Thread-Queue.noarch 0:3.02-2.el7                 perl-Time-HiRes.x86_64 4:1.9725-3.el7              

  perl-Time-Local.noarch 0:1.2300-2.el7            perl-constant.noarch 0:1.27-2.el7                     perl-libs.x86_64 4:5.16.3-299.el7_9                

  perl-macros.x86_64 4:5.16.3-299.el7_9            perl-parent.noarch 1:0.225-244.el7                    perl-podlators.noarch 0:2.5.1-3.el7                

  perl-threads.x86_64 0:1.87-4.el7                 perl-threads-shared.x86_64 0:1.43-6.el7               php74-php-json.x86_64 0:7.4.30-1.el7.remi          

  php74-php-mysqlnd.x86_64 0:7.4.30-1.el7.remi     php74-php-pecl-igbinary.x86_64 0:3.2.7-1.el7.remi     php74-php-pecl-msgpack.x86_64 0:2.1.2-1.el7.remi   

  php74-php-sodium.x86_64 0:7.4.30-1.el7.remi      php74-runtime.x86_64 0:1.0-3.el7.remi                 policycoreutils-python.x86_64 0:2.5-34.el7         

  python-IPy.noarch 0:0.75-6.el7                   scl-utils.x86_64 0:20130529-19.el7                    setools-libs.x86_64 0:3.3.8-4.el7                  

  tcl.x86_64 1:8.5.13-8.el7                        xz-devel.x86_64 0:5.2.2-2.el7_9                       zlib-devel.x86_64 0:1.2.7-20.el7_9                 

Dependency Updated:

  glibc.x86_64 0:2.17-326.el7_9        glibc-common.x86_64 0:2.17-326.el7_9      krb5-libs.x86_64 0:1.15.1-54.el7_9     libxml2.x86_64 0:2.9.1-6.el7_9.6   

  openssl.x86_64 1:1.0.2k-25.el7_9     openssl-libs.x86_64 1:1.0.2k-25.el7_9     xz.x86_64 0:5.2.2-2.el7_9              xz-libs.x86_64 0:5.2.2-2.el7_9     

  zlib.x86_64 0:1.2.7-20.el7_9        

Complete!

[root@lnmp ~]# rpm -qi php74-php-fpm

Name        : php74-php-fpm

Version     : 7.4.30

Release     : 1.el7.remi

Architecture: x86_64

Install Date: Tue 23 Aug 2022 12:42:51 PM CST

Group       : Development/Languages

Size        : 6454220

License     : PHP and Zend and BSD and MIT and ASL 1.0 and NCSA

Signature   : DSA/SHA1, Tue 07 Jun 2022 05:47:31 PM CST, Key ID 004e6f4700f97f56

Source RPM  : php74-php-7.4.30-1.el7.remi.src.rpm

Build Date  : Tue 07 Jun 2022 05:30:28 PM CST

Build Host  : builder.remirepo.net

Relocations : (not relocatable)

Packager    : Remi Collet

Vendor      : Remi's RPM repository <Remi's RPM repository>

URL         : PHP: Hypertext Preprocessor

Bug URL     : Remi's RPM repository - Forum

Summary     : PHP FastCGI Process Manager

Description :

PHP-FPM (FastCGI Process Manager) is an alternative PHP FastCGI

implementation with some additional features useful for sites of

any size, especially busier sites.

#启动php-fpm

[root@lnmp ~]# systemctl start php74-php-fpm && systemctl enable php74-php-fpm

Created symlink from /etc/systemd/system/multi-user.target.wants/php74-php-fpm.service to /usr/lib/systemd/system/php74-php-fpm.service.

[root@lnmp ~]#  php74 -v

PHP 7.4.30 (cli) (built: Jun  7 2022 08:38:19) ( NTS )

Copyright (c) The PHP Group

Zend Engine v3.4.0, Copyright (c) Zend Technologies

    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies

3、nginx安装

#安装nginx,源使用epel

[root@lnmp ~]# yum install -y nginx

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * epel: mirrors.bfsu.edu.cn

 * extras: mirrors.aliyun.com

 * remi-safe: mirrors.tuna.tsinghua.edu.cn

 * updates: mirrors.aliyun.com

Resolving Dependencies

--> Running transaction check

---> Package nginx.x86_64 1:1.20.1-9.el7 will be installed

--> Processing Dependency: nginx-filesystem = 1:1.20.1-9.el7 for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libcrypto.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_0)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libssl.so.1.1(OPENSSL_1_1_1)(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: redhat-indexhtml for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libcrypto.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libprofiler.so.0()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Processing Dependency: libssl.so.1.1()(64bit) for package: 1:nginx-1.20.1-9.el7.x86_64

--> Running transaction check

---> Package centos-indexhtml.noarch 0:7-9.el7.centos will be installed

---> Package gperftools-libs.x86_64 0:2.6.1-1.el7 will be installed

---> Package nginx-filesystem.noarch 1:1.20.1-9.el7 will be installed

---> Package openssl11-libs.x86_64 1:1.1.1k-4.el7 will be installed

--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================

 Package                                    Arch                             Version                                    Repository                      Size

=============================================================================================================================================================

Installing:

 nginx                                      x86_64                           1:1.20.1-9.el7                             epel                           587 k

Installing for dependencies:

 centos-indexhtml                           noarch                           7-9.el7.centos                             base                            92 k

 gperftools-libs                            x86_64                           2.6.1-1.el7                                base                           272 k

 nginx-filesystem                           noarch                           1:1.20.1-9.el7                             epel                            24 k

 openssl11-libs                             x86_64                           1:1.1.1k-4.el7                             epel                           1.5 M

Transaction Summary

=============================================================================================================================================================

Install  1 Package (+4 Dependent packages)

Total download size: 2.4 M

Installed size: 6.7 M

Downloading packages:

(1/5): nginx-filesystem-1.20.1-9.el7.noarch.rpm                                                                                       |  24 kB  00:00:00    

(2/5): centos-indexhtml-7-9.el7.centos.noarch.rpm                                                                                     |  92 kB  00:00:00    

(3/5): gperftools-libs-2.6.1-1.el7.x86_64.rpm                                                                                         | 272 kB  00:00:00    

(4/5): openssl11-libs-1.1.1k-4.el7.x86_64.rpm                                                                                         | 1.5 MB  00:00:01    

(5/5): nginx-1.20.1-9.el7.x86_64.rpm                                                                                                  | 587 kB  00:00:01    

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Total                                                                                                                        1.8 MB/s | 2.4 MB  00:00:01    

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

  Installing : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                        1/5

  Installing : 1:nginx-filesystem-1.20.1-9.el7.noarch                                                                                                    2/5

  Installing : centos-indexhtml-7-9.el7.centos.noarch                                                                                                    3/5

  Installing : 1:openssl11-libs-1.1.1k-4.el7.x86_64                                                                                                      4/5

  Installing : 1:nginx-1.20.1-9.el7.x86_64                                                                                                               5/5

  Verifying  : 1:openssl11-libs-1.1.1k-4.el7.x86_64                                                                                                      1/5

  Verifying  : centos-indexhtml-7-9.el7.centos.noarch                                                                                                    2/5

  Verifying  : 1:nginx-filesystem-1.20.1-9.el7.noarch                                                                                                    3/5

  Verifying  : gperftools-libs-2.6.1-1.el7.x86_64                                                                                                        4/5

  Verifying  : 1:nginx-1.20.1-9.el7.x86_64                                                                                                               5/5

Installed:

  nginx.x86_64 1:1.20.1-9.el7                                                                                                                               

Dependency Installed:

  centos-indexhtml.noarch 0:7-9.el7.centos gperftools-libs.x86_64 0:2.6.1-1.el7 nginx-filesystem.noarch 1:1.20.1-9.el7 openssl11-libs.x86_64 1:1.1.1k-4.el7

Complete!

[root@lnmp ~]# rpm -qi nginx

Name        : nginx

Epoch       : 1

Version     : 1.20.1

Release     : 9.el7

Architecture: x86_64

Install Date: Tue 23 Aug 2022 12:48:08 PM CST

Group       : Unspecified

Size        : 1766800

License     : BSD

Signature   : RSA/SHA256, Tue 19 Oct 2021 08:41:45 AM CST, Key ID 6a2faea2352c64e5

Source RPM  : nginx-1.20.1-9.el7.src.rpm

Build Date  : Tue 19 Oct 2021 07:58:23 AM CST

Build Host  : buildhw-x86-12.iad2.fedoraproject.org

Relocations : (not relocatable)

Packager    : Fedora Project

Vendor      : Fedora Project

URL         : nginx news

Bug URL     : Bug List

Summary     : A high performance web server and reverse proxy server

Description :

Nginx is a web server and a reverse proxy server for HTTP, SMTP, POP3 and

IMAP protocols, with a strong focus on high concurrency, performance and low

memory usage.

#启动nginx

[root@lnmp ~]# systemctl start nginx && systemctl enable nginx

Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.

#测试nginx的web服务,http://192.168.80.10,nginx默认的根目录为:/usr/share/nginx/html

#查看nginx配置文件位置

[root@lnmp ~]# nginx -t

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok

nginx: configuration file /etc/nginx/nginx.conf test is successful

#修改nginx配置文件,使其支持PHP

[root@lnmp ~]# cat /etc/nginx/nginx.conf

# For more information on configuration, see:

#   * Official English Documentation: nginx documentation

#   * Official Russian Documentation: nginx: документация

user nginx;

worker_processes auto;

error_log /var/log/nginx/error.log;

pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.

include /usr/share/nginx/modules/*.conf;

events {

    worker_connections 1024;

}

http {

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '

                      '$status $body_bytes_sent "$http_referer" '

                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;

    tcp_nopush          on;

    tcp_nodelay         on;

    keepalive_timeout   65;

    types_hash_max_size 4096;

    include             /etc/nginx/mime.types;

    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.

    # See Core functionality

    # for more information.

    include /etc/nginx/conf.d/*.conf;

    server {

        listen       80;

        listen       [::]:80;

        server_name  _;

        root         /usr/share/nginx/html;

        index        index.php

        # Load configuration files for the default server block.

        include /etc/nginx/default.d/*.conf;

        error_page 404 /404.html;

        location = /404.html {

        }

        error_page 500 502 503 504 /50x.html;

        location = /50x.html {

        }

       

        location ~ \.php$ {

          root           /usr/share/nginx/html;

          fastcgi_pass   127.0.0.1:9000;

          fastcgi_index  index.php;

          fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

          include        fastcgi_params;

        }

    }

# Settings for a TLS enabled server.

#

#    server {

#        listen       443 ssl http2;

#        listen       [::]:443 ssl http2;

#        server_name  _;

#        root         /usr/share/nginx/html;

#

#        ssl_certificate "/etc/pki/nginx/server.crt";

#        ssl_certificate_key "/etc/pki/nginx/private/server.key";

#        ssl_session_cache shared:SSL:1m;

#        ssl_session_timeout  10m;

#        ssl_ciphers HIGH:!aNULL:!MD5;

#        ssl_prefer_server_ciphers on;

#

#        # Load configuration files for the default server block.

#        include /etc/nginx/default.d/*.conf;

#

#        error_page 404 /404.html;

#            location = /40x.html {

#        }

#

#        error_page 500 502 503 504 /50x.html;

#            location = /50x.html {

#        }

#    }

}

#重新加载nginx配置

[root@lnmp ~]# nginx -s reload

#创建php测试页

[root@lnmp ~]# echo "<?php phpinfo(); ?>" >/usr/share/nginx/html/phpinfo.php

4、mysql安装

#安装mysql源

[root@lnmp ~]#  rpm -ivh https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

Retrieving https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

warning: /var/tmp/rpm-tmp.VvXy04: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing...                          ################################# [100%]

Updating / installing...

   1:mysql80-community-release-el7-3  ################################# [100%]

#安装mysql-server,gpg不检查安装

[root@lnmp ~]# yum -y install mysql-server --nogpgcheck

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

 * base: mirrors.aliyun.com

 * epel: mirrors.bfsu.edu.cn

 * extras: mirrors.aliyun.com

 * remi-safe: mirrors.tuna.tsinghua.edu.cn

 * updates: mirrors.aliyun.com

Resolving Dependencies

--> Running transaction check

---> Package mysql-community-server.x86_64 0:8.0.30-1.el7 will be installed

--> Processing Dependency: mysql-community-common(x86-64) = 8.0.30-1.el7 for package: mysql-community-server-8.0.30-1.el7.x86_64

--> Processing Dependency: mysql-community-icu-data-files = 8.0.30-1.el7 for package: mysql-community-server-8.0.30-1.el7.x86_64

--> Processing Dependency: mysql-community-client(x86-64) >= 8.0.11 for package: mysql-community-server-8.0.30-1.el7.x86_64

--> Processing Dependency: net-tools for package: mysql-community-server-8.0.30-1.el7.x86_64

--> Running transaction check

---> Package mysql-community-client.x86_64 0:8.0.30-1.el7 will be installed

--> Processing Dependency: mysql-community-client-plugins = 8.0.30-1.el7 for package: mysql-community-client-8.0.30-1.el7.x86_64

--> Processing Dependency: mysql-community-libs(x86-64) >= 8.0.11 for package: mysql-community-client-8.0.30-1.el7.x86_64

---> Package mysql-community-common.x86_64 0:8.0.30-1.el7 will be installed

---> Package mysql-community-icu-data-files.x86_64 0:8.0.30-1.el7 will be installed

---> Package net-tools.x86_64 0:2.0-0.25.20131004git.el7 will be installed

--> Running transaction check

---> Package mariadb-libs.x86_64 1:5.5.68-1.el7 will be obsoleted

--> Processing Dependency: libmysqlclient.so.18()(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64

--> Processing Dependency: libmysqlclient.so.18(libmysqlclient_18)(64bit) for package: 2:postfix-2.10.1-9.el7.x86_64

---> Package mysql-community-client-plugins.x86_64 0:8.0.30-1.el7 will be installed

---> Package mysql-community-libs.x86_64 0:8.0.30-1.el7 will be obsoleting

--> Running transaction check

---> Package mysql-community-libs-compat.x86_64 0:8.0.30-1.el7 will be obsoleting

--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================

 Package                                         Arch                    Version                                    Repository                          Size

=============================================================================================================================================================

Installing:

 mysql-community-libs                            x86_64                  8.0.30-1.el7                               mysql80-community                  1.5 M

     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7

 mysql-community-libs-compat                     x86_64                  8.0.30-1.el7                               mysql80-community                  670 k

     replacing  mariadb-libs.x86_64 1:5.5.68-1.el7

 mysql-community-server                          x86_64                  8.0.30-1.el7                               mysql80-community                   54 M

Installing for dependencies:

 mysql-community-client                          x86_64                  8.0.30-1.el7                               mysql80-community                   14 M

 mysql-community-client-plugins                  x86_64                  8.0.30-1.el7                               mysql80-community                  2.5 M

 mysql-community-common                          x86_64                  8.0.30-1.el7                               mysql80-community                  645 k

 mysql-community-icu-data-files                  x86_64                  8.0.30-1.el7                               mysql80-community                  2.1 M

 net-tools                                       x86_64                  2.0-0.25.20131004git.el7                   base                               306 k

Transaction Summary

=============================================================================================================================================================

Install  3 Packages (+5 Dependent packages)

Total size: 75 M

Downloading packages:

Running transaction check

Running transaction test

Transaction test succeeded

Running transaction

Warning: RPMDB altered outside of yum.

  Installing : mysql-community-client-plugins-8.0.30-1.el7.x86_64                                                                                        1/9

  Installing : mysql-community-common-8.0.30-1.el7.x86_64                                                                                                2/9

  Installing : mysql-community-libs-8.0.30-1.el7.x86_64                                                                                                  3/9

  Installing : mysql-community-client-8.0.30-1.el7.x86_64                                                                                                4/9

  Installing : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                                 5/9

  Installing : mysql-community-icu-data-files-8.0.30-1.el7.x86_64                                                                                        6/9

  Installing : mysql-community-server-8.0.30-1.el7.x86_64                                                                                                7/9

  Installing : mysql-community-libs-compat-8.0.30-1.el7.x86_64                                                                                           8/9

  Erasing    : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        9/9

  Verifying  : mysql-community-common-8.0.30-1.el7.x86_64                                                                                                1/9

  Verifying  : mysql-community-client-plugins-8.0.30-1.el7.x86_64                                                                                        2/9

  Verifying  : mysql-community-icu-data-files-8.0.30-1.el7.x86_64                                                                                        3/9

  Verifying  : mysql-community-libs-8.0.30-1.el7.x86_64                                                                                                  4/9

  Verifying  : mysql-community-client-8.0.30-1.el7.x86_64                                                                                                5/9

  Verifying  : net-tools-2.0-0.25.20131004git.el7.x86_64                                                                                                 6/9

  Verifying  : mysql-community-libs-compat-8.0.30-1.el7.x86_64                                                                                           7/9

  Verifying  : mysql-community-server-8.0.30-1.el7.x86_64                                                                                                8/9

  Verifying  : 1:mariadb-libs-5.5.68-1.el7.x86_64                                                                                                        9/9

Installed:

  mysql-community-libs.x86_64 0:8.0.30-1.el7       mysql-community-libs-compat.x86_64 0:8.0.30-1.el7       mysql-community-server.x86_64 0:8.0.30-1.el7     

Dependency Installed:

  mysql-community-client.x86_64 0:8.0.30-1.el7          mysql-community-client-plugins.x86_64 0:8.0.30-1.el7  mysql-community-common.x86_64 0:8.0.30-1.el7

  mysql-community-icu-data-files.x86_64 0:8.0.30-1.el7  net-tools.x86_64 0:2.0-0.25.20131004git.el7          

Replaced:

  mariadb-libs.x86_64 1:5.5.68-1.el7                                                                                                                        

Complete!

[root@lnmp ~]# rpm -qi mysql-community-server

Name        : mysql-community-server

Version     : 8.0.30

Release     : 1.el7

Architecture: x86_64

Install Date: Tue 23 Aug 2022 01:26:37 PM CST

Group       : Applications/Databases

Size        : 252707994

License     : Copyright (c) 2000, 2022, Oracle and/or its affiliates. Under GPLv2 license as shown in the Description field.

Signature   : RSA/SHA256, Thu 07 Jul 2022 04:02:34 PM CST, Key ID 467b942d3a79bd29

Source RPM  : mysql-community-8.0.30-1.el7.src.rpm

Build Date  : Thu 07 Jul 2022 06:57:02 AM CST

Build Host  : pb2-el7-14.regionaliad02.mysql2iad.oraclevcn.com

Relocations : (not relocatable)

Packager    : MySQL Release Engineering <mysql-build@oss.oracle.com>

Vendor      : Oracle and/or its affiliates

URL         : MySQL

Summary     : A very fast and reliable SQL database server

Description :

The MySQL(TM) software delivers a very fast, multi-threaded, multi-user,

and robust SQL (Structured Query Language) database server. MySQL Server

is intended for mission-critical, heavy-load production systems as well

as for embedding into mass-deployed software. MySQL is a trademark of

Oracle and/or its affiliates

The MySQL software has Dual Licensing, which means you can use the MySQL

software free of charge under the GNU General Public License

(Licenses- GNU Project - Free Software Foundation). You can also purchase commercial MySQL

licenses from Oracle and/or its affiliates if you do not wish to be bound by the terms of

the GPL. See the chapter "Licensing and Support" in the manual for

further info.

The MySQL web site (MySQL) provides the latest news and

information about the MySQL software.  Also please see the documentation

and the manual for more information.

This package includes the MySQL server binary as well as related utilities

to run and administer a MySQL server.

#启动mysqld

[root@lnmp ~]# systemctl start mysqld

[root@lnmp ~]# systemctl enable mysqld

#查看日志,获取初始密码,该密码要修改后才能操作数据库,否则show databases都会出错

[root@lnmp ~]#  grep 'temporary password' /var/log/mysqld.log

2022-08-23T05:28:51.383964Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9!VwpaeEFHmm

[root@lnmp ~]# mysqladmin -uroot -p'9!VwpaeEFHmm' password '1qa2ws#ED'

mysqladmin: [Warning] Using a password on the command line interface can be insecure.

Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

#登录数据库引擎,创建wordpress数据库

[root@lnmp ~]# mysql -uroot -p1qa2ws#ED

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 9

Server version: 8.0.30 MySQL Community Server - GPL

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)

mysql> create database wordpress;

Query OK, 1 row affected (0.00 sec)

mysql> exit

Bye

5、WordPress安装

[root@lnmp ~]# ll

total 21424

-rw-------. 1 root root     1646 Mar 26 13:10 anaconda-ks.cfg

-rw-r--r--. 1 root root 21933976 Aug 22 12:53 wordpress-6.0.1-zh_CN.tar.gz

#解压wrodpress

[root@lnmp ~]#  tar -xf wordpress-6.0.1-zh_CN.tar.gz

[root@lnmp ~]# ll

total 21428

-rw-------. 1 root root     1646 Mar 26 13:10 anaconda-ks.cfg

drwxr-xr-x. 5 1006 1006     4096 Aug 15 17:00 wordpress

-rw-r--r--. 1 root root 21933976 Aug 22 12:53 wordpress-6.0.1-zh_CN.tar.gz

#把wordpress网页上传到nginx根目录

[root@lnmp ~]# mv wordpress/* /usr/share/nginx/html/

[root@lnmp ~]# cd /usr/share/nginx/html/

[root@lnmp html]# ll

total 228

-rw-r--r--.  1 root root  3650 Oct 19  2021 404.html

-rw-r--r--.  1 root root  3693 Oct 19  2021 50x.html

lrwxrwxrwx.  1 root root    20 Aug 23 12:48 en-US -> ../../doc/HTML/en-US

drwxr-xr-x.  2 root root    27 Aug 23 12:48 icons

lrwxrwxrwx.  1 root root    18 Aug 23 12:48 img -> ../../doc/HTML/img

lrwxrwxrwx.  1 root root    25 Aug 23 12:48 index.html -> ../../doc/HTML/index.html

-rw-r--r--.  1 1006 1006   405 Feb  6  2020 index.php

-rw-r--r--.  1 1006 1006 19915 Jan  1  2022 license.txt

-rw-r--r--.  1 root root   368 Oct 19  2021 nginx-logo.png

lrwxrwxrwx.  1 root root    14 Aug 23 12:48 poweredby.png -> nginx-logo.png

-rw-r--r--.  1 1006 1006  7401 Mar 23 05:11 readme.html

-rw-r--r--.  1 root root    20 Aug 23 13:17 test.php

-rw-r--r--.  1 1006 1006  7165 Jan 21  2021 wp-activate.php

drwxr-xr-x.  9 1006 1006  4096 Aug 15 17:00 wp-admin

-rw-r--r--.  1 1006 1006   351 Feb  6  2020 wp-blog-header.php

-rw-r--r--.  1 1006 1006  2338 Nov 10  2021 wp-comments-post.php

-rw-r--r--.  1 1006 1006  3001 Dec 14  2021 wp-config-sample.php

drwxr-xr-x.  5 1006 1006    69 Aug 15 17:00 wp-content

-rw-r--r--.  1 1006 1006  3943 Apr 28 17:49 wp-cron.php

drwxr-xr-x. 26 1006 1006 12288 Aug 15 17:00 wp-includes

-rw-r--r--.  1 1006 1006  2494 Mar 20 04:31 wp-links-opml.php

-rw-r--r--.  1 1006 1006  3973 Apr 12 09:47 wp-load.php

-rw-r--r--.  1 1006 1006 48498 Apr 29 22:36 wp-login.php

-rw-r--r--.  1 1006 1006  8577 Mar 23 00:25 wp-mail.php

-rw-r--r--.  1 1006 1006 23706 Apr 12 17:26 wp-settings.php

-rw-r--r--.  1 1006 1006 32051 Apr 11 19:42 wp-signup.php

-rw-r--r--.  1 1006 1006  4748 Apr 11 19:42 wp-trackback.php

-rw-r--r--.  1 1006 1006  3236 Jun  9  2020 xmlrpc.php

#生成wordpress配置文件

[root@lnmp html]# cp wp-config-sample.php wp-config.php

#修改wordpress配置文件,主要修改连接数据库的参数

[root@lnmp html]# vi wp-config.php

<?php

/**

 * The base configuration for WordPress

 *

 * The wp-config.php creation script uses this file during the installation.

 * You don't have to use the web site, you can copy this file to "wp-config.php"

 * and fill in the values.

 *

 * This file contains the following configurations:

 *

 * * Database settings

 * * Secret keys

 * * Database table prefix

 * * ABSPATH

 *

 * @link Editing wp-config.php – Documentation – WordPress.org

 *

 * @package WordPress

 */

// ** Database settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define( 'DB_NAME', 'wordpress' );

/** Database username */

define( 'DB_USER', 'root' );

/** Database password */

define( 'DB_PASSWORD', '1qa2ws#ED' );

/** Database hostname */

define( 'DB_HOST', 'localhost' );

/** Database charset to use in creating database tables. */

define( 'DB_CHARSET', 'utf8' );

/** The database collate type. Don't change this if in doubt. */

define( 'DB_COLLATE', '' );

/**#@+

 * Authentication unique keys and salts.

 *

 * Change these to different unique phrases! You can generate these using

 * the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.

 *

 * You can change these at any point in time to invalidate all existing cookies.

"wp-config.php" [dos] 96L, 2979C written

#删除nginx网站根目录默认的网页

[root@lnmp html]# rm -rf index.html

#初始化wordpress网站,地址为:http://192.168.80.10

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值