从 DotDeb 中提取 php5 并忽略其他包

从 DotDeb 中提取 php5 并忽略其他包

我已经安装了 Debian squeeze,这是我的/etc/apt/sources.list文件:

# Debian packages for stable
deb http://ftp.lug.ro/debian/ stable main contrib non-free

# Security updates for stable
deb http://security.debian.org/ stable/updates main contrib non-free

# DotDeb - http://www.dotdeb.org/
deb ftp://download.srv.ro/pub/dotdeb/ stable all
deb-src ftp://download.srv.ro/pub/dotdeb stable all

我想要做的是设置一个密码,这样我就可以只安装php5来自 dotdeb 的软件包,而忽略来自此存储库的所有其他软件包。我试过这个:

# cat /etc/apt/preferences
Package: *
Pin: release o=packages.dotdeb.org
Pin-Priority: 100

Package: php5
Pin: release o=packages.dotdeb.org
Pin-Priority: 900

# apt-cache policy php5
php5:
  Installed: 5.3.3-7+squeeze14
  Candidate: 5.3.17-1~dotdeb.0
  Package pin: 5.3.17-1~dotdeb.0
  Version table:
     5.3.17-1~dotdeb.0 900
        100 ftp://download.srv.ro/pub/dotdeb/ stable/all i386 Packages
 *** 5.3.3-7+squeeze14 900
        500 http://ftp.lug.ro/debian/ stable/main i386 Packages
        500 http://security.debian.org/ stable/updates/main i386 Packages
        100 /var/lib/dpkg/status

但没有成功。也许我不太了解固定的工作原理。

更新

跑步apt-get -s upgrade让我:

# apt-get -s upgrade
<-- output clipped -->
The following packages have been kept back:
  php5
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.

另外,我刚刚注意到跑步apt-get -s install php5给我带来了:

# apt-get -s install php5
<-- output clipped -->
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php5 : Depends: libapache2-mod-php5 (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed or
                 libapache2-mod-php5filter (>= 5.3.17-1~dotdeb.0) but it is not going to be installed or
                 php5-cgi (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed or
                 php5-fpm (>= 5.3.17-1~dotdeb.0) but it is not going to be installed
        Depends: php5-common (>= 5.3.17-1~dotdeb.0) but 5.3.3-7+squeeze14 is to be installed
E: Broken packages

所以这可能是软件包未安装的原因。如果确实是这个问题,我该如何一次固定多个软件包?还是我应该手动固定每个软件包?

答案1

这一切的重点是要有php支持readline,这样我才能使用php交互模式php -a。我找到了一篇关于如何在 Debian 上设置 Dotdeb apt 存储库并使用运行以下命令:

PACKAGES=$(command wget "http://packages.dotdeb.org/dists/squeeze/php5/binary-$(command dpkg --print-architecture)" \
--quiet --output-document=- \
| command grep "href=" | command grep -v "h1" | command grep -v "\.\./" \
| command sed -e 's/^[^>]*>\([^_]*\)_.*$/\1/' | command tr "\n" " ")

获取所有php5相关包并更新/etc/apt/preferences如下:

Package: *
Pin: release o=packages.dotdeb.org
Pin-Priority: 100

Package: libapache2-mod-php5 libapache2-mod-php5filter php-pear php5-cgi php5-cli php5-common php5-curl php5-dbg php5-dev php5-enchant php5-fpm php5-gd php5-gmp php5-imap php5-interbase php5-intl php5-ldap php5-mcrypt php5-mysql php5-odbc php5-pgsql php5-pspell php5-recode php5-snmp php5-sqlite php5-sybase php5-tidy php5-xmlrpc php5-xsl php5
Pin: release o=packages.dotdeb.org
Pin-Priority: 900

现在 apt-get 将安装所有需要的软件包:

# apt-get -s install php5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libapache2-mod-php5 php5-cli php5-common php5-curl
Suggested packages:
  php-pear
The following packages will be upgraded:
  libapache2-mod-php5 php5 php5-cli php5-common php5-curl
5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Inst php5-cli [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst php5-curl [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst libapache2-mod-php5 [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386]) []
Inst php5-common [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Inst php5 [5.3.3-7+squeeze14] (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [all])
Conf php5-common (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5-cli (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf libapache2-mod-php5 (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5-curl (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [i386])
Conf php5 (5.3.17-1~dotdeb.0 packages.dotdeb.org:stable [all])

答案2

您无法固定和/或安装仅有的软件包php5。除了作为安装其他软件包的“元”软件包之外,PHP 还有许多不同的模块也需要安装。

如果您想以这种方式固定内容,则需要(至少)固定PHP 本身和软件包libapache2-mod-php5(或过滤器版本)或php5-cgi。您需要的任何 PHP 模块也需要从此存储库固定和安装,这些插件所依赖的任何库(如果与 Debian 稳定版中的版本不同)也需要从此存储库固定和安装。php5-fpmphp5-common

相关内容