当存在较新版本的依赖软件时覆盖 yum 依赖关系检查

发布于 2024-07-15 11:05:43 字数 397 浏览 10 评论 0原文

我在 CentOS 5.1 上使用 yum - 我从源代码手动编译了 PHP 5.2.8,但使用 yum 安装了其他软件包。 我需要通过 pecl 安装 PHP 扩展,并且还需要安装 phpize。 但是,执行以下操作会产生依赖性错误:

sudo yum 安装 php-devel

错误:缺少依赖项:php-devel 包需要 php = 5.1.6-20.el5_2.1

因为我实际上已经安装了较新版本的 PHP,所以如何强制 yum 忽略它? 我需要从源代码手动编译 pecl/phpize 吗? 诚然,我以前从未遇到过问题,这似乎只是因为编译和 yum 安装的组合所致。

有什么想法吗?

谢谢, 凯尔

I'm using yum on CentOS 5.1 - I hand-compiled PHP 5.2.8 from source, but have other packages installed using yum. I need to install a PHP extension via pecl, and it requires phpize to be installed as well. However, doing the following yields a dependency error:

sudo yum install php-devel

Error: Missing Dependency: php = 5.1.6-20.el5_2.1 is needed by package php-devel

Since I actually have a newer version of PHP already installed, how can I force yum to ignore this? Do I need to hand-compile pecl/phpize from source? I admittedly never had a problem before, it only seems to be because of a combo of compiles and yum installs.

Any thoughts?

Thanks,
Kyle

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

染墨丶若流云 2024-07-22 11:05:43

一般来说:

如果您自己构建它,它会进入 /usr/local 中,并且只能被 /usr/local 中的其他内容访问。

如果您从 RPM/Yum 安装,它将进入 /usr,并且可由 /usr/usr/local 访问。

因此,如果您想使用家庭编译的 PHP 安装 PHP 工具,请将它们也安装到 /usr/local 中:通常,对于 GNU 类型的软件,这会是这样的:

   ./configure --prefix=/usr/local && make && sudo make install

   make prefix=/usr/local all && sudo make prefix=/usr/local install

...尽管大多数软件应默认为/usr/local,除非您覆盖其前缀设置。

如果您想“手动构建”基于 RPM 的软件包,您可以使用

   yumdownloader --source WHATEVER-PACKAGE
   rpm -i WHATEVER-PACKAGE.rpm
   rpmbuild -bp ~/rpm/SPECS/WHATEVER-PACKAGE.spec

(相当于 ~/rpm 的路径可能会有所不同;rpmbuild --showrc 会告诉您你在哪里)

这会下载 .src.rpm 包,其中包含上游(原作者)源代码(通常是 tarball)以及特定于操作系统的补丁; 将源安装到 ~/rpm (或您的 rpmbuild 前缀); 然后解压源代码并将补丁应用到 ~/rpm/BUILD/WHATEVER-PACKAGE/

从那里,您可以使用 /usr/local< /code> prefix

当然,从 RPM 安装要容易得多:-)

In general:

If you build it yourself, it goes into /usr/local, and is only accessible to other things in /usr/local.

If you install from RPM/Yum, it goes into /usr, and is accessible to /usr and /usr/local.

So, if you want to install PHP tools using home-compiled PHP, install them into /usr/local as well: typically, with GNU-type software, that'd be something like:

   ./configure --prefix=/usr/local && make && sudo make install

or

   make prefix=/usr/local all && sudo make prefix=/usr/local install

…although most software should default to /usr/local unless you override its prefix setting.

If you want to “hand-build” packages that are based upon RPM's, you can use

   yumdownloader --source WHATEVER-PACKAGE
   rpm -i WHATEVER-PACKAGE.rpm
   rpmbuild -bp ~/rpm/SPECS/WHATEVER-PACKAGE.spec

(your path equivalent to ~/rpm may vary; rpmbuild --showrc will tell you where)

This downloads the .src.rpm package, which contains the upstream (original author's) source (usually a tarball) as well as OS-specific patches; installs the sources into ~/rpm (or your rpmbuild prefix); and then unpacks the sources and applies the patches into ~/rpm/BUILD/WHATEVER-PACKAGE/

From there, you can do the configure/make steps yourself, with the /usr/local prefix

Of course, just installing from RPM's is far easier :-)

独夜无伴 2024-07-22 11:05:43

yum 不知道您手工编译的 php 版本。 您可以通过使用 rpm --nodeps 安装软件包来绕过 RPM 的依赖关系解析,并希望它能正常工作。

或者将你自己编译的php版本安装在另一个目录中,这样它就可以与yum的旧版本共存,这样每个人都很高兴(不确定这是否可能,我想这取决于你的应用程序是否使用硬编码的php路径) 。

或者,如果您幸运的话,可以使用第三方存储库,例如 EPELRPMForge 可能有更新的 php 包,因此您不必编译自己的包。

yum doesn't know anything about your hand-compiled php version. You can either bypass RPM's dependency resolution by installing the package using rpm --nodeps and hope it works.

Or install the php version you compiled yourself in another directory so it can coexist with the old version from yum, so everyone is happy (not sure if that's possible, I guess it depends on whether your apps use a hardcoded path to php or not).

Or, if you are lucky, a third-party repository like EPEL or RPMForge might have a newer php package, so you don't have to compile your own.

最好是你 2024-07-22 11:05:43

根据经验,系统中最好有一个包管理,因此您最好将所有内容打包在 RPMS 中并通过 yum 进行管理。 从长远来看,这将为您节省大量时间。

如果您绝对想手动从源代码中获得某些东西(例如 PHP)编译器,请使用 stow/checkinstall/... 或任何其他解决方案,使您能够对源代码编译的内容进行基本的包管理。

关于您的问题,您可以尝试通过下载所需软件包的 RPM 并执行“rpm -i --force file.rpm”来覆盖依赖性检查,因为 yum 没有任何强制安装选项

As a rule of thumb, it's better to have one package management in the system, so you'll be better off packaging everything in RPMS and managing it via yum. It will save you lots of time in the long run.

If you absolutely want to have something (fe PHP) compiler from sources by hand, use stow/checkinstall/... or any other solution which would enable you to do rudimentary package management for source-compiled stuff.

Regerding your question, you could try to override dependency checking by downloading RPM of the required package an doing "rpm -i --force file.rpm", since yum does not have any option for forced installations

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文