Linux多线程高速下载

有时候,我们用wget下载速度很慢,多数是几十K,下面我们来安装Axel。本文以CentOS 7.2 为例:
安装EPEL源
yum -y install epel-release

安装完上面的源后可以直接安装axel, 下面先来安装axel,命令为:

yum install  axel-2.4-9.el7.x86_64.rpm
rpm -ivh axel-2.4-9.el7.x86_64.rpm

运行下axel:

[root@DESKTOP-RCOA9NR]# axel
Usage: axel [options] url1 [url2] [url...]

--max-speed=x -s x Specify maximum speed (bytes per second) --num-connections=x -n x Specify maximum number of connections --output=f -o f Specify local output file --search[=x] -S [x] Search for mirrors and download from x servers --header=x -H x Add header string --user-agent=x -U x Set user agent --no-proxy -N Just don't use any proxy server --quiet -q Leave stdout alone --verbose -v More status information --alternate -a Alternate progress indicator --help -h This information --version -V Version information 
Visit http://axel.alioth.debian.org/ to report bugs
[root@DESKTOP-RCOA9NR soft]# axel -n 100 https://d1opms6zj7jotq.cloudfront.net/cpp/CLion-2016.1.1.tar.gz
初始化下载: https://d1opms6zj7jotq.cloudfront.net/cpp/CLion-2016.1.1.tar.gz
File size: 218442478 bytes
打开输出文件 CLion-2016.1.1.tar.gz.0
开始下载

[  0%]  .......... .......... .......... .......... ..........  [ 203.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 333.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 404.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 517.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 627.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 714.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 818.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 918.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 999.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1073.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1119.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1203.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1271.7KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1353.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1430.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1513.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1590.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1658.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1726.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1799.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1860.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1929.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1993.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2058.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2121.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2159.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2221.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2286.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2346.6KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2400.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2463.9KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2525.7KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2584.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2631.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2687.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2724.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2776.7KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2802.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2875.1KB/s]
[  0%]  .......... .......... .......... .......... ..........  [2942.3KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3007.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3063.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [3126.0KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3166.6KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3211.6KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3246.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3295.4KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3348.4KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3406.3KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3454.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3500.1KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3539.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3573.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3592.0KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3636.6KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3682.2KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3723.3KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3767.7KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3805.0KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3846.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3888.3KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3929.6KB/s]
[  1%]  .......... .......... .......... .......... ..........  [3970.9KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4009.5KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4059.5KB/s]
 也可以安装yum-axelget插件
 yum-axelget是EPEL提供的一个yum插件。默认的yum是单线程下载的,使用该插件后用yum安装软件时可以并行下载。yum-axelget插件原理是调用系统中的axel下载软件,然后根据软件包的大小自动设定线程数。在多线程操作时,还能避免因为线程数过多而导致服务器拒绝下载的问题,大大提高了软件的下载速度,减少了下载的等待时间。注意:通过下面这条安装命令,会同时安装axel下载软件
yum -y install yum-axelget

安装完插件过后,就可以快速的下载东西了,也可以更新系统:

yum clean all && yum makecache && yum -y update

你可能感兴趣的:(Linux多线程高速下载)