部署lamp
文章目录
lamp简介
lamp平台的概述
-
LAMP架构是目前成熟的企业网站应用模式之一,指的是协同工作的一整台系统和相关软件,能够提供动态web站点服务及其应用开发环境
-
LAMP是一个缩写词,具体包括Linux操作系统,Apache网站服务器,MySQL数据库服务器,PHP(或perl,Python)网页编程语言
搭建lamp平台的顺序
在搭建LAMP平台时,各组件的安装顺序依次为Linux,Apache,MySQL,PHP其中Apache和MySQL的安装并没有严格的顺序要求,而PHP环境的安装一般放到最后,负责沟通web服务器和数据库系统以协同工作
编译安装的优点
- 具有较大的自由度,功能可定制
- 可及时获得最新的软件版本
- 普遍适用于大多数Linux版本,便于一直使用
各组件的主要作用
(平台)Linux:作为LAMP架构的基础,提供用于支撑Web站点的操作系统,能够与其他三个组件提供更好的稳定性,兼容性(AMP组件也支持Windows、UNIX等平台) 。
(前台)Apache:作为LAMP架构的前端,是一款功能强大,稳定性好的Web服务器程序,该服务器直接面向用户提供网站访问,发送网页,图片等文件内容
(后台)MySQL:作为LAMP架构的后端,是一款流行的开源关系数据库系统。在企业网站、业务系统等应用中,各种账户信息、产品信息,客户资料、业务数据等都可以存储到MySQL数据库,其他程序可以通过SQL语句来查询,更改这些信息。
(中间连接)PHP/Perl/Python:作为三种开发动态网页的编程语言,负责解释动态网页文件,负责沟通Web服务器和数据库系统以协同工作,并提供Web应用程序的开发和运行环境。其中PHP是一种被广泛应用的开放源代码的多用途脚本语言,它可以嵌入到HTML中,尤其适合于Web应用开发。
web服务器工作流程
web服务器的资源分为两种,静态资源和动态资源
- 静态资源就是指静态内容,客户端从服务器获得的资源的表现形式与原文件相同。可以简单的理解为就是直接存储于文件系统中的资源
- 动态资源则通常是程序文件,需要在服务器执行之后,将执行的结果返回给客户端
-
①显示的是httpd服务器(即apache)和php服务器通过FastCGI协议进行通信,且php作为独立的服务进程运行
-
②显示的是php程序和mysql数据库间通过mysql协议进行通信。php与mysql本没有什么联系,但是由Php语言写成的程序可以与mysql进行数据交互。同理perl和python写的程序也可以与mysql数据库进行交互
cgi与fastcgi
cgi(Common Gateway Interface,通用网关接口),CGI是外部应用程序(CGI程序)与WEB服务器之间的接口标准,是在CGI程序和Web服务器之间传递信息的过程。CGI规范允许Web服务器执行外部程序,并将它们的输出发送给Web浏览器,CGI将web的一组简单的静态超媒体文档变成一个完整的新的交互式媒体。
fastcgi(Fast Common Gateway Interface)是CGI的改良版,CGI是通过启用一个解释器进程来处理每个请求,耗时且耗资源,而FastCGI则是通过master-worker形式来处理每个请求,即启动一个master主进程,然后根据配置启动几个worker进程,当请求进来时,master会从worker进程中选择一个去处理请求,这样就避免了重复的生成和杀死进程带来的频繁cpu上下文切换而导致耗时
httpd与php结合的方式
httpd与php结合的方式有以下三种:
- modules:php将以httpd的扩展模块形式存在,需要加载动态资源时,httpd可以直接通过php模块来加工资源并返回给客户端
- httpd prefork:libphp5.so(多进程模型的php)
- httpd event or worker:libphp5-zts.so(线程模型的php)
- CGI:httpd需要加载动态资源时,通过CGI与php解释器联系,获得php执行的结果,此时httpd负责与php连接的建立和断开等
- FastCGI:利用php-fpm机制,启动为服务进程,php自行运行为一个服务,https通过socket与php通信
较于CGI方式,FastCGI更为常用,很少有人使用CGI方式来加载动态资源
web工作流程
- 客户端通过http协议请求web服务器资源
- web服务器收到请求后判断客户端请求的资源是静态资源或是动态资源
- 若是静态资源则直接从本地文件系统取之返回给客户端。
- 否则若为动态资源则通过fastcgi协议与php服务器联系,通过CGI程序的master进程调度worker进程来执行程序以获得客户端请求的动态资源,并将执行的结果通过fastcgi协议返回给httpd服务器,httpd服务器收到php的执行结果后将其封装为http响应报文响应给客户端。在执行程序获取动态资源时若需要获得数据库中的资源时,由Php服务器通过mysql协议与MySQL/MariaDB服务器交互,取之而后返回给httpd,httpd将从php服务器收到的执行结果封装成http响应报文响应给客户端。
部署lamp
安装httpd
yum源配置
下载centos源
[root@localhost yum.repos.d]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2495 100 2495 0 0 437 0 0:00:05 0:00:05 --:--:-- 622
运行yum makecache生成缓存
[root@localhost yum.repos.d]# sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
[root@localhost yum.repos.d]# ls
CentOS-Base.repo
安装epel配置包
[root@localhost yum.repos.d]# yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm
Installed:
epel-release-8-16.el8.noarch
Complete!
将 repo 配置中的地址替换为阿里云镜像站地址
[root@localhost yum.repos.d]# sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*
[root@localhost yum.repos.d]# ls
CentOS-Base.repo epel-modular.repo epel-testing-modular.repo epel-testing.repo epel.repo
交换缓存
[root@localhost ~]# dnf makecache
Failed to set locale, defaulting to C.UTF-8
CentOS-8.5.2111 - Base - mirrors.aliyun.com 1.0 MB/s | 4.6 MB 00:04
CentOS-8.5.2111 - Extras - mirrors.aliyun.com 14 kB/s | 10 kB 00:00
CentOS-8.5.2111 - AppStream - mirrors.aliyun.com 1.3 MB/s | 8.4 MB 00:06
Extra Packages for Enterprise Linux 8 - x86_64 936 kB/s | 13 MB 00:13
Extra Packages for Enterprise Linux Modular 8 - x86_64 575 kB/s | 1.0 MB 00:01
Metadata cache created.
创建apache服务的用户和组
[root@localhost ~]# useradd -r -M -s /sbin/nologin apache
安装依赖包
[root@localhost ~]# dnf -y install openssl-devel pcre-devel expat-devel libtool gcc gcc-c++ make vim wget
下载和安装apr和apr-util
[root@localhost ~]# wget https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz https://downloads.apache.org/apr/apr-1.7.0.tar.gz
...........
apr-util-1.6.1.tar.gz 100%[==============================>] 541.31K 115KB/s in 4.7s
--2022-08-02 19:03:36-- https://downloads.apache.org/apr/apr-1.7.0.tar.gz
Reusing existing connection to downloads.apache.org:443.
HTTP request sent, awaiting response... 200 OK
Length: 1093896 (1.0M) [application/x-gzip]
Saving to: 'apr-1.7.0.tar.gz'
apr-1.7.0.tar.gz 100%[==============================>] 1.04M 58.0KB/s in 28s
2022-08-02 19:04:05 (37.6 KB/s) - 'apr-1.7.0.tar.gz' saved [1093896/1093896]
FINISHED --2022-08-02 19:04:05--
Total wall clock time: 34s
Downloaded: 2 files, 1.6M in 33s (48.6 KB/s)
解压和安装
[root@localhost ~]# tar xf apr-1.7.0.tar.gz
[root@localhost ~]# tar xf apr-util-1.6.1.tar.gz
[root@localhost apr-1.7.0]# vim configure
cfgfile="${ofile}T"
trap "$RM \"$cfgfile\"; exit 1" 1 2 15
# $RM "$cfgfile" //将此行加上注释,或者删除此行
[root@localhost apr-1.7.0]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.7.0]# make && make install
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# make && make install
编译安装httpd
[root@localhost httpd-2.4.54]# ./configure --prefix=/usr/local/apache \
> --enable-so \
> --enable-ssl \
> --enable-cgi \
> --enable-rewrite \
> --with-zlib \
> --with-pcre \
> --with-apr=/usr/local/apr \
> --with-apr-util=/usr/local/apr-util/ \
> --enable-modules=most \
> --enable-mpms-shared=all \
> --with-mpm=prefork
[root@localhost httpd-2.4.54]# make && make install
安装后配置
[root@localhost ~]# echo 'export PATH=/usr/local/apache/bin:$PATH' > /etc/profile.d/httpd.sh
[root@localhost ~]# source /etc/profile.d/httpd.sh
[root@localhost ~]# ln -s /usr/local/apache/include/ /usr/include/httpd
[root@localhost ~]# which httpd
/usr/local/apache/bin/httpd
[root@localhost ~]# vim /etc/man_db.conf
MANDATORY_MANPATH /usr/local/apache/man
[root@localhost ~]# cd /usr/lib/systemd/system
[root@localhost system]# cp sshd.service httpd.service
[root@localhost system]# vim httpd.service
[Unit]
Description=web server daemon
Documentation=man:httpd(5)
After=network.target sshd-keygen.target
[Service]
Type=forking
ExecStart=/usr/local/apache/bin/apachectl start
ExecReload=/bin/kill -HUP $MAINPID
ExecStop=/usr/local/apache/bin/apachectl stop
[Install]
WantedBy=multi-user.target
重新加载一下,打开httpd,设置开机自启
[root@localhost ~]# systemctl daemon-reload
[root@localhost ~]# systemctl status httpd
● httpd.service - web server daemon
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:httpd(5)
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
[root@localhost ~]# systemctl enable httpd
Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service.
安装mysql
安装依赖包
[root@localhost ~]# dnf -y install ncurses-devel openssl-devel openssl cmake mariadb-devel
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:40:34 ago on Tue Aug 2 19:30:03 2022.
Package openssl-devel-1:1.1.1k-5.el8_5.x86_64 is already installed.
Package openssl-1:1.1.1k-5.el8_5.x86_64 is already installed.
创建用户和组
[root@localhost ~]# useradd -r -M -s /sbin/nologin mysql
下载二进制格式的mysql软件包
[root@localhost ~]# wget https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
解压软件至/usr/local/
[root@localhost ~]# tar xf mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
改个名字
[root@localhost ~]# cd /usr/local/
[root@localhost local]# ls
apache apr-util etc include lib64 mysql-5.7.38-linux-glibc2.12-x86_64 share
apr bin games lib libexec sbin src
[root@localhost local]# mv mysql-5.7.38-linux-glibc2.12-x86_64 mysql
[root@localhost local]# ls
apache apr apr-util bin etc games include lib lib64 libexec mysql sbin share src
修改目录/usr/local/mysql的属主属组
[root@localhost local]# chown -R mysql.mysql mysql
drwxr-xr-x. 9 mysql mysql 129 Aug 2 20:41 mysql
配置mysql,设置这三个文件
[root@localhost local]# ls /usr/local/mysql/
LICENSE README bin docs include lib man share support-files
[root@localhost local]# ln -s /usr/local/mysql/include /usr/include/mysql
[root@localhost local]# echo '/usr/local/mysql/lib/' > /etc/ld.so.conf.d/mysql.conf
[root@localhost local]# vim /etc/man_db.conf
MANDATORY_MANPATH /usr/local/mysql/man
添加环境变量
[root@localhost ~]# echo 'export PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
[root@localhost ~]# source /etc/profile.d/mysql.sh
[root@localhost ~]# which mysql
/usr/local/mysql/bin/mysql
建立数据存放目录
[root@localhost ~]# mkdir -p /opt/data
[root@localhost ~]# chown -R mysql.mysql /opt/data
初始化数据库
[root@localhost ~]# mysqld --initialize --user mysql --datadir /opt/data
2022-08-02T12:52:44.458805Z 1 [Note] A temporary password is generated for root@localhost: W7okol8U1*wi
生成配置文件
[root@localhost ~]# vim /etc/my.cnf
[mysqld]
basedir = /usr/local/mysql
datadir = /opt/data
socket = /tmp/mysql.sock
port = 3306
pid-file = /opt/data/mysql.pid
user = mysql
skip-name-resolve
配置服务启动脚本
[root@localhost ~]# cd /usr/local/mysql/
[root@localhost mysql]# ls
LICENSE README bin docs include lib man share support-files
[root@localhost mysql]# cd support-files/
[root@localhost support-files]# ls
magic mysql-log-rotate mysql.server mysqld_multi.server
[root@localhost support-files]# file mysql.server
mysql.server: POSIX shell script, ASCII text executable
[root@localhost support-files]# cp mysql.server /etc/init.d/mysqld
[root@localhost support-files]# vim /etc/init.d/mysqld
basedir=/usr/local/mysql
datadir=/opt/data
给它一个可执行的权限
[root@localhost support-files]# chmod +x /etc/init.d/mysqld
启动mysql,查看端口号3306
[root@localhost ~]# service mysqld start
Starting MySQL.Logging to '/opt/data/localhost.localdomain.err'.
SUCCESS!
[root@localhost ~]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 80 *:3306 *:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
设置开机自启
[root@localhost ~]# chkconfig --add mysqld
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
修改一下密码,登录数据库
mysql> set password = password('yyz123!');
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> exit
Bye
[root@localhost ~]# mysql -uroot -pyyz123!
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 3
Server version: 5.7.38 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>
安装php
这个下载php的地址
下载php
[root@localhost ~]# wget https://www.php.net/distributions/php-7.4.30.tar.xz
--2022-08-02 21:19:55-- https://www.php.net/distributions/php-7.4.30.tar.xz
php-7.4.30.tar.xz 100%[==============================>] 9.94M 52.7KB/s in 7m 25s
2022-08-02 21:27:23 (22.9 KB/s) - 'php-7.4.30.tar.xz' saved [10419136/10419136]
查看下载成功
[root@localhost ~]# ls
anaconda-ks.cfg apr-util-1.6.1.tar.gz pass
apr-1.7.0 httpd-2.4.54 php-7.4.30.tar.xz
apr-1.7.0.tar.gz httpd-2.4.54.tar.gz
apr-util-1.6.1 mysql-5.7.38-linux-glibc2.12-x86_64.tar.gz
[root@localhost ~]# sha256sum php-7.4.30.tar.xz
ea72a34f32c67e79ac2da7dfe96177f3c451c3eefae5810ba13312ed398ba70d php-7.4.30.tar.xz
安装依赖包
[root@localhost ~]# dnf list all|grep php|grep mysql
Failed to set locale, defaulting to C.UTF-8
php-mysqlnd.x86_64 7.2.24-1.module_el8.2.0+313+b04d0a66 AppStream
[root@localhost ~]# dnf -y install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libicu-devel libjpeg libjpeg-devel libpng libpng-devel openldap-devel pcre-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel mhash mhash-devel php-mysqlnd
编译安装php
[root@localhost php-7.4.30]# ./configure --prefix=/usr/local/php7 \
> --with-config-file-path=/etc \
> --enable-fpm \
> --enable-inline-optimization \
> --disable-debug \
> --disable-rpath \
> --enable-shared \
> --enable-soap \
> --with-openssl \
> --enable-bcmath \
> --with-iconv \
> --with-bz2 \
> --enable-calendar \
> --with-curl \
> --enable-exif \
> --enable-ftp \
> --enable-gd \
> --with-jpeg \
> --with-zlib-dir \
> --with-freetype \
> --with-gettext \
> --enable-json \
> --enable-mbstring \
> --enable-pdo \
> --with-mysqli=mysqlnd \
> --with-pdo-mysql=mysqlnd \
> --with-readline \
> --enable-shmop \
> --enable-simplexml \
> --enable-sockets \
> --with-zip \
> --enable-mysqlnd-compression-support \
> --with-pear \
> --enable-pcntl \
> --enable-posix
+--------------------------------------------------------------------+
| License: |
| This software is subject to the PHP License, available in this |
| distribution in the file LICENSE. By continuing this installation |
| process, you are bound by the terms of this license agreement. |
| If you do not agree with the terms of this license, you must abort |
| the installation process at this point. |
+--------------------------------------------------------------------+
Thank you for using PHP.
[root@localhost php-7.4.30]# make && make install
安装后配置
[root@localhost ~]# echo 'export PATH=/usr/local/php7/bin:$PATH' > /etc/profile.d/php7.sh
[root@localhost ~]# source /etc/profile.d/php7.sh
[root@localhost ~]# which php
/usr/local/php7/bin/php
[root@localhost ~]# php -v
PHP 7.4.30 (cli) (built: Aug 2 2022 22:17:56) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
配置php-fpm
[root@localhost php-7.4.30]# cp php.ini-production /etc/php.ini
cp: overwrite '/etc/php.ini'? y
[root@localhost fpm]# file init.d.php-fpm
init.d.php-fpm: POSIX shell script, ASCII text executable
[root@localhost fpm]# cp init.d.php-fpm /etc/init.d/php-fpm
[root@localhost fpm]# chmod +x /etc/init.d/php-fpm
[root@localhost ~]# cd /usr/local/php7/
[root@localhost php7]# ls
bin etc include lib php sbin var
[root@localhost php7]# cd etc/
[root@localhost etc]# ls
pear.conf php-fpm.conf.default php-fpm.d
[root@localhost etc]# cp php-fpm.conf.default php-fpm.conf
[root@localhost etc]# ls
pear.conf php-fpm.conf php-fpm.conf.default php-fpm.d
[root@localhost etc]# cd php-fpm.d/
[root@localhost php-fpm.d]# ls
www.conf.default
[root@localhost php-fpm.d]# cp www.conf.default www.conf
[root@localhost php-fpm.d]# ls
www.conf www.conf.default
启动php-fpm,查看端口号9000,然后设置开机自启
[root@localhost php-fpm.d]# service php-fpm start
Starting php-fpm done
[root@localhost php-fpm.d]# ss -anlt
State Recv-Q Send-Q Local Address:Port Peer Address:Port Process
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 127.0.0.1:9000 0.0.0.0:*
LISTEN 0 128 *:80 *:*
LISTEN 0 128 [::]:22 [::]:*
LISTEN 0 80 *:3306 *:*
[root@localhost ~]# chkconfig --add php-fpm
[root@localhost ~]# chkconfig --list
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
php-fpm 0:off 1:off 2:on 3:on 4:on 5:on 6:off
错误解决
删除里面的mariadb软件包
[root@localhost ~]# rpm -qa|grep mariadb
mariadb-connector-c-config-3.1.11-2.el8_3.noarch
mariadb-connector-c-3.1.11-2.el8_3.x86_64
mariadb-connector-c-devel-3.1.11-2.el8_3.x86_64
mariadb-devel-10.3.28-1.module_el8.3.0+757+d382997d.x86_64
[root@localhost ~]# yum -y remove mariadb*
Failed to set locale, defaulting to C.UTF-8
Dependencies resolved.
[root@localhost ~]# rpm -qa|grep mariadb
登录mysql,登录不了,需要安装这个libncurses.so.5包
[root@localhost ~]# mysql -uroot -p'W7okol8U1*wi'
mysql: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory
[root@localhost ~]# dnf provides libncurses.so.5
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 1:40:02 ago on Tue Aug 2 19:30:03 2022.
ncurses-compat-libs-6.1-9.20180224.el8.i686 : Ncurses compatibility libraries
Repo : base
Matched from:
Provide : libncurses.so.5
[root@localhost ~]# dnf -y install ncurses-compat-libs
Installed:
ncurses-compat-libs-6.1-9.20180224.el8.x86_64
Complete!
Package 'libxml-2.0', required by 'virtual:world', not found 这样的错误都可以执行yum search libxml2-devel如果有,就是直接安装
[root@localhost ~]# yum search libxml2-devel
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:14:07 ago on Tue Aug 2 19:30:03 2022.
============================= Name Exactly Matched: libxml2-devel =============================
libxml2-devel.i686 : Libraries, includes, etc. to develop XML and HTML applications
libxml2-devel.x86_64 : Libraries, includes, etc. to develop XML and HTML applications
[root@localhost ~]# yum install libxml2-devel -y
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:15:54 ago on Tue Aug 2 19:30:03 2022.
Dependencies resolved.
Installed:
libxml2-devel-2.9.7-9.el8_4.2.x86_64 xz-devel-5.2.4-3.el8.x86_64
Complete!
Package 'sqlite3', required by 'virtual:world', not found
这个报错,需要安装
[root@localhost ~]# dnf list all|grep sqlite3
Failed to set locale, defaulting to C.UTF-8
libsqlite3x.x86_64 20071018-26.el8 epel
libsqlite3x-devel.x86_64 20071018-26.el8 epel
preludedb-sqlite3.x86_64 5.2.0-1.el8
...........
[root@localhost ~]# dnf -y install libsqlite3x-devel
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:18:51 ago on Tue Aug 2 19:30:03 2022.
Dependencies resolved.
Installed:
libsqlite3x-20071018-26.el8.x86_64 libsqlite3x-devel-20071018-26.el8.x86_64
sqlite-3.26.0-15.el8.x86_64 sqlite-devel-3.26.0-15.el8.x86_64
Complete!
网址:https://pkgs.org/
Package 'oniguruma', required by 'virtual:world', not found
这个报错需要安装oniguruma-devel
[root@localhost ~]# dnf -y install http://mirror.centos.org/centos/8-stream/PowerTools/x86_64/os/Packages/oniguruma-devel-6.8.2-2.el8.x86_64.rpm
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:23:58 ago on Tue Aug 2 19:30:03 2022.
Installed:
oniguruma-6.8.2-2.el8.x86_64 oniguruma-devel-6.8.2-2.el8.x86_64
Complete!
这些选项需要修改
configure: WARNING: unrecognized options: --with-gd, --with-jpeg-dir, --with-png-dir, --with-freetype-dir, --enable-zip
[root@localhost php-7.4.30]# ./configure --help|grep gd
--with-gdbm[=DIR] DBA: GDBM support
--enable-gd Include GD support
--with-external-gd Use external libgd
--with-webp GD: Enable WEBP support (only for bundled libgd)
--with-jpeg GD: Enable JPEG support (only for bundled libgd)
--with-xpm GD: Enable XPM support (only for bundled libgd)
libgd)
--enable-gd-jis-conv GD: Enable JIS-mapped Japanese font support (only
for bundled libgd)
[root@localhost php-7.4.30]# ./configure --help|grep jpeg
--with-jpeg GD: Enable JPEG support (only for bundled libgd)
[root@localhost php-7.4.30]# ./configure --help|grep freetype
--with-freetype GD: Enable FreeType 2 support (only for bundled
[root@localhost php-7.4.30]# ./configure --help|grep zip
--with-zip Include Zip read/write support
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
Package 'libzip', required by 'virtual:world', not found
缺libzip这个包,安装这个包
[root@localhost php-7.4.30]# dnf list all|grep zip|grep lib
Failed to set locale, defaulting to C.UTF-8
bzip2-libs.x86_64 1.0.6-26.el8 @anaconda
bzip2-libs.i686 1.0.6-26.el8 base
libzip.x86_64 1.5.1-2.module_el8.2.0+313+b04d0a66 AppStream
libzip-devel.x86_64 1.5.1-2.module_el8.2.0+313+b0
..........
[root@localhost ~]# dnf -y install libzip-devel
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 2:35:07 ago on Tue Aug 2 19:30:03 2022.
Dependencies resolved.
Installed:
libzip-1.5.1-2.module_el8.2.0+313+b04d0a66.x86_64
libzip-devel-1.5.1-2.module_el8.2.0+313+b04d0a66.x86_64
Complete!