Logs
Logs

Reputation: 121

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. 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?

Upvotes: 5

Views: 5106

Answers (3)

try2think
try2think

Reputation: 31

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

Upvotes: 0

Shinto Joseph
Shinto Joseph

Reputation: 3103

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

Upvotes: 7

D.L.
D.L.

Reputation: 324

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.

Upvotes: 1

Related Questions