用 Wget 直接下载 OTN 上的 Oracle 安装文件

| 9 Comments

OTN 上下载文件,有的时候是比较烦人的事情。估计是出于负载均衡的原因,直接使用浏览器看到的地址还要经过几次 http 302 跳转才可以看到。而这个跳转是要带着 Session 走的,如果使用多线程下载工具就有可能到一个很小的错误页面文件。新版本的 FlashGet 就有这毛病。

如果准备安装的服务器在远程,参考这里的方法,用 Wget 直接下载其实也并不费事。

现通过浏览器获知该数据文件的 URL 地址。然后来个投石问路看看具体的跳转情况:

$ wget --limit-rate=150k \ http://download.oracle.com/otn/linux/oracle10g/ \ 10201/10201_database_linux_x86_64.cpio.gz http://download.oracle.com/otn/linux/oracle10g/ \ 10201/10201_database_linux_x86_64.cpio.gz => `10201_database_linux_x86_64.cpio.gz' Resolving download.oracle.com... 213.35.100.1 Connecting to download.oracle.com[213.35.100.1]:80... connected. HTTP request sent, awaiting response... 302 Found
Location: http://download-
west.oracle.com/otn/linux/oracle10g/10201/ 10201_database_linux_x86_64.cpio.gz [following] http://download-west.oracle.com/otn/linux/oracle10g/10201/ 10201_database_linux_x86_64.cpio.gz
=> `10201_database_linux_x86_64.cpio.gz' Resolving download-west.oracle.com... 206.204.21.139 Connecting to download-west.oracle.com[206.204.21.139]:80... connected. HTTP request sent, awaiting response... 302 Found
Location: https://profile.oracle.com/jsp/realms/otnLogin.jsp?
remoteIp=218.108.233.1&globalId=&redirectUrl=http%3a%2f%2fdownload-
west.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%
2f10201_database_linux_x86_64.cpio.gz [following] --16:11:01-- https://profile.oracle.com/jsp/realms/otnLogin.jsp? remoteIp=218.108.233.1&globalId=&redirectUrl=http%3a%2f%2fdownload- west.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201% 2f10201_database_linux_x86_64.cpio.gz => `otnLogin.jsp? \ remoteIp=218.108.233.1&globalId=&redirectUrl=http:%2F%2Fdownload-
west.oracle.com:80%2Fotn%2Flinux%2Foracle10g%2F10201%
2F10201_database_linux_x86_64.cpio.gz' Resolving profile.oracle.com... 141.146.8.116 Connecting to profile.oracle.com[141.146.8.116]:443... connected.
HTTP request sent, awaiting response... 200 OK Length: 4,106 [text/html]

输出实在是有点恶心,我在适当的地方做了换行处理。要在第二个 Location 处下手:

https://profile.oracle.com/jsp/realms/otnLogin.jsp?remoteIp=218.108.233.1&globalId=&redirectUrl=http%3a%2f%2fdownload-west.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201%2f10201_database_linux_x86_64.cpio.gz

在这个地址后添加 &username=YOURPASSWORD&password=YOURPASSWORD&submit=Continue . YOURUSERNAME/YOURPASSWORD 是在 OTN 上的用户名与口令。然后提交如下的命令即可:

wget --limit-rate=128K --post-data="https://profile.oracle.com/jsp/realms/otnLogin.jsp? \ remoteIp=218.108.233.1&globalId=&redirectUrl=http%3a%2f%2fdownload- \ west.oracle.com%3a80%2fotn%2flinux%2foracle10g%2f10201% \ 2f10201_database_linux_x86_64.cpio.gz \ &username=YOURUSERNAME&password=YOURPASSWORD&submit=Continue" \ https://profile.oracle.com/jsp/reg/loginHandler.jsp

如果嫌输出麻烦,可以在最后 -o downloadOracle.log . 新开一个终端窗口 tail -f downloadOracle.log 就可以观察下载进度了。

要养成随时用 Unix 的习惯思考问题,还真是一个需要时间的事情 :)

--EOF--

9 Comments

文件完整性有点悬...

保存log的同时想要观察可以用tee,这样一个窗口就够了。

$ wget .... [ 2>&1 ] | tee log

下载后可以MD5校验,其实和Flashget差别不大

wget很是很爽的.

今天这个主题不太懂,呵呵!

不太懂,不过还是成功下载,感谢作者!

不错,今天也遇到这样的问题了。只是速度很慢,仅仅2k/s,ssh到一个美国的linux主机再wget,速度快多了,可能还是光纤的问题吧。

不错,今天也遇到这样的问题了。只是速度很慢,仅仅2k/s,ssh到一个美国的linux主机再wget,速度快多了,可能还是光纤的问题吧。

其实是Cache的基本思想

关于本文

This page contains a single entry by Fenng published on December 21, 2006 8:18 PM.

租房记 was the previous entry in this blog.

混沌状态 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.