简体   繁体   English

安装Tomcat(Ubuntu)时出现gzip和tar错误

[英]gzip & tar Error when installing Tomcat (Ubuntu)

I'm working on a project, but I need to use Apache Tomcat to run my user interface. 我正在开发一个项目,但我需要使用Apache Tomcat来运行我的用户界面。 I'm also running my project on Ubuntu though Virtualbox. 我也是通过Virtualbox在Ubuntu上运行我的项目。 I am following this tutorial on installing Tomcat: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04 However, when I type this command in the terminal : 我正在按照本教程安装Tomcat: https//www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-ubuntu-16-04但是,当我输入此命令时终点站 :

sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1

I get the following error: 我收到以下错误:

-C /opt/tomcat --strip-components=1

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I've researched the problem, but still don't understand it or know how to fix it. 我已经研究过这个问题,但仍然不理解它或者知道如何修复它。

What am I doing wrong? 我究竟做错了什么?

when you are using the curl to download the link, make sure that the link is valid by browsing it. 当您使用curl下载链接时,请确保链接有效,方法是浏览它。

probabily the link is not valid in my case so the rest of the steps will not work. 可能这个链接在我的情况下是无效的,所以其余的步骤将无法正常工作。

Go to Tom cat download page Tomcat 8 downloads page 转到Tom cat下载页面Tomcat 8下载页面

Under Binary Distributions you can find core -> copy tar.gz link file and then curl 在Binary Distributions下你可以找到core - > copy tar.gz链接文件然后curl

Make sure to replace apache-tomcat-8*tar.gz with apache-tomcat-8.5.30.tar.gz (the version you have downloaded recently) when following the next step 确保在执行下一步时用apache-tomcat-8.5.30.tar.gz(最近下载的版本)替换apache-tomcat-8 * tar.gz

sudo tar xzvf apache-tomcat-8.5.30.tar.gz -C /opt/tomcat --strip-components=1

Hope this helps. 希望这可以帮助。

Thanks 谢谢

Try uncompressing the file first with gunzip to see if that works. 尝试使用gunzip首先解压缩文件以查看是否有效。 If not you probably have a corrupt file. 如果不是,你可能有一个损坏的文件。 (Most likely you just downloaded a partial file.) (很可能你刚刚下载了一个部分文件。)

gunzip apache-tomcat-8*tar.gz gunzip apache-tomcat-8 * tar.gz

If that works then you probably have a typo in the rest of the command. 如果这样可行,那么你可能在命令的其余部分输入了一个拼写错误。 If it succeeds your file will now be named apache-tomcat-8*.tar (the .gz will be dropped.) Try the following command to verify the integrity of the tar file: 如果成功,您的文件现在将命名为apache-tomcat-8 * .tar(.gz将被删除。)尝试以下命令来验证tar文件的完整性:

tar tvf apache-tomcat-8*.tar tar tvf apache-tomcat-8 * .tar

That should list the contents of the tar file if it's not corrupt. 这应该列出tar文件的内容,如果它没有损坏。 If you get a full listing with no errors then something is wrong with the "-C /opt/tomcat --strip-components=1" arguments from the original command. 如果你得到一个没有错误的完整列表,那么原始命令中的“-C / opt / tomcat --strip-components = 1”参数就会出错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM