48小时系统班试听入口

Centos7-1分钟快速yum安装php7.4或其他版本

发布作者:新盟教育 发布日期:2023-01-10 浏览人数:1092人

Linux运维技术

资源放送 

Centos7yum安装php7.4讲解

↓ 扫一扫 视频在线观看↓

Linux运维资料.png


以php7.4为例,其他版本自行替换"php74"。

#创建epel源:

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo


#再创建两个repo:

cat >/etc/yum.repos.d/remi-php74.repo<< EOF
[remi-php74]
name=php74 for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/php74/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
EOF


cat >/etc/yum.repos.d/remi-safe.repo<< EOF
[remi-safe]
name=remi-safe for Enterprise Linux 7 - $basearch
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/safe/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
EOF


#检查一下:

[root@test11 ~]# ls /etc/yum.repos.d/
CentOS-Base.repo       CentOS-Media.repo          epel.repo          remi-safe.repo
CentOS-CR.repo         CentOS-Sources.repo        epel.repo.rpmnew
CentOS-Debuginfo.repo  CentOS-Vault.repo          epel-testing.repo
CentOS-fasttrack.repo  CentOS-x86_64-kernel.repo  remi-php74.repo
[root@test11 ~]# cat /etc/yum.repos.d/remi-php74.repo 
[remi-php74]
name=php74 for Enterprise Linux 7 - 
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/php74/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0
[root@test11 ~]# cat /etc/yum.repos.d/remi-safe.repo 
[remi-safe]
name=remi-safe for Enterprise Linux 7 - 
baseurl=https://mirrors.tuna.tsinghua.edu.cn/remi/enterprise/7/safe/x86_64/
failovermethod=priority
enabled=1
gpgcheck=0


#yum makecache。#否则可能会从官方源安装php5.4。

[root@test11 ~]# yum makecache 
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirrors.aliyun.com
 * 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     
remi-php74                                                                         | 3.0 kB  00:00:00     
remi-safe                                                                          | 3.0 kB  00:00:00     
updates                                                                            | 2.9 kB  00:00:00     
(1/15): epel/x86_64/group_gz                                                       |  95 kB  00:00:00     
(2/15): epel/x86_64/updateinfo                                                     | 1.0 MB  00:00:00     
(3/15): epel/x86_64/prestodelta                                                    | 2.6 kB  00:00:00     
(4/15): epel/x86_64/filelists_db                                                   |  12 MB  00:00:07     
(5/15): remi-php74/primary_db                                                      | 228 kB  00:00:00     
(6/15): remi-php74/filelists_db                                                    | 134 kB  00:00:00     
(7/15): remi-php74/other_db                                                        |  45 kB  00:00:00     
(8/15): epel/x86_64/primary_db                                                     | 6.9 MB  00:00:07     
(9/15): epel/x86_64/other_db                                                       | 3.3 MB  00:00:01     
(10/15): remi-safe/filelists_db                                                    | 1.5 MB  00:00:00     
(11/15): remi-safe/other_db                                                        | 497 kB  00:00:00     
(12/15): remi-safe/primary_db                                                      | 1.9 MB  00:00:01     
(13/15): updates/7/x86_64/filelists_db                                             | 2.8 MB  00:00:00     
(14/15): updates/7/x86_64/other_db                                                 | 353 kB  00:00:00     
(15/15): updates/7/x86_64/primary_db                                               | 4.7 MB  00:00:01     
元数据缓存已建立


#yum安装php和其他组件,php后不需要再加数字,直接是7.4版本:

yum install php php-fpm php-mysqlnd php-devel php-gd php-mbstring php-pecl-mcrypt php-xml php-opcache php-pecl-memcached -y


总计:4.4 MB/s |  71 MB  00:00:16


[root@test11 ~]# php -v
PHP 7.4.14 (cli) (built: Jan  5 2021 10:45:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies




1671585dc74035d34ac554d5f2ae42fc.jpg


推荐阅读

>>>新手必备-Linux入门之云计算是什么

>>>红帽认证入门-Linux系统介绍及企业版本选型

>>>新手必备-Linux系统安装配置+Xshell远程连接

>>>Linux常用命令行合集之绝对路径和相对路径

>>>软连接与硬连接

客服电话 15822722968 邮箱 799830458@qq.com 地址 天津市红桥区光荣道157号宝能创业中心2号楼-1、2门-907号
官方公众号
商务合作