更新

更新

为一个项目创建了一个新的 VM 服务器,它运行的是 Centos 7.5。在阅读了大量不同的在线文章并尝试在此机器上运行 nginx 和 PHP 7.2 后,我无法获取正确版本的 PHP 或 PHP-FPM 模块进行安装。

我运行了以下命令:

yum install php php-common php-opcache php-mcrypt php-cli php-gd php-curl php-mysql php-fpm

结果如下

Dependencies Resolved

Package                Arch     Version                 Repository        Size

Installing:
  php                    x86_64   5.4.16-45.el7           centos           1.4 M
  php-cli                x86_64   5.4.16-45.el7           centos           2.7 M
  php-common             x86_64   5.4.16-45.el7           centos           565 k
  php-fpm                x86_64   5.4.16-45.el7           centos           1.4 M
  php-gd                 x86_64   5.4.16-45.el7           centos           128 k
  php-mcrypt             x86_64   5.4.16-7.el7            epel_mirror       20 k
  php-mysql              x86_64   5.4.16-45.el7           centos           101 k
  php-pecl-zendopcache   x86_64   7.0.5-2.el7             epel_mirror       74 k
Installing for dependencies:
  httpd                  x86_64   2.4.6-80.el7.centos.1   centos-updates   2.7 M
  httpd-tools            x86_64   2.4.6-80.el7.centos.1   centos-updates    90 k
  libmcrypt              x86_64   2.5.8-13.el7            epel_mirror       99 k
  libzip                 x86_64   0.10.1-8.el7            centos            48 k
  php-pdo                x86_64   5.4.16-45.el7           centos            99 k
  php-pear               noarch   1:1.9.4-21.el7          centos           357 k
  php-process            x86_64   5.4.16-45.el7           centos            56 k
  php-xml                x86_64   5.4.16-45.el7           centos           126 k
  t1lib                  x86_64   5.1.2-14.el7            centos           166 k

我真的很难理解为什么这不起作用 - 任何帮助都值得感激。

如果需要更多信息,请直接询问:)t2t

更新

我尝试关注的最新文章是:https://www.if-not-true-then-false.com/2011/install-nginx-php-fpm-on-fedora-centos-red-hat-rhel/

在那里执行安装命令:

yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common

结果(截断以显示 PHP 版本):

php-common     x86_64        5.4.16-45.el7       centos                               565 k
php-fpm        x86_64        5.4.16-45.el7       centos                               1.4 M

完整信息

正如以下评论所要求的...

$ sudo -i
[sudo] password for youngm: 
# rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-rele ase-latest-7.noarch.rpm
Retrieving https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
Preparing... 
    package epel-release-7-11.noarch is already installed
# 
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
Preparing... 
    package remi-release-7.5-2.el7.remi.noarch is already installed
# yum --enablerepo=remi,remi-php72 install nginx php-fpm php-common
Loaded plugins: fastestmirror, priorities
Loading mirror speeds from cached hostfile

centos                                                                                                                                                                                                                | 2.1 kB  00:00:00     

epel_mirror                                                                                                                                                                                                           | 2.1 kB  00:00:00     
639 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package nginx.x86_64 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-filesystem = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-all-modules = 1:1.12.2-2.el7 for package: 1:nginx-1.12.2-2.el7.x86_64
--> Processing Dependency: nginx-filesystem for package: 1:nginx-1.12.2-2.el7.x86_64
---> Package php-common.x86_64 0:5.4.16-45.el7 will be installed
--> Processing Dependency: libzip.so.2()(64bit) for package: php-common-5.4.16-45.el7.x86_64
---> Package php-fpm.x86_64 0:5.4.16-45.el7 will be installed
--> Running transaction check
---> Package libzip.x86_64 0:0.10.1-8.el7 will be installed
---> Package nginx-all-modules.noarch 1:1.12.2-2.el7 will be installed
--> Processing Dependency: nginx-mod-stream = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-mail = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-xslt-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-perl = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-image-filter = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
--> Processing Dependency: nginx-mod-http-geoip = 1:1.12.2-2.el7 for package: 1:nginx-all-modules-1.12.2-2.el7.noarch
---> Package nginx-filesystem.noarch 1:1.12.2-2.el7 will be installed
--> Running transaction check
---> Package nginx-mod-http-geoip.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-image-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-perl.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-http-xslt-filter.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-mail.x86_64 1:1.12.2-2.el7 will be installed
---> Package nginx-mod-stream.x86_64 1:1.12.2-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================================================================
 Package                                                               Arch                                             Version                                                  Repository                                             Size
=============================================================================================================================================================================================================================================
Installing:
 nginx                                                                 x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                           530 k
 php-common                                                            x86_64                                           5.4.16-45.el7                                            centos                                                565 k
 php-fpm                                                               x86_64                                           5.4.16-45.el7                                            centos                                                1.4 M
Installing for dependencies:
 libzip                                                                x86_64                                           0.10.1-8.el7                                             centos                                                 48 k
 nginx-all-modules                                                     noarch                                           1:1.12.2-2.el7                                           epel_mirror                                            16 k
 nginx-filesystem                                                      noarch                                           1:1.12.2-2.el7                                           epel_mirror                                            17 k
 nginx-mod-http-geoip                                                  x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            23 k
 nginx-mod-http-image-filter                                           x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            26 k
 nginx-mod-http-perl                                                   x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            36 k
 nginx-mod-http-xslt-filter                                            x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            26 k
 nginx-mod-mail                                                        x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            54 k
 nginx-mod-stream                                                      x86_64                                           1:1.12.2-2.el7                                           epel_mirror                                            76 k

Transaction Summary
=============================================================================================================================================================================================================================================
Install  3 Packages (+9 Dependent packages)

Total download size: 2.8 M
Installed size: 10 M
Is this ok [y/d/N]: n
Exiting on user command
Your transaction was saved, rerun it with:
 yum load-transaction /tmp/yum_save_tx.2018-11-13.14-37.LmQUgX.yumtx
# 

答案1

这是您的问题:

639 packages excluded due to repository priority protections

/etc/yum.conf您或其他人通过在目录中的各个 repo 文件中设置优先级,明确排除了在您的系统上安装的软件包/etc/yum.repos.d

检查所有这些文件中是否有“priority=###其中###是数字”的行,并删除找到的所有行。然后尝试再次安装软件包。

为了确保这种情况不再发生,您还应该使用类似以下命令删除有问题的 yum 插件yum remove yum-plugin-priorities

相关内容