4

我试图安装 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.

我现在知道将以下软件包保持在当前版本的含义。

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

4

4 回答 4

4

答案

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

aptitude 正在尝试解决依赖关系和可能的冲突以满足您的安装请求。然后它提出了一个解决方案。在您的特定情况下,它找到的第一个解决方案是将所有内容保持原样,这就是保持当前版本+ [未安装]的含义。

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

不,该解决方案基本上什么都不做。

我之前需要备份吗?

听起来很无聊,但从长远来看,备份是节省时间的好策略。如果您弄乱了重要数据,那么它对您来说应该更加重要。


语境

我已经看到其他场景使 apttitute 提出具有以下组合的解决方案:

  • 删除以下软件包
  • 将以下软件包保留为当前版本
  • 保留以下依赖项未解决
  • 以下包裹已被保留
  • 以下软件包将被升级
  • 以下软件包已自动安装,不再需要
  • 将安装以下额外软件包
  • 建议的包
  • 以下软件包将被删除
  • (可能还有其他人)

在您的情况下,如果您不接受解决方案(或退出),而是通过按n拒绝它,那么 aptitude 将尝试找出另一个可能有用的方案并再次向您提出建议。您可以迭代解决方案,如果其中任何一个让您满意,那么您可以接受它。


解决方案 (?)

据我所见,您的输出:

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

您的问题是您安装了 apache2-2.4.6-2~precise+1 无法从标准 Ubuntu 精确存储库中获得(很可能是从此PPA安装的),并且您请求的软件包与另一个软件包冲突.

我将查看有关如何删除 PPA 的答案,在您删除该源之后,我将使用以下命令从标准存储库中重新安装 apache 2.2:

sudo aptitude install apache2
于 2013-09-23T14:23:02.920 回答
3

这正是它为我所做的:
$ sudo apt-get remove apache2-bin
$ sudo apt-get autoremove
$ sudo apt-get install apache2

于 2014-06-06T10:15:42.010 回答
0

打开突触管理器并搜索apache2.2-bin. 将其标记为删除。然后

sudo apt-get install apache2

于 2014-04-30T10:44:36.890 回答
0

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

sudo rm -rf /var/lib/apt/lists/*

然后运行:

sudo apt-get update
于 2016-05-05T17:18:24.517 回答