Linux

Debian 8 - 安裝 php7.0 的設置首選項

  • July 6, 2016

請幫助設置安裝 php7.0 和相關軟體包的首選項(其中一些不是穩定版本)。

我有作業系統 Debian 8。

我在以下位置設置包的源列表etc\apt\sources.list.d\

security.list

deb http://security.debian.org/ stable/updates  main contrib non-free
deb http://security.debian.org/ testing/updates main contrib non-free

stable.list

deb     http://ftp.de.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free

testing.list

deb     http://ftp.de.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.de.debian.org/debian/ testing main contrib non-free

unstable.list

deb     http://ftp.de.debian.org/debian/ unstable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ unstable main contrib non-free

我在以下位置為包設置了一些首選項文件etc\apt\preferences.d\

security.pref

Package: *
Pin: release l=Debian-Security
Pin-Priority: 1000

stable.pref

Package: *
Pin: release a=stable
Pin-Priority: 900

testing.pref

Package: *
Pin: release a=testing
Pin-Priority: 750

unstable.pref

Package: *
Pin: release a=unstable
Pin-Priority: 50

我創建**99default-release**了etc\apt\apt.conf.d\包含內容的文件:

APT::Default-Release "stable";

最後,當我執行安裝 php7.0 的命令時,出現下一個錯誤:

root@machie:/etc# apt-get install php7.0

Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
php7.0 : Depends: libapache2-mod-php7.0 but it is not going to be installed or
                  php7.0-fpm but it is not going to be installed or
                  php7.0-cgi but it is not going to be installed
W: No priority (or zero) specified for pin
E: Unable to correct problems, you have held broken packages.

PS 沒有來源、首選項和 apt.conf 文件 php7.0 安裝成功表單“ deb http://packages.dotdeb.org jessie all” repo。但我希望這是可能的設置偏好。

http://packages.dotdeb.org我只是從sources.list 中刪除repo。現在我可以通過執行命令從 debian repo 安裝測試版本:

sudo apt-get install -f -y -t testing php7.0 php7.0-curl php7.0-cli php7.0-gd php7.0-xml php7.0-mbstring php-xdebug

完全依賴(apache2等)

對於更新測試包執行命令:

apt-get install `apt-show-versions -u -b | grep testing`

要將任何軟體包降級到穩定版本,請etc\apt\preferences.d\使用以下內容創建文件:

Package: <package_name_here> 
Pin: release a=testing
Priority: 1001

並執行apt-get update

引用自:https://serverfault.com/questions/788095