首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Debian :重新安装apache2

Debian :重新安装apache2
EN

Unix & Linux用户
提问于 2016-06-16 16:48:15
回答 2查看 2.4K关注 0票数 1

apache2包在我的debian服务器上被破坏了,所以我开始卸载所有与apache2相关的包。现在所有的东西似乎都被正确地卸载了。

dpkg -l | grep 'apache'什么都不回

然而,我似乎无法安装apache2.

使用apt-get

代码语言:javascript
复制
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

代码语言:javascript
复制
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重新开始工作呢?

编辑回答Martin:

代码语言:javascript
复制
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

最后:

代码语言:javascript
复制
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
EN

回答 2

Unix & Linux用户

回答已采纳

发布于 2016-06-16 17:06:01

根据aptitude,名为libaprutil1的Apache依赖项安装在比存储库中可获得的更新版本中:

以下软件包有未满足的依赖关系:libasrutil1-DBD-sqlite 3: libaprutil1 (= 1.4.1-3),但是安装了1.5.4-1+b1。Librirutil1-ldap:取决于: libaprutil1 (= 1.4.1-3),但是安装了1.5.4-1+b1。

您可以尝试用apt-cache policy找出这个包的来源:

代码语言:javascript
复制
apt-cache policy libaprutil1

libaprutil1=1.5.4-1+b1似乎来自Debian ..。您是否尝试过从sid存储库中安装Apache?这似乎不是个好主意..。如果您想要更新的Apache版本,我建议升级到Debian jessie

请将来自apt-cache policy的输出附加到您的问题中(当您正在进行时,也包括来自cat /etc/apt/sources.list的输出);您的sources.list可能包含来自wheezy和sid存储库的URL,这将是一件坏事。

您可以尝试删除更新的libaprutil1包:

代码语言:javascript
复制
aptitude purge libaprutil1

然后再次尝试安装Apache:

代码语言:javascript
复制
aptitude install apache2
票数 3
EN

Unix & Linux用户

发布于 2016-06-16 18:12:58

libaprutil1是导致问题的包(很可能是它的依赖项,libapr1)。你需要:

  • 从您的testing/security中删除/etc/apt/sources.list行;
  • 更新包缓存: sudo apt-get更新
  • 删除libaprutil1libapr1:sudo智能删除libaprutil1 libapr1 (以及依赖它们的任何包)
  • 然后安装apache2:sudo智能安装apache2
票数 3
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/290195

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档