我的 debian 服务器上的 apache2 软件包已损坏,因此我首先卸载所有 apache2 相关软件包。现在一切似乎都已正确卸载。
dpkg -l | grep 'apache'
不返回任何内容
但是,我似乎无法安装apache2...
和apt-get
:
sudo apt-get install apache2
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:
apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-prefork (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-event (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-itk (= 2.2.22-13+deb7u6) but it is not going to be installed
Depends: apache2.2-common (= 2.2.22-13+deb7u6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
与aptitude
:
sudo apt-get install apache2
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:
apache2 : Depends: apache2-mpm-worker (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-prefork (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-event (= 2.2.22-13+deb7u6) but it is not going to be installed or
apache2-mpm-itk (= 2.2.22-13+deb7u6) but it is not going to be installed
Depends: apache2.2-common (= 2.2.22-13+deb7u6) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@dora:~# sudo aptitude install apache2
The following NEW packages will be installed:
apache2 apache2-mpm-worker{a} apache2-utils{a} apache2.2-bin{a} apache2.2-common{a} libaprutil1-dbd-sqlite3{ab} libaprutil1-ldap{ab}
0 packages upgraded, 7 newly installed, 0 to remove and 0 not upgraded.
Need to get 1 290 kB of archives. After unpacking 5 146 kB will be used.
The following packages have unmet dependencies:
libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.
libaprutil1-ldap : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.
The following actions will resolve these dependencies:
Keep the following packages at their current version:
1) apache2 [Not Installed]
2) apache2-mpm-worker [Not Installed]
3) apache2.2-bin [Not Installed]
4) apache2.2-common [Not Installed]
5) libaprutil1-dbd-sqlite3 [Not Installed]
6) libaprutil1-ldap [Not Installed]
Accept this solution? [Y/n/q/?] Y
No packages will be installed, upgraded, or removed.
0 packages upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B of archives. After unpacking 0 B will be used.
我该如何解决这个问题并让 Apache 重新工作?
编辑回答马丁:
cat /etc/apt/sources.list
deb http://debian.mirrors.ovh.net/debian/ wheezy main
deb-src http://debian.mirrors.ovh.net/debian/ wheezy main
deb http://security.debian.org/ wheezy/updates main
deb-src http://security.debian.org/ wheezy/updates main
deb http://packages.dotdeb.org wheezy all
deb-src http://packages.dotdeb.org wheezy all
deb http://packages.dotdeb.org wheezy-php55 all
deb-src http://packages.dotdeb.org wheezy-php55 all
deb http://security.debian.org/ testing/updates main
deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main
deb http://repo.mysql.com/apt/debian/ wheezy mysql-5.6
deb-src http://repo.mysql.com/apt/debian/ wheezy mysql-5.6
deb http://dl.google.com/linux/mod-pagespeed/deb/ stable main
最后:
apt-cache policy libaprutil1
libaprutil1:
Installed: 1.5.4-1+b1
Candidate: 1.5.4-1+b1
Version table:
*** 1.5.4-1+b1 100
100 /var/lib/dpkg/status
1.4.1-3 500
500 http://debian.mirrors.ovh.net/debian wheezy/main amd64 Packages
答案1
根据aptitude
,一个名为的 Apache 依赖项libaprutil1
安装在比存储库中提供的版本更新的版本中:
The following packages have unmet dependencies: libaprutil1-dbd-sqlite3 : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed. libaprutil1-ldap : Depends: libaprutil1 (= 1.4.1-3) but 1.5.4-1+b1 is installed.
您可以尝试使用以下方法找出该包的来源apt-cache policy
:
apt-cache policy libaprutil1
libaprutil1=1.5.4-1+b1
似乎来自 Debian sid...您是否有机会尝试从 sid 存储库安装 Apache?这似乎不是一个好主意...如果您想要更新的 Apache 版本,我建议升级到 Debian 杰西。
请将 的输出附加apt-cache policy
到您的问题中(当您这样做时,也将 的输出附加到您的问题中cat /etc/apt/sources.list
);您可能sources.list
包含来自 wheezy 和 sid 存储库的 URL,这将是一件坏事。
您可以尝试删除较新的libaprutil1
软件包:
aptitude purge libaprutil1
然后再次尝试安装 Apache:
aptitude install apache2
答案2
libaprutil1
是导致问题的包(很可能是它的依赖项libapr1
)。你需要:
testing/security
从你的/etc/apt/sources.list
;中删除该行更新包缓存:
sudo apt-get update
删除
libaprutil1
并libapr1
:sudo aptitude remove libaprutil1 libapr1
(以及任何依赖于它们的包)
然后安装
apache2
:sudo aptitude install apache2