今天用到 tomcat,然后发现自己的版本是 8,而最新版本已经是 9 了,想着就用最新的. 卸载了 8 然后悲剧了,一直安装不了,摸了一天鱼,终于搞定了,记录一下!
dashudeMacBook-Pro:~ dashu$ brew install tomcat
==> Downloading https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.tar.gz
==> Downloading from http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
Trying a mirror...
==> Downloading https://www-eu.apache.org/dist/tomcat/tomcat-9/v9.0.24/bin/apache-tomcat-9.0.24.tar.gz
^C^C
dashudeMacBook-Pro:~ dashu$
于是去看下国内镜像,果然,国内镜像确实不存在
结果还是悲剧...百度之,ruby 字符解析问题?(我不会 ruby 语法啊,搞不懂)
dashudeMacBook-Pro:~ dashu$ brew install "https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz"
######################################################################## 100.0%
######################################################################## 100.0%
Error: apache-tomcat-9.0.27.tar.gz: /Users/dashu/Library/Caches/Homebrew/Formula/apache-tomcat-9.0.27.tar.gz:1: Invalid char `\x1F' in expression
/Users/dashu/Library/Caches/Homebrew/Formula/apache-tomcat-9.0.27.tar.gz:1: invalid multibyte char (UTF-8)
我还真不信了,一直都是通过 homebrew 安装软件的啊.于是想前向不行,后向试试? 试着安装 7,诶!还真行~
dashudeMacBook-Pro:~ dashu$ brew install tomcat7
==> Downloading https://www.apache.org/dyn/closer.cgi?path=tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7.0.96.tar.gz
==> Downloading from http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-7/v7.0.96/bin/apache-tomcat-7.0.96.tar.gz
######################################################################## 100.0%
==> Caveats
tomcat@7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have tomcat@7 first in your PATH run:
echo 'export PATH="/usr/local/opt/tomcat@7/bin:$PATH"' >> ~/.bash_profile
To have launchd start tomcat@7 now and restart at login:
brew services start tomcat@7
Or, if you don't want/need a background service you can just run:
catalina run
==> Summary
🍺 /usr/local/Cellar/tomcat@7/7.0.96: 634 files, 13.6MB, built in 14 seconds
灵机一动,brew 其实运行的是 git 仓库里的 ruby 脚本,这样看来莫不是仓库里的代码不是最新的? 于是 brew update 搞起
dashudeMacBook-Pro:~ dashu$ brew update
fatal: unable to access 'https://github.com/Homebrew/homebrew-cask/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
Updated 1 tap (homebrew/cask-versions).
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home
No changes to formulae.
百度之,やっぱり! 需要将 git 远程仓库地址也修改成国内镜像,解决方案简单,修改之.
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
dashudeMacBook-Pro:homebrew-core dashu$ brew update
Updated 2 taps (homebrew/core and homebrew/cask).
==> New Formulae
...(其他更新内容太多,就不贴了)
dashudeMacBook-Pro:homebrew-core dashu$ brew info tomcat
tomcat: stable 9.0.27
Implementation of Java Servlet and JavaServer Pages
https://tomcat.apache.org/
Not installed
From: https://mirrors.ustc.edu.cn/homebrew-core.git/Formula/tomcat.rb
==> Requirements
Required: java >= 1.8 ✔
==> Caveats
To have launchd start tomcat now and restart at login:
brew services start tomcat
Or, if you don't want/need a background service you can just run:
catalina run
==> Analytics
install: 7,501 (30 days), 17,972 (90 days), 72,461 (365 days)
install_on_request: 6,671 (30 days), 16,066 (90 days), 63,395 (365 days)
build_error: 0 (30 days)
dashudeMacBook-Pro:homebrew-core dashu$ brew install tomcat
==> Downloading https://www.apache.org/dyn/closer.cgi?path=/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
==> Downloading from http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.27/bin/apache-tomcat-9.0.27.tar.gz
######################################################################## 100.0%
==> Caveats
To have launchd start tomcat now and restart at login:
brew services start tomcat
Or, if you don't want/need a background service you can just run:
catalina run
==> Summary
🍺 /usr/local/Cellar/tomcat/9.0.27: 640 files, 14.8MB, built in 9 seconds
希望能帮助遇到同样问题的小伙伴们.
1
jyounn OP 第一次发帖,还不是上图...大家见谅
|
2
zhoulouzi 2019-10-17 20:40:47 +08:00
Good
|
3
julyclyde 2019-10-18 12:09:36 +08:00
我提炼一下:
tuna 已经不提供 9024 了 你想办法更新了 brew 之后,开始下载 9027 |
6
efaun 2019-10-19 06:38:44 +08:00
docker 大法好
|
11
efaun 2019-10-21 15:50:23 +08:00
@jyounn #10 我的意思是,你自己安装 tomcat,相当于安装一个软件不停点下一步,用 docker,相当于绿色软件下载即用,当然这也看个人喜好,也有人就是享受自己配置的感觉
|
13
xmsec 2020-02-13 10:02:32 +08:00
遇到相同的问题,最后发现是版本更新后 brew 的信息没有更新,下载失败。可以 brew edit tomcat 修改,然后再装。
不确定如何修改,比如,可以先 brew bump-formula-pr --url=http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz tomcat,然后可以在 https://github.com/Homebrew/homebrew-core/pulls 看到提交的 pr,按照 pr 修改即可。 |
14
xmsec 2020-02-13 10:17:36 +08:00
上面这个方法针对 brew update 之后也无法安装的情况,因为软件更新后 brew 的仓库信息还没有来得及更新。
|