在 Ubuntu Server 12.04 上安装 tomcat 7

Ani*_*aru 11 server tomcat 12.04

我正在尝试使用以下命令在 Ubuntu Server 12.04 上安装 tomcat 7:

sudo apt-get install tomcat7
Run Code Online (Sandbox Code Playgroud)

大多数网站和指南都告诉我这样做,但我立即收到了这个答案:

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:
tomcat7 : Depends: tomcat7-common (>= 7.0.26-1ubuntu1.1) but it is not
going to be installed
E: Unable to correct problems, you have held broken packages
Run Code Online (Sandbox Code Playgroud)

这是什么意思?

我尝试更新存储库,更改国家/地区,修复损坏的包。

我知道有手动安装的可能性,但这应该很容易工作

非常感谢任何有关这方面的线索!

小智 10

这是因为软件包 tomcat6-common 仍然驻留在系统中。

做这个

sudo apt-get remove tomcat6-common
Run Code Online (Sandbox Code Playgroud)

这将删除冲突的包。安装 Tomcat7 现在应该可以正常工作了

  • 这将如何影响已安装的 tomcat6?它会停止工作吗? (2认同)

Lnx*_*lck 0

检查您为 apt-get 保留了哪些软件包,您应该使用

\n\n
sudo dpkg --get-selections | grep hold\n
Run Code Online (Sandbox Code Playgroud)\n\n

可以使用以下命令更改 apt-get 的 \xe2\x80\x9chold\xe2\x80\x9d 包状态:

\n\n
sudo echo package_name hold | dpkg --set-selections\n
Run Code Online (Sandbox Code Playgroud)\n\n

将 Hold 替换为 install 以取消设置 \xe2\x80\x9chold\xe2\x80\x9d 状态

\n\n
sudo apt-get update\n
Run Code Online (Sandbox Code Playgroud)\n\n

然后再次尝试安装。

\n


小智 0

发现之前安装过Tomcat 6,有冲突但不知为何没有被拾取。