Apache 在Ubuntu中容易产生冲突

Apache 在Ubuntu中容易产生冲突,apache,ubuntu,apache2,debian,mod-security,Apache,Ubuntu,Apache2,Debian,Mod Security,我已尝试安装mod_security,但它有错误,因此我尝试了aptitude: apt-get install libapache-mod-security 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 im

我已尝试安装mod_security,但它有错误,因此我尝试了aptitude:

apt-get install libapache-mod-security
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:
 libapache-mod-security : Depends: libapache2-modsecurity but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@srv16540:~# aptitude install libapache2-modsecurity
The following NEW packages will be installed:
  apache2.2-common{ab} libapache2-modsecurity modsecurity-crs{a}
0 packages upgraded, 3 newly installed, 0 to remove and 10 not upgraded.
Need to get 660 kB of archives. After unpacking 2,861 kB will be used.
The following packages have unmet dependencies:
 apache2 : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2.2-common : Depends: apache2.2-bin (= 2.2.22-1ubuntu1.4) but 2.4.6-2~precise+1 is installed.
 apache2-bin : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
 apache2-data : Conflicts: apache2.2-common but 2.2.22-1ubuntu1.4 is to be installed.
The following actions will resolve these dependencies:

     **Keep the following packages at their current version:**
1)     apache2.2-common [Not Installed]
2)     libapache2-modsecurity [Not Installed]
3)     modsecurity-crs [Not Installed]



Accept this solution? [Y/n/q/?] q
Abandoning all efforts to resolve these dependencies.
我现在知道了将以下软件包保持在当前版本是什么意思

我想知道如果我按yes会发生什么。它是否取代了我当前的apache2?执行此操作前是否需要备份?

答案 我现在知道了将以下软件包保持在当前版本是什么意思了

aptitude正在尝试解决依赖关系和可能的冲突,以满足您的安装请求。然后,它提出了一个解决方案。在您的特定情况下,它找到的第一个解决方案是保持所有内容的真实状态,这就是保持当前版本的意思

我想知道如果我按yes会发生什么,它会取代我当前的apache2吗

不,这个解决方案基本上不会起任何作用

我之前需要备份吗

虽然听起来很无聊,但从长远来看,备份是一种节省时间的好策略。如果你在处理重要的数据,那么它对你来说应该更重要


上下文 我见过其他场景使aptitute提出解决方案,其组合如下:

  • 删除以下软件包
  • 保持以下软件包的当前版本
  • 保留以下未解决的依赖项
  • 以下包裹已被保留
  • 以下软件包将升级
  • 以下软件包已自动安装,不再需要
  • 将安装以下额外的软件包
  • 建议套餐
  • 以下程序包将被删除
  • (可能还有其他人)
在您的情况下,如果您没有接受解决方案(或退出),而是通过按n来拒绝它,那么aptitude将尝试找出另一种可能有用的方案,并再次向您提出。您可以迭代解决方案,如果其中任何一个满足您的要求,那么您可以接受它


溶液(?) 据我所知,您的输出:

apache2.2-common:取决于:apache2.2-bin(=2.2.22-1ubuntu1.4),但安装了2.4.6-2~精确+1

您的问题是您安装了apache2-2.4.6-2~precise+1,但该软件无法从中获得(很可能是从中安装的),并且您请求的软件包与另一个软件包冲突

我将查看,在您删除该源代码后,我将使用以下命令从标准repos重新安装apache 2.2:

sudo aptitude install apache2

打开synaptic manager并搜索
apache2.2-bin
。标记它以便移除。然后


sudo apt get install apache2

这正是它为我所做的:
$sudo apt get remove apache2 bin
$sudo apt获得自动删除

$sudo apt get install apache2

只需删除/var/lib/apt/lists目录的所有内容:

sudo rm -rf /var/lib/apt/lists/*
然后运行:

sudo apt-get update

您是否在系统上使用导致此冲突的任何第三方存储库?你试过运行apt-get更新然后安装软件包吗?@teteet:是的,我用过apt-get和apt-upgrade,我也用过apache2.4,我不记得是怎么安装的。另外,当我在“解决方案接受”中按y键时,它不会起任何作用…即使我没有尝试过你的解决方案,但它对我真的很有用。谢谢,我也有同样的问题,但在我的输出中,我得到了apache2.2-common:dependens:apache2.2-bin(=2.2.22-1ubuntu1.4),但它不会被安装。E:无法纠正问题,您持有的软件包已损坏。如何删除ppa,我在ppa列表中没有找到它。如果我键入sudo-apt-get-install-apache2,安装将顺利进行,但sudo-apt-get-install-lamp服务器出现错误^