【问题标题】:gzip & tar Error when installing Tomcat (Ubuntu)gzip & tar 安装 Tomcat (Ubuntu) 时出错
【发布时间】:2017-10-07 02:32:28
【问题描述】:

我正在处理一个项目,但我需要使用 Apache Tomcat 来运行我的用户界面。我也在通过 Virtualbox 在 Ubuntu 上运行我的项目。我正在按照本教程安装 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

我收到以下错误:

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

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

我已经研究过这个问题,但仍然不明白或不知道如何解决它。

我做错了什么?

【问题讨论】:

    标签: java apache ubuntu tomcat terminal


    【解决方案1】:

    当你使用 curl 下载链接时,请通过浏览确保链接有效。

    在我的情况下,链接可能无效,因此其余步骤将不起作用。

    去汤姆猫下载页面Tomcat 8 downloads page

    在 Binary Distributions 下,您可以找到 core -> 复制 tar.gz 链接文件,然后 curl

    执行下一步时,请务必将 apache-tomcat-8*tar.gz 替换为 apache-tomcat-8.5.30.tar.gz(您最近下载的版本)

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

    希望这会有所帮助。

    谢谢

    【讨论】:

    • 这行得通,而且我不需要明确地替换版本号,星号就可以了。
    【解决方案2】:

    先尝试使用 gunzip 解压缩文件,看看是否可行。如果不是,您可能有一个损坏的文件。 (很可能您只是下载了部分文件。)

    gunzip apache-tomcat-8*tar.gz

    如果这样可行,那么您可能在命令的其余部分有错字。如果成功,您的文件现在将命名为 apache-tomcat-8*.tar(.gz 将被删除。)尝试以下命令验证 tar 文件的完整性:

    tar tvf apache-tomcat-8*.tar

    如果 tar 文件没有损坏,它应该会列出它的内容。如果您得到一个没有错误的完整列表,那么原始命令中的“-C /opt/tomcat --strip-components=1”参数有问题。

    【讨论】:

      【解决方案3】:

      可能是永久重定向链接。将重定向地址与curl -O 一起使用。

      我遵循了 Tomcat 9 的相同教程。

      将链接复制到Binary Distributions -> Core -> tar.gz 后,您将获得http://www.apache.si/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.26.tar.gz

      运行curl -O http:// ...后文件下载太快了。它的内容是

      301 永久移动 文档已移动here

      所以,只需点击此链接 (https) 即可: curl -O https://www.apache.si/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.26.tar.gz

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-11-19
        • 2014-05-23
        • 2016-11-30
        • 2014-03-06
        • 2014-01-05
        相关资源
        最近更新 更多