Installing Tomcat 7 using apt-get fails

作者: shaneZhang 分类: 互联网技术 发布时间: 2014-11-15 20:23

I get the following error when installing Tomcat7:

Setting up tomcat7 (7.0.26-1ubuntu1.1) …  
chmod: cannot access `/etc/tomcat7/tomcat-users.xml': No such file or directory  
dpkg: error processing tomcat7 (–configure):  
subprocess installed post-installation script returned error exit status 1  
No apport report written because MaxReports is reached already  
>Errors were encountered while processing:  
tomcat7  
E: Sub-process /usr/bin/dpkg returned an error code (1)

And I get this error when I try to apt-get remove Tomcat7:

Removing tomcat7 …  
* tomcat7 is not installed  
invoke-rc.d: initscript tomcat7, action "stop" failed.

How do I fix this to install Tomcat 7 correctly?

apt-get purge tomcat7

sudo apt-get
autoremove tomcat7.

I had the exact the same problem.

I had to run this command (see below) to see what all tomcat related libraries are there and remove ALL the tomcat related libraries:

To see what all tomcat related libraries are there:

dpkg -l | grep -i tomcat

To remove a tomcat library:

dpkg -P <library-name>

Then, I reinstalled tomcat7 using the command:

sudo apt-get install tomcat7

[ During installation, it spit out messages saying it is going to install some of the other libraries related to tomcat7 – I chose – yes ].

It installed tomcat7 and started it.

Then, I stopped and restarted tomcat7 using these commands:

/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start

如果觉得我的文章对您有用,请随意打赏。如果有其他问题请联系博主QQ(909491009)或者下方留言!

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注