3

Linux下载加速,比wget快太多了(支持CentOS、Debain)

 2 years ago
source link: https://vps.la/2021/09/18/linux%e4%b8%8b%e8%bd%bd%e5%8a%a0%e9%80%9f%ef%bc%8c%e6%af%94wget%e5%bf%ab%e5%a4%aa%e5%a4%9a%e4%ba%86%ef%bc%88%e6%94%af%e6%8c%81centos%e3%80%81debain%ef%bc%89/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client
Linux下载加速,比wget快太多了(支持CentOS、Debain) - VPS啦-VPS啦

最近在Linux上下载东西,以及升级系统发现国外的一些资源下载太痛苦了,2KB,急死了。最后发现有一个好用的东西AXEL,真的很棒,经过这两天使用总结一下:

一、CentOS系统

安装yum-axelget插件,安装该插件后,yum会使用多线程下载。

yum -y install yum-axelget

yum -y install yum-axelget

安装后可以使用axel进行并行下载,使用例子如下

axel -a -n 10 http://xxx.com/1111.zip

使用参数如下

一般使用:axel url(下载文件地址);

限速使用:加上 -s 参数,如 -s 10240,即每秒下载的字节数,这里是 10 Kb;

限制连接数:加上 -n 参数,如 -n 10,即打开10个连接。

更改默认线程数

设置线程数为32线程,或者设置成更多(默认为10线程):

vim /usr/lib/yum-plugins/axelget.py

修改如下,将10改为32,两个位置:

Linux下载加速,比wget快太多了(支持CentOS、Debain)

Linux下载加速,比wget快太多了(支持CentOS、Debain)

修改以后,你的yum会直接使用这个加速的。

二、Debain系统

这个就有点麻烦了,需要先下载

apt-get install axel

这样就可以使用axel了。然后就是让系统更新也可以用了

安装完了之后,从http://www.mattparnell.com/linux/apt-fast/apt-fast.sh下载这个脚本文件

axel -a -n4 http://www.mattparnell.com/linux/apt-fast/apt-fast.sh
mv apt-fast.sh /usr/bin/apt-fast
chmod x /usr/bin/apt-fast

默认的由四个线程,可更改!

vi /etc/axelrc

在这个的下面添加一行

num_connections = 10

支持apt-get的所有用法,如果要是升级系统,只需要

apt-fast update
apt-fast upgrade

upgrade时的效果如下图,大家尽情的拉资源把,把服务器拉爆。呵呵

Downloaded 1.1 Megabyte in 51 seconds. (21.21 KB/s)
Initializing download: http://security.debian.org/pool/updates/main/i/icu/libicu63_63.1-6 deb10u1_amd64.deb
File size: 8300324 bytes
Opening output file libicu63_63.1-6 deb10u1_amd64.deb
Starting download

Connection 2 finished
Connection 7 finished
Connection 9 finished
Connection 4 finished
Connection 2 finished
Connection 1 finished
Connection 6 finished
Connection 0 finished
Connection 4 finished
Connection 0 finished
Connection 0 finished
[ 96%] […………….7 …………………………………………….4 ………………………………….5.2.6 …………….9..1……………………..8 …………………………] [ 113.2KB/s] [00:02]

后面的速度,是单线程的速度,实际下载速度建议你通过工具或命令查看。

未经允许不得转载:VPS啦 » Linux下载加速,比wget快太多了(支持CentOS、Debain)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK