Debian
從 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
所以這可能是未安裝軟體包的原因。如果這確實是問題所在,我怎樣才能一次固定多個包?還是我應該手動固定每個包?
這樣做的重點是要有
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])