解决Centos7无法通过yum update更新PHP7.4.x小版本的问题(同理可以解决其他软件无法通过yum update更新软件的问题)

由于不是时常关心几日前才发现PHP7.4已经出到7.4.1了,但是苦于当时身边没有密钥无法升级。

今天终于可以接触到密钥连接上SSH了,可是却发现yum update不能如同使用7.3.x时一样更新各种小版本了。此刻我都怀疑是不是我之前安装到PHP7.4的姿势不正确时找到了解决办法。

说来惭愧由于对Linux的知识仅限于皮毛,在此之前都以为只要把.repo文件对应的目录就可以了,因为在安装MariaDB时都是这样添加就可以且安装新的PHP版本也只要指定对应版本。可是没想到在这是想更新下小版本时却老是不能更新了。

根据这次的问题我都怀疑之前PHP 7.4.0RC4一直不能yum update的原因可能和本次是一样的。在这次不能更新时我又又怀疑了remi源,不过这次立刻就去源的网站看到了在当日就同步更新了,遂怀疑是vestaCP的问题。。。。。。(最好才发现是自己的问题。。。。。。)

本来准备放弃的了,但是功夫不负有心人无意间在remi的页面找到了解决办法

(如果提示yum-config-manager: command not found需要通过安装yum -y install yum-utils

yum-config-manager --enable remi-php74
yum update

yum-config-manager --enable remi-php74

Loaded plugins: fastestmirror
=============================== repo: remi-php74 ===============================
[remi-php74]
async = True
bandwidth = 0
base_persistdir = /var/lib/yum/repos/x86_64/7
baseurl =
cache = 0
cachedir = /var/cache/yum/x86_64/7/remi-php74
check_config_file_age = True
compare_providers_priority = 80
cost = 1000
deltarpm_metadata_percentage = 100
deltarpm_percentage =
enabled = 1
enablegroups = True
exclude =
failovermethod = priority
ftp_disable_epsv = False
gpgcadir = /var/lib/yum/repos/x86_64/7/remi-php74/gpgcadir
gpgcakey =
gpgcheck = True
gpgdir = /var/lib/yum/repos/x86_64/7/remi-php74/gpgdir
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi
hdrdir = /var/cache/yum/x86_64/7/remi-php74/headers
http_caching = all
includepkgs =
ip_resolve =
keepalive = True
keepcache = False
mddownloadpolicy = sqlite
mdpolicy = group:small
mediaid =
metadata_expire = 21600
metadata_expire_filter = read-only:present
metalink =
minrate = 0
mirrorlist = http://cdn.remirepo.net/enterprise/7/php74/mirror
mirrorlist_expire = 86400
name = Remi's PHP 7.4 RPM repository for Enterprise Linux 7 - x86_64
old_base_cache_dir =
password =
persistdir = /var/lib/yum/repos/x86_64/7/remi-php74
pkgdir = /var/cache/yum/x86_64/7/remi-php74/packages
proxy = False
proxy_dict =
proxy_password =
proxy_username =
repo_gpgcheck = False
retries = 10
skip_if_unavailable = False
ssl_check_cert_permissions = True
sslcacert =
sslclientcert =
sslclientkey =
sslverify = True
throttle = 0
timeout = 30.0
ui_id = remi-php74
ui_repoid_vars = releasever,
   basearch
username =

然后再yum update终于看到了希望的PHP7.4.1。

通过此次操作,我又学习到了一个命令,于是我通过yum repolist查看列表并且使用yum-config-manager --disable “仓库名"将旧的PHP版本的仓库给禁用就不需要像以前一样删除文件还导致yum update时报一些错误了。

在没有启用前可以看到remi-php74没有在列表里面,启用后可以发现出现了相关仓库了。
启用前:

repo id                     repo name                                     status
base/7/x86_64               CentOS-7                                      10,097
epel/x86_64                 Extra Packages for Enterprise Linux 7 - x86_6 13,509
extras/7/x86_64             CentOS-7                                         307
mariadb                     MariaDB                                           94
nginx/x86_64                nginx repo                                       170
remi                        Remi's RPM repository for Enterprise Linux 7   5,991
remi-debuginfo/x86_64       Remi's RPM repository for Enterprise Linux 7   2,766
remi-php55                  Remi's PHP 5.5 RPM repository for Enterprise     435
remi-php55-debuginfo/x86_64 Remi's PHP 5.5 RPM repository for Enterprise     310
remi-php56                  Remi's PHP 5.6 RPM repository for Enterprise     440
remi-php56-debuginfo/x86_64 Remi's PHP 5.6 RPM repository for Enterprise     313
remi-safe                   Safe Remi's RPM repository for Enterprise Lin  3,669
remi-test                   Remi's test RPM repository for Enterprise Lin  1,450
remi-test-debuginfo/x86_64  Remi's test RPM repository for Enterprise Lin    647
updates/7/x86_64            CentOS-7                                       1,012
vesta/x86_64                Vesta - cmmnt                                     32
repolist: 41,242

启用后:

repo id                    repo name                                      status
base/7/x86_64              CentOS-7                                       10,097
epel/x86_64                Extra Packages for Enterprise Linux 7 - x86_64 13,509
extras/7/x86_64            CentOS-7                                          307
mariadb                    MariaDB                                            94
nginx/x86_64               nginx repo                                        170
remi                       Remi's RPM repository for Enterprise Linux 7 -  5,991
remi-debuginfo/x86_64      Remi's RPM repository for Enterprise Linux 7 -  2,766
remi-php74                 Remi's PHP 7.4 RPM repository for Enterprise L    300
remi-safe                  Safe Remi's RPM repository for Enterprise Linu  3,669
remi-test                  Remi's test RPM repository for Enterprise Linu  1,450
remi-test-debuginfo/x86_64 Remi's test RPM repository for Enterprise Linu    647
updates/7/x86_64           CentOS-7                                        1,012
vesta/x86_64               Vesta - cmmnt                                      32
repolist: 40,044

现在我在由于要不要启用remi-php74-debuginfo/x86_64(虽然我目前不知道有没有这个仓库的说)

参考:
PHP version 7.2.26, 7.3.13 and 7.4.1 :
https://blog.remirepo.net/post/2019/12/18/PHP-version-7.2.26-7.3.13-and-7.4.1
yum仓库详细解读:
https://www.cnblogs.com/aubin/p/7289207.html

ChiuYut

2020年1月16日

发布者

ChiuYut

咦!我是谁?这是什么地方?

发表评论

电子邮件地址不会被公开。 必填项已用*标注

CAPTCHAis initialing...