杰瑞

V1

2022/12/17阅读:47主题:自定义主题1

未完待续的一次部署

准备

LAMP 环境是指 Linux 系统下,由 Apache + MariaDB + PHP 及其它相关辅助组件组成的网站服务器架构。

本次搭建 LAMP 环境,在腾讯云服务器上进行,

配置为标准型SA2/2核/2GB/1Mbps,

系统为CentOS 8.2 64位,

公网IP为118.195.221.183

登录云服务器后,界面如图所示。

安装 Apache

输入下列字符串,点击回车键,服务器即可快速安装 Apache 框架

yum install httpd -y

安装结果显示如下:

Last metadata expiration check: 0:03:55 ago on Sat 17 Dec 2022 06:35:43 PM CST.
Dependencies resolved.
=====================================================================================================================================================
 Package                            Architecture           Version                                                   Repository                 Size
=====================================================================================================================================================
Installing:
 httpd                              x86_64                 2.4.37-43.module_el8.5.0+1022+b541f3b1                    AppStream                 1.4 M
Installing dependencies:
 apr                                x86_64                 1.6.3-12.el8                                              AppStream                 129 k
 apr-util                           x86_64                 1.6.1-6.el8                                               AppStream                 105 k
 centos-logos-httpd                 noarch                 85.8-2.el8                                                BaseOS                     75 k
 httpd-filesystem                   noarch                 2.4.37-43.module_el8.5.0+1022+b541f3b1                    AppStream                  39 k
 httpd-tools                        x86_64                 2.4.37-43.module_el8.5.0+1022+b541f3b1                    AppStream                 107 k
 mod_http2                          x86_64                 1.15.7-3.module_el8.4.0+778+c970deab                      AppStream                 154 k
Installing weak dependencies:
 apr-util-bdb                       x86_64                 1.6.1-6.el8                                               AppStream                  25 k
 apr-util-openssl                   x86_64                 1.6.1-6.el8                                               AppStream                  27 k
Enabling module streams:
 httpd                                                     2.4                                                                                      

Transaction Summary
=====================================================================================================================================================
Install  9 Packages

Total download size: 2.1 M
Installed size: 5.6 M
Downloading Packages:
(1/9): apr-util-bdb-1.6.1-6.el8.x86_64.rpm                                                                           227 kB/s |  25 kB     00:00    
(2/9): apr-util-1.6.1-6.el8.x86_64.rpm                                                                               611 kB/s | 105 kB     00:00    
(3/9): apr-1.6.3-12.el8.x86_64.rpm                                                                                   637 kB/s | 129 kB     00:00    
(4/9): apr-util-openssl-1.6.1-6.el8.x86_64.rpm                                                                       282 kB/s |  27 kB     00:00    
(5/9): httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch.rpm                                            313 kB/s |  39 kB     00:00    
(6/9): httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64.rpm                                                 636 kB/s | 107 kB     00:00    
(7/9): centos-logos-httpd-85.8-2.el8.noarch.rpm                                                                      486 kB/s |  75 kB     00:00    
(8/9): mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64.rpm                                                     625 kB/s | 154 kB     00:00    
(9/9): httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64.rpm                                                       2.8 MB/s | 1.4 MB     00:00    
-----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                3.0 MB/s | 2.1 MB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                             1/1 
  Installing       : apr-1.6.3-12.el8.x86_64                                                                                                     1/9 
  Running scriptlet: apr-1.6.3-12.el8.x86_64                                                                                                     1/9 
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                             2/9 
  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                         3/9 
  Installing       : apr-util-1.6.1-6.el8.x86_64                                                                                                 4/9 
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64                                                                                                 4/9 
  Installing       : httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                                                   5/9 
  Installing       : centos-logos-httpd-85.8-2.el8.noarch                                                                                        6/9 
  Running scriptlet: httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                                                              7/9 
  Installing       : httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                                                              7/9 
  Installing       : mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64                                                                       8/9 
  Installing       : httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                                                         9/9 
  Running scriptlet: httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                                                         9/9 
  Verifying        : apr-1.6.3-12.el8.x86_64                                                                                                     1/9 
  Verifying        : apr-util-1.6.1-6.el8.x86_64                                                                                                 2/9 
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                             3/9 
  Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                         4/9 
  Verifying        : httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                                                         5/9 
  Verifying        : httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch                                                              6/9 
  Verifying        : httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                                                                   7/9 
  Verifying        : mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64                                                                       8/9 
  Verifying        : centos-logos-httpd-85.8-2.el8.noarch                                                                                        9/9 

Installed:
  apr-1.6.3-12.el8.x86_64                                                     apr-util-1.6.1-6.el8.x86_64                                           
  apr-util-bdb-1.6.1-6.el8.x86_64                                             apr-util-openssl-1.6.1-6.el8.x86_64                                   
  centos-logos-httpd-85.8-2.el8.noarch                                        httpd-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64                   
  httpd-filesystem-2.4.37-43.module_el8.5.0+1022+b541f3b1.noarch              httpd-tools-2.4.37-43.module_el8.5.0+1022+b541f3b1.x86_64             
  mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64                      

Complete!

安装完毕后,要启动 Apache,输入下列代码:

systemctl start httpd

再将 Apache设为开启启动,输入下列代码:

systemctl enable httpd

接着,我们检查一下 Apache能否正常启动,打开主机上的浏览器,输入本服务器的公网IP,界面显示如下:

If you can read this page it means that this site is working properly.

能够看到该页面说明 Apache配置成功了。

安装 MariaDB

首先,输入以下命令,查看系统中是否已安装 MariaDB,避免重复安装,或安装版本不同造成冲突

rpm -qa | grep -i mariadb

返回结果为空,说明本服务器尚未安装。

接下来,输入下列代码,创建一个custom MariaDB YUM repository entry 文件

vi /etc/yum.repos.d/MariaDB.repo

结果显示如下

"/etc/yum.repos.d/MariaDB.repo" [New File]

接着打开

https://mariadb.org/download/?t=repo-config&d=CentOS+8+%28x86_64%29&v=10.8&r_m=aliyun

下面两个空格或许可以随意选择,第一个空格的信息无法从云服务器表面介绍中获悉情况,

返回云服务器操作界面,输入

uname -a

浮现

Linux VM-0-4-centos 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

则可以确定第一个空格的信息选项为CentOS8 x86_64

第二个空格选择最新的版本;

第三个空格随意挑选了阿里云的镜像。

再点击下方生成的代码框右上角的复制按钮(红圈内),

接着返回到云服务器的操作界面,输入:

vi /etc/yum.repos.d/MariaDB.repo

则进入新的编辑界面,将上面复制的代码粘贴进去,如下图

再摁** Esc** 键,退出编辑模式,进入命令模式,输入:wp,摁回车键,出现如下图显示的情况。

摁回车键后,返回命令行界面,键入

yum -y install MariaDB-client MariaDB-server

此时浮现提示:

Warning: failed loading '/etc/yum.repos.d/MariaDB.repo', skipping.
Last metadata expiration check: 1:23:36 ago on Sat 17 Dec 2022 10:24:02 PM CST.
No match for argument: MariaDB-client
No match for argument: MariaDB-server
  * Maybe you meant: mariadb-server
Error: Unable to find a match: MariaDB-client MariaDB-server

然后我就不知道怎么搞了。

分类:

后端

标签:

运维部署

作者介绍

杰瑞
V1