Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 295
Logs Avatar asked May 08 '17 23:05

Logs


People also ask

What is gzip used for?

Gzip is most often used to compress web pages on the server end for decompression in the browser. The format is popular for compression of streaming media.

Is gzip and ZIP same?

The most important difference is that gzip is only capable to compress a single file while zip compresses multiple files one by one and archives them into one single file afterwards. Thus, gzip comes along with tar most of the time (there are other possibilities, though).

Is gzip better than zip?

In general, GZIP is much better compared to ZIP, in terms of compression, especially when compressing a huge number of files. Software that use the ZIP format are capable of both archiving and compressing the files together.

What is gzip compression file?

GZIP is a compression technology frequently used for transferring data quickly over the internet. “GZIP” refers to a compression method, software used to compress files with this method, and the file format that results from GZIP compression (usually indicated by the file extension . gz).


2 Answers

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

like image 139
Shinto Joseph Avatar answered Sep 22 '22 08:09

Shinto Joseph


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.

like image 25
D.L. Avatar answered Sep 22 '22 08:09

D.L.