gzip & tar Error when installing Tomcat (Ubuntu)

99封情书 提交于 2019-12-10 15:52:49

问题


I'm working on a project, but I need to use Apache Tomcat to run my user interface. I'm also running my project on Ubuntu though Virtualbox. 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 :

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?


回答1:


when you are using the curl to download the link, make sure that the link is valid by browsing it.

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

Under Binary Distributions you can find core -> copy tar.gz link file and then 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

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

Hope this helps.

Thanks




回答2:


Try uncompressing the file first with gunzip to see if that works. If not you probably have a corrupt file. (Most likely you just downloaded a partial file.)

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:

tar tvf apache-tomcat-8*.tar

That should list the contents of the tar file if it's not corrupt. 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.




回答3:


Probably it is a permanent redirect link. Use the redirected address with curl -O.

I followed the same tutorial for Tomcat 9.

When copied the link to Binary Distributions -> Core -> tar.gz you get http://www.apache.si/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.26.tar.gz

After running curl -O http:// ... the file downloaded too quickly. Its contents was

301 Moved Permanently The document has moved here

So, just follow this link (https) instead: curl -O https://www.apache.si/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.26.tar.gz



来源:https://stackoverflow.com/questions/43858655/gzip-tar-error-when-installing-tomcat-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!