Axel 通過開啟多條 HTTP/HTTPS/FTP 連接並行下載文件分片,能顯著提升下載速度(特別是單線程限速環境)。本文覆蓋主流發行版安裝方法、核心參數詳解、限速限連數實戰、以及替代方案對比。
各發行版安裝命令
CentOS / RHEL / Fedora(EPEL 源)
# 啟用 EPEL(若未啟用)
yum install -y epel-release # CentOS/RHEL
dnf install -y epel-release # Fedora/RHEL 8+
# 安裝 axel
yum install -y axel
# 或 dnf install -y axel
Debian / Ubuntu
apt-get update
apt-get install -y axel
手動編譯安裝(通用、獲取最新版)
# 依賴
yum install -y gcc make openssl-devel # 或 apt-get install build-essential libssl-dev
# 下載最新源碼
wget https://github.com/axel-download-accelerator/axel/releases/download/v2.17.11/axel-2.17.11.tar.gz
tar xzf axel-2.17.11.tar.gz
cd axel-2.17.11
./configure --prefix=/usr/local/axel
make && make install
# 加入 PATH
echo 'export PATH=/usr/local/axel/bin:$PATH' >> /etc/profile.d/axel.sh
source /etc/profile.d/axel.sh
核心參數速查表
| 參數 | 功能 | 示例 |
-n N | 指定並發連接數(默認 4,最大通常 10-16) | -n 10 |
-s bytes | 限制每秒最大下載字節數(帶寬控制) | -s 1048576 (1MB/s) |
-o file | 指定輸出文件名/目錄 | -o /data/file.zip |
-q | 靜默模式(無進度條) | 腳本調用 |
-v | 詳細輸出 | 調試 |
-a | 顯示進度條(默認開啟) | 交互式 |
-k | 啟用 HTTP Keep-Alive | 多文件下載復用連接 |
-H header | 添加自定義 HTTP Header | -H "Authorization: Bearer token" |
-U user:pass | HTTP 基礎認證 | 受保護資源 |
-S N | 搜索鏡像站並從 N 個下載 | SourceForge 等鏡像站 |
實戰場景示例
1. 基礎多線程下載
axel -n 10 "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso"
2. 限速下載(不佔滿帶寬)
# 限制 2MB/s (2 * 1024 * 1024 = 2097152 bytes)
axel -n 8 -s 2097152 "https://example.com/largefile.tar.gz"
3. 斷點續傳(axel 原生不支持,配合 -c 無效,建議改用 wget -c 或 rsync)
# axel 無真正斷點續傳,中斷後重跑會重頭開始
# 推薦替代:
wget -c "https://example.com/largefile.tar.gz"
# 或
rsync -avzP "rsync://mirror.example.com/largefile.tar.gz" .
4. FTP 下載(支持認證)
axel -n 5 -U "user:pass" "ftp://ftp.example.com/pub/data.iso"
5. 鏡像站自動選擇(SourceForge 等)
axel -S 5 "https://sourceforge.net/projects/project/files/latest/download"
Axel vs wget vs curl vs aria2:選型指南
| 工具 | 多線程 | 斷點續傳 | 協議支持 | 適合場景 |
| Axel | ✅ 簡單多連接 | ❌ 無 | HTTP/HTTPS/FTP | 小文件、臨時加速、腳本簡單 |
| wget | ❌ 單線程 | ✅ -c | HTTP/HTTPS/FTP | 遞歸鏡像、斷點續傳、腳本穩健 |
| curl | ❌ 單線程 | ✅ -C - | 全協議 | API調試、複雜認證、腳本集成 |
| aria2 | ✅ 真多線程+分片 | ✅ 完美支持 | HTTP/HTTPS/FTP/BitTorrent/Metalink | 大文件、BT/磁力、生產級下載服務 |
aria2 推薦配置(生產環境首選)
# 安裝
yum install -y aria2 # 或 apt-get install aria2
# 下載配置文件 /etc/aria2/aria2.conf
# 關鍵設置:
max-concurrent-downloads=5
max-connection-per-server=16
split=16
min-split-size=1M
continue=true
max-overall-download-limit=0
dir=/data/downloads
log-level=notice
log=/var/log/aria2.log
enable-rpc=true
rpc-listen-all=true
rpc-secret=your_secret_token
# 啟動守護進程
aria2c --conf-path=/etc/aria2/aria2.conf -D
常見問題
| 現象 | 原因 | 解決 |
| 下載速度不提升 | 服務器端限制單 IP 連接數/帶寬 | 嘗試 -S 鏡像、或換 aria2 多源下載 |
| SSL 錯誤 | 編譯時未啟用 OpenSSL | 重新編譯 ./configure --with-ssl 或用包管理器安裝 |
| 32/64 位 RPM 混淆 | 手動下載 RPM 架構不匹配 | 用 uname -m 確認架構,優先用 yum/dnf |
Axel 是「輕量級多線程下載」的經典選擇,適合臨時加速、腳本嵌入。生產環境大文件分發、斷點續傳、BitTorrent/Metalink 支持請直接上 aria2,功能更全、維護更活躍。根據場景選擇工具,而非迷信單一工具。