diff --git a/sources/tech/20141027 How to download an ISO image with BitTorrent fast and safely from the command line.md b/sources/tech/20141027 How to download an ISO image with BitTorrent fast and safely from the command line.md index e71c1a66cf..0c7f1126f5 100644 --- a/sources/tech/20141027 How to download an ISO image with BitTorrent fast and safely from the command line.md +++ b/sources/tech/20141027 How to download an ISO image with BitTorrent fast and safely from the command line.md @@ -1,80 +1,78 @@ -wangjiezhe translating... - -How to download an ISO image with BitTorrent fast and safely from the command line +如何使用命令行通过 BitTorrent 快速安全地下载 ISO 镜像 ================================================================================ -If you are one of those guys who have urge to try out every new (or even beta) release of Linux distribution to satisfy your curiosity and stay up-to-date, you will need to deal with the hassle of downloading big ISO images every now and then. ISO providers typically put up .torrent file of their ISO images to ease up on the bandwidth consumption of their servers. The benefit of peer-to-peer download is obvious for users as well (in terms of speed), especially when a new release of a popular Linux distribution is up for grab, and everyone is downloading and seeding the release at the same time. +如果你喜欢尝试最新版甚至是 beta 版的 Linux 发行版来满足你的好奇心,并始终保持是最新版,那么你就会时常受到下载较大的 ISO 镜像的烦恼。提供 ISO 的人通常会使用 ISO 镜像的 .torrent 文件来减少服务器的带宽消耗。P2P 下载对于使用者来说好处也是很明显的(就下载速度而言),特别是当流行的 Linux 发行版有新版本发布并上传供下载,每个人同时在下载做种的时候。 -Ubuntu 14.10 (Utopic Unicorn) was just released this week. So there should be plenty of seeds to download the release from in the BitTorrent network at the moment. While there are many GUI-based BitTorrent clients out there, I am going to show you **how to download ISO images via a simple command-line interface (CLI) BitTorrent client**, which can be handy if you are on a remote headless server. Later in this tutorial, I will also demonstrate **how to verify the integrity of a downloaded ISO image**. +Ubuntu 14.10 (utopic Unicorn) 这周刚刚发布。因此现在在 BitTorrent 网络上应该有很多种子可以下载该版本。虽然有很多基于图形界面的 BitTorrent 客户端,我将展示**如何通过基于简单的命令行界面的 BitTorrent 客户端下载 ISO 镜像**,如果是在远程无图形界面的服务器上的话这会很方便。在这片教程靠后的部分,我还会演示**如何验证已下载的 ISO 镜像的完整性**。 -The CLI BitTorrent client I am going to use today is transmission-cli. As you may know, [Transmission][1] is one of the most popular GUI-based BitTorrent client. transmission-cli is its stripped-down CLI version. +我今天要使用的基于命令行的 BitTorrent 客户端是 transmission-cli。正如你可能知道的那样,[Transmission][1] 是最流行的基于图形界面的 BitTorrent 客户端之一。transmission-cli 是它的简装的命令行版本。 -### Install Transmission-cli on Linux ### +### 在 Linux 上安装 Transmission-cli ### -To install **transmission-cli**, you don't need to install a full-blown GUI-based Transmission, which is nice. +要安装 **transmission-cli**,你不必安装完整的基于图形界面的 Transmission,这是一个很好的消息。 -On Debian, Ubuntu or their derivatives: +在 Debian、Ubuntu 或者是基于它们的发行版上: $ sudo apt-get install transmission-cli -On Fedora: +在 Fedora 上: $ sudo yum install transmission-cli -On CentOS or RHEL (after enabling [EPEL repository][2]): +在 CentOS 或者 RHEL 上(在安装了 [EPEL 仓库][2]之后): $ sudo yum install transmission-cli -### Download an ISO Image Fast with transmission-cli ### +### 通过 transmission-cli 快速地下载 ISO 镜像 ### -**transmission-cli** is really simple to use. If you are too lazy to study its command line options, all you have to do is to download .torrent file, and launch the command with the torrent file. It will automatically look for available peers, and download an ISO file from them. +**transmission-cli**的使用非常简单。如果你懒于学习它的命令行选项,所有你要做的事情就是下载 .torrent 文件并运行命令。这会自动寻找可用的种子并从那里下载 ISO 文件。 $ wget http://releases.ubuntu.com/14.10/ubuntu-14.10-desktop-amd64.iso.torrent $ transmission-cli ubuntu-14.10-desktop-amd64.iso.torrent ![](https://farm4.staticflickr.com/3933/14999528344_9af3ea5d2e_z.jpg) -Once an ISO image is fully downloaded, it will be stored in ~/Downloads directory by default. It took me only 5 minutes to download 1GB Ubuntu ISO image. +一旦 ISO 镜像下载完成,它默认存储在 ~/Downloads 文件夹中。下载 1GB 的 Ubuntu ISO 镜像只用了我 5 分钟的时间。 ![](https://farm6.staticflickr.com/5605/15433651319_745df6633a_z.jpg) -Once it finishes downloading an ISO image, you will see the message "State changed from Incomplete to Complete" in the console. Note that transmission-cli will continue to run afterwards, becoming a seed for other downloaders. Press Ctrl+C to quit. +程序下载 ISO 镜像完成后,你会在终端中看到“状态由未完成变为完成”的提示。要注意的是 transmission-cli 会继续运行并做种以便于其他下载者下载。按 Ctrl+C 来退出。 -### Customize Download Options for Repeat Use ### +### 为重复使用定制下载选项 ### -If you are a repeat user of **transmission-cli**, it may be worth your time to be familiar with some of its command line options. +如果你是 **transmission-cli** 的重复使用者,那么值得花时间来熟悉一下它的命令行选项。 -The "-w /path/to/download-directory" option specifies the directory where a downloaded file will be saved. +"-w /path/to/download-directory" 选项指定下载文件保存的文件夹。 -The "-f /path/to/finish-script" option sets a script to run when current download is completed. Recall that transmission-cli, by default, continues running even after a file is fully downloaded. If you want to auto-terminate transmission-cli upon successful download, you can use this option. The following simple finish script will do. +"-f /path/to/finish-script" 选项设置当前下载完成后要运行的脚本。注意 transmission-cli 默认在文件下载完成后继续运行。如果你想在成功下载完成后自动关闭 transmission-cli,你可以使用这个选项。下面这个简单的脚本可以完成这个功能。 #!/bin/sh sleep 10 killall transmission-cli -If you want to allocate limited upload/download bandwidth to transmission-cli, you can use "-d and "-u options. If you want to allow unlimited bandwidth instead, simply specify "-D" or "-U" option without any value. +如果你想为 transmission-cli 分配上传/下载带宽限制,你可以使用 “-d ” 和 “-u ” 选项。如果你不想限制带宽使用,仅仅指定 “D” 或 “-U” 选项即可。 -Here is a more advanced usage example of transmission-cli. In this example, the CLI client will automatically exit upon successful download. Download rate is unlimited while upload rate is capped at 50KB/s. +这有一个更高级的 transmission-cli 使用范例。在这个例子中,命令行客户端在成功下载后自动退出。下载速度不限而上传速度限制为 50KB/s。 $ transmission-cli -w ~/iso -D -u 50 -f ~/finish.sh ubuntu-14.10-desktop-amd64.iso.torrent ![](https://farm6.staticflickr.com/5599/15434697690_e9a19f0d97_z.jpg) -### Verify the Integrity of a Downloaded ISO Image ### +### 验证已下载的 ISO 镜像的完整性 ### -When you download an ISO image, especially from many unknown peers in the BitTorrent network, it is always recommended to verify the integrity of the downloaded image. +当你下载了一个 ISO 镜像,特别是从 BitTorrent 网络上很多未知的种子处下载的,通常建议要验证下载镜像的完整性。 -In case of Ubuntu releases, Canonical provides several checksum files (e.g., MD5SUM, SHA1SUMS and SHA256SUMS) for verification purpose. Let's use SHA256SUMS in this example. +对于 Ubuntu 发行版的情况, Canonical 提供了几个供验证使用的验校文件(如 MD5SUM, SHA1SUMS 和 SHA256SUMS)。在这个例子中我们使用 SHA256SUMS。 ![](https://farm4.staticflickr.com/3943/15434697700_3b3e6077ee_z.jpg) -First, download the following two files. +首先,下载下面两个文件。 $ wget http://releases.ubuntu.com/14.10/SHA256SUMS $ wget http://releases.ubuntu.com/14.10/SHA256SUMS.gpg -The first file is a SHA256 checksum file for ISO images, while the second file (*.gpg) is a signature of the checksum file. The purpose of the second file is to verify the validity of the checksum file itself. +第一个文件是 ISO 镜像的 SHA256 验校文件,而第二个文件(*.gpg)是验校文件的签名。第二个文件的目的是验证验校文件本身的有效性。 -Let's verify the validity of SHA256SUMS file by running this command: +我们通过运行下面的命令来验证 SHA256SUMS 文件的有效性。 $ gpg --verify SHA256SUMS.gpg SHA256SUMS @@ -83,25 +81,25 @@ Let's verify the validity of SHA256SUMS file by running this command: gpg: Signature made Thu 23 Oct 2014 09:36:00 AM EDT using DSA key ID FBB75451 gpg: Can't check signature: public key not found -If you are getting the above error, this is because you have not imported the public key used to generate the signature. So now let's import the required public key. +如果你得到上面的错误信息,是因为你还没有导入生成这个签名的公共密钥。因此我们现在导入需要的公共密钥。 -To do that, you need to know the "key ID" of the public key, which is shown in the output of gpg command above. In this example, the key ID is "FBB75451". Run the following command to import the public key from the official Ubuntu keyserver. +这样做之前,你需要知道公共密钥的 “key ID”,而这在上面的 gpg 命令的输出中有显示。在这个例子中,密钥 ID 时 “FBB75451”。运行下面的命令来从官方 Ubuntu 密钥服务器导入公共密钥。 $ gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys FBB75451 ![](https://farm4.staticflickr.com/3953/15620291035_bcdb3cffb9_z.jpg) -Now that the public key has been imported, go ahead and re-run the previous command to verify the signature. +既然公共密钥已经被导入,我们可以继续并重新运行之前的命令来验证签名。 gpg --verify SHA256SUMS.gpg SHA256SUMS ![](https://farm6.staticflickr.com/5600/15433651369_d22905e65b_z.jpg) -This time you will not see "public key not found" error. If the SHA256SUMS file is valid, you will see "Good signature from " message. Note that you will also see a warning message saying that "This key is not certified with a trusted signature". Basically this warning message is telling you that you have not [assigned any explicit trust][3] to the imported public key. To avoid this warning, you could choose to assign your full trust to the imported public key, but you should do that only after the key has been fully vetted in some other means. Otherwise, you can ignore the warning for now. +这次你没有看到 “public key not found” 的错误信息。如果 SHA256SUMS 文件时有效的,你会看到 “Good signature from ” 的信息。注意到你还看到一个 “This key is not certified with a trusted signature” 的警告信息。基本上这个警告信息时告诉你对导入的公共密钥[指定任何明确的信任][3]。要避免这个警告,你可以选择指定完全信任导入的公共密钥,但你应该只有在通过其他方式审查了这个密钥之后才这样做。否则的话,你可以暂时忽略这个警告。 -After verifying the integrity of SHA256SUMS file, the final last step is to compare the SHA256 checksum of the downloade ISO image against the corresponding checksum value in SHA256SUMS file. For that you can use sha256sum command line tool. +在验证了 SHA256SUMS 文件的完整性后,最后一个步骤是比较已下载 ISO 文件的 SHA256 验校和和 SHA256SUMS 文件中对应的验校值。你可以使用 sha256sum 命令行工具来完成这个步骤。 -For your convenience, the following one-liner compares the SHA256 checksums and reports the result. +为方便起见,下面一行命令比较 SHA256 验校和并报告结果。 $ sha256sum -c <(grep ubuntu-14.10-desktop-amd64.iso SHA256SUMS) @@ -109,14 +107,14 @@ For your convenience, the following one-liner compares the SHA256 checksums and ubuntu-14.10-desktop-amd64.iso: OK -If you see the above output, that means that two checksum values match. So the integrity of the downloaded ISO image has been successfully verified. +如果你看到了上面的输出信息,这表明两个验校值相匹配。这样已下载 ISO 镜像的完整性就被成功的验证了。 -------------------------------------------------------------------------------- via: http://xmodulo.com/download-iso-image-bittorrent-command-line.html 作者:[Dan Nanni][a] -译者:[译者ID](https://github.com/译者ID) +译者:[wangjiezhe](https://github.com/wangjiezhe) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出