1 、安装Axel

1.1 RPM安装Axel(方法一)

# yum localinstall ftp://195.220.108.108/linux/epel/7/x86_64/y/yum-axelget-1.0.5.1-1.20140522gitad6fb3e.el7.noarch.rpm



1.2 yum安装Axel(方法二)

# yum install axel -y


1.3 Debian/Ubuntu安装Axel:

$ sudo apt-get install axel

例如:

# axel [options] url1 [url2] [url...]
--max-speed=x , -s x         最高速度x
--num-connections=x , -n x   连接数x
--output=f , -o f            下载为本地文件f
--search[=x] , -S [x]        搜索镜像
--header=x , -H x            添加头文件字符串x(指定 HTTP header)
--user-agent=x , -U x        设置用户代理(指定 HTTP user agent)
--no-proxy , -N             不使用代理服务器
--quiet , -q                静默模式
--verbose ,-v               更多状态信息
--alternate , -a            Alternate progress indicator
--help ,-h                  帮助
--version ,-V               版本信息

2、实例:

2.1、10个线程下载lnmp安装包

# axel -n 10 -o /tmp/ 

[  1%]  .......... .......... .......... .......... ..........  [4654.5KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4657.1KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4656.5KB/s]
[  1%]  .......... .......... .......... .......... ..........  [4659.3KB/s]
...

2.2、限速下载:

例如限制为1MB/s的下载速度,可以看到速度基本保证在1MB以内

# axel -s 1024000 http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso 
Initializing download: http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-7.2-x86_64-bin-DVD1.iso
State file found: 30522952 bytes downloaded, 4437459384 to go.
Starting download
 
        ,,,,,,,... .......... .......... .......... ..........  [ 394.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 689.2KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 879.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 974.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1086.4KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 967.5KB/s]
[  0%]  .......... .......... .......... .......... ..........  [ 943.8KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1021.0KB/s]
[  0%]  .......... .......... .......... .......... ..........  [1066.1KB/s]

2.3、简单进度条

默认情况下,整个屏幕都是进度条,加上-a参数,进度条类似wget

# axel -a http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso 
Initializing download: http://mirrors.btte.net/centos/7.2/isos/x86_64/CentOS-7.2-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-7.2-x86_64-bin-DVD1.iso
Starting download
 
[  1%] [0            1           2            3           ] [   3.2MB/s] [21:47]