Wednesday, October 9, 2019

How do I easily download Ubuntu ISOs via bittorrent from the command line?



I want to download an Ubuntu ISO, preferably over bittorrent, and verify its integrity.



Currently, the following steps are required:




  • start web browser, go to ubuntu.com, find download link

  • find gpg signature for the checksums


  • get the gpg key to check gpg signature of the checksums

  • wait until download finished

  • gpg verifiy

  • checksum verification



Isn't there a simpler way? Just like




  • apt-get install 12.04-64bit-ubuntu-iso


  • apt-get install 12.04-32bit-server-iso

  • etc.?



Of course, apt-get (or whatever it would be called) should download over bittorrent to remove load from the servers.



If it doesn't exist, it should probable post that at ubuntu brainstorm? Is there already such a tool? I wanted to ask before posting to brainstorm.



aria2c and metalinks let you do a one-step, verified ISO download using the bittorrent protocol




It is extremely easy to do what you want using the aria2 CLI download manager and the ISO metalinks available on the official download page, namely:




  • Download an Ubuntu ISO

  • Preferably over Bittorrent

  • Automatically verify integrity of downloaded ISO



Steps:





  1. Install aria2 with sudo apt-get install aria2c



    Install via the software center


  2. Open the official download page for the release you want, e.g. for Precise



    http://releases.ubuntu.com/releases/precise

  3. Find the metalink for your ISO, e.g. ubuntu-12.04-desktop-i386.metalink, and right-click to copy it to the clipboard

  4. In the terminal, type and paste the link as aria2c



    • You can add the --seed-time=0 option if you want aria2c to exit after downloading and not seed the ISO, e.g.


      aria2c --seed-time=0 http://releases.ubuntu.com/releases/precise/ubuntu-12.04-server-i386.metalink


  5. Unless BitTorrent (BT) is not possible on your network, aria2 will download the file as a torrent.

  6. The BitTorrent protocol provides automatic built-in checksumming, and aria2 will continually verify pieces as they are downloaded.



    • In short, if you download an official metalink over BT, a successful download means that you have the original, unmodified, complete file.





Trick: You can remove the web browser, copy-paste etc. by simply typing the direct URL for aria2 as http://releases.ubuntu.com/releases followed by this format:



/release-name/ubuntu-release.version-variant-architecture.iso




Exception/manual verification:



If aria2 had to download the ISO via HTTP/FTP (BT not available), or if you just want the security of double-verification, a one-liner in the following format should do it (split lines for readability)




wget -q -O- http://releases.ubuntu.com/releases/precise/MD5SUMS \
| grep desktop-i386 | md5sum -c




  • Success will show you, e.g. ubuntu-12.04-desktop-i386.iso: OK

  • desktop-i386 should be replaced with the appropriate version-architecture you chose to download, e.g. server-amd64, alternate-i386 etc.

  • MD5SUMS can be replaced with SHA1SUMS or SHA256SUMS, with the corresponding md5sum at the end replaced with sha1sum or sha256sum

  • precise in the URL can of course be replaced with whatever release you're downloading.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...