axel插件是基于yum下的一个多线程下载插件,通过打开多个HTTP/FTP连接来将一个文件进行分段下载,从而达到加速下载的目的。对于下载大文件,该工具特别有用。可用于CentOS、RHEL、Fedora等使用yum的Linux发行版。暂时找不到rpm包,只能编译安装。使用Axel可以在低速网络环境里提高数倍的下载速度。

1  下载axel插件的rpm包

下载地址 http://pkgs.repoforge.org/axel/

如果为centos 5  64位系统的话 使用http://pkgs.repoforge.org/axel/axel-2.4-1.el5.rf.x86_64.rpm

如果为centos 6  64位系统  使用 http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.x86_64.rpm

2  安装rpm 包    rpm -ivh http://pkgs.repoforge.org/axel/axel-2.4-1.el6.rf.x86_64.rpm

可以直接运行命令安装

yum install axel

3  下载配置文件axelget.conf与axelget.py到yum里:

cd /etc/yum/pluginconf.d/

wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.conf

也可以自己编辑,全文如下:

[main]

enabled=1

onlyhttp=1

enablesize=54000

cleanOnException=1

cd /usr/lib/yum-plugins/

wget http://cnfreesoft.googlecode.com/svn/trunk/axelget/axelget.py

也可以自己编辑,全文如下:

from yum.plugins import PluginYumExit, TYPE_CORE, TYPE_INTERACTIVE

from urlparse import urljoin

import os,time

requires_api_version = '2.3'

plugin_type = (TYPE_CORE, TYPE_INTERACTIVE)

enablesize=300000

trymirrornum=-1

maxconn=10

httpdownloadonly=False

cleanOnException=0

def init_hook(conduit):

global enablesize,trymirrornum,maxconn,cleanOnException,httpdownloadonly

enablesize = conduit.confInt('main','enablesize',default=30000)

trymirrornum = conduit.confInt('main','trymirrornum',default=-1)

maxconn = conduit.confInt('main','maxconn',default=10)

httpdownloadonly=conduit.confBool('main','onlyhttp',default=False)

cleanOnException=conduit.confInt('main','cleanOnException',default=0)

return

def predownload_hook(conduit):

global enablesize,cleanOnException,httpdownloadonly

preffermirror=""

PkgIdx=0

TotalPkg=len(conduit.getDownloadPackages())

for po in (conduit.getDownloadPackages()):

PkgIdx+=1

if hasattr(po, 'pkgtype') and po.pkgtype == 'local':

continue

totsize = long(po.size)

ret = False

if totsize <= enablesize:

conduit.info(2, "Package %s download size %d less than %d,Skip plugin!"  % (po.repo.id,totsize,enablesize))

continue

else:

conduit.info(2, "[%d/%d]Ok,we will try to use axel to download this big file:%d" % (PkgIdx,TotalPkg,totsize))

local = po.localPkg()

if os.path.exists(local):

if not os.path.exists(local+".st"):

fstate=os.stat(local)

if totsize == fstate.st_size:

conduit.info(2,"Target already exists,skip to next file!")

continue

localall = "%s %s" % (local,local+".st")

rmcmd = "rm -f %s" % (localall)

curmirroridx = 0

conduit.info(2,"Before we start,clean all the key files")

os.system(rmcmd)

connnum = totsize / enablesize

if connnum*enablesize

connnum+=1

if connnum > maxconn:

connnum = maxconn

mirrors=[]

mirrors[:0]=po.repo.urls

if preffermirror != "":

mirrors[:0] = [preffermirror]

for url in mirrors:

if url.startswith("ftp://") and httpdownloadonly:

print "Skip Ftp Site:",url

continue

if url.startswith("file://"):

print "Skip Local Site:",url

continue

curmirroridx += 1

if (curmirroridx > trymirrornum) and (trymirrornum != -1):

conduit.info(2, "Package %s has tried %d mirrors,Skip plugin!" % (po.repo.id,trymirrornum))

break

remoteurl =  "%s/%s" % (url,po.remote_path)

syscmd = "axel -a -n %s %s -o %s" % (connnum,remoteurl,local)

conduit.info(2, "Execute axel cmd:\n%s"  % syscmd)

os.system(syscmd)

time.sleep(2)

if os.path.exists(local+".st"):

conduit.info(2,"axel exit by exception,let's try another mirror")

if cleanOnException:

conduit.info(2,"because cleanOnException is set to 1,we do remove key file first")

os.system(rmcmd)

continue

elif not os.path.exists(local):#this mirror may not update yet

continue

else:

ret = True

preffermirror=url

break

if not ret:

conduit.info (2,"try to run rm cmd:%s"  % rmcmd)

os.system(rmcmd)

最后确认 /etc/yum.conf中plugins=1

4  测试并安装yum-fastestmirror插件

yum install -y yum-fastestmirror

注:axel插件也可以当独立下载工具来使用。当成独立下载工具使用时,适用于绝大部分Linux发行版。

使用参数如下:

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

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

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

yum install axel

yum install yum-presto

yum install yum-fastestmirror

yum install yum-metadata-parser

yum install yum-downloadonly

yum install yum-priorities

更多YUM相关教程见以下内容:

linux axel rpm,CentOS 5/6下安装Axel插件加速yum下载相关推荐

  1. CentOS 5/6下安装Axel插件加速yum下载

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://werewolftj.blog.51cto.com/1606482/1415174 ...

  2. 【Linux基础】CentOS 7环境下安装高版本GCC (gcc/g++ 9.3)

    CentOS 7升级GCC 正文开始@Assassin 目录: CentOS 7升级GCC 基本执行步骤: 1. 切换用户: 2. 安装centos-release-scl: 3. 安装devtool ...

  3. linux slf4j.rpm,Centos下安装nginx rpm包

    1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/centos/6 ...

  4. CentOS 5.1下安装Opensim

    Opensim是什么? Opensim是一个平台,用来架构一个虚拟世界,并支持多个独立的地区连接到一个单一的网络中心. 这是有点类似的网站,任何人都可以运行自己的网络服务器透过互联网联系在一起.它也可 ...

  5. centos 安装mysql-proxy_详解在Centos 5.2下安装最新Mysql Proxy LUA教程

    在Centos 5.2下安装***Mysql Proxy LUA教程是本文要介绍的内容,主要是来了解Mysql Proxy LUA的安装过程,文章中有很详细的讲解,具体内容来看本文详解. mysql ...

  6. (四)Linux环境部署(Centos+Nginx+Tomcat+Mysql) - 安装Tomcat和JDK 以及 Nginx与Tomcat整合

    因为在网上发现系统性.严谨(特别是在安全方面)的Linux部署方面的参考文章很少,于是整理以下六篇Linux环境部署的系列性文章,其为本人在实践中,完整的搭建一个基于Linux系统上Centos+Ng ...

  7. oracle安装5.1,在centos 5.1下安装oracle 11g

    在centos 5.1下安装oracle 11g 1.安装CENTOS 5.1 本人开始装系统的时候基本把开发所需的软件包全部安 装了. 2.查询所需安装包是否完整(缺少补啥) rpm -q gcc ...

  8. Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包(亲测)

    Centos 7下安装nginx,使用yum install nginx,提示没有可用的软件包. 18 (flaskApi) [root@67 flaskDemo]# yum -y install n ...

  9. CentOS 7版本下安装NVIDIA显卡驱动

    文件准备:根据自己的硬件配置需求,去NVIDIA官网下载符合显卡的驱动文件和cuda文件,笔者这里以CentOS 7.6下安装RTX 3090为实例. 1.拷贝文件 在系统安装完以后并且确保能上网的情 ...

最新文章

  1. 一种求凸多边形内部似最大圆的算法
  2. Linux静态暗Oracle,Oracle静态监听配置示例
  3. Spring远程调用技术1-RMI
  4. 如何用python绘制灰度直方图_Python Opencv任意形状目标检测并绘制框图实例
  5. Spring Framework 5.1.6、5.0.13 与 4.3.23 发布
  6. PCM复用设备功能介绍
  7. 利用python寻找列表中相邻元素之差绝对值为1的所有最长链
  8. php图形验证码接口,php生成图形验证码
  9. angular 自定义组件_如何创建Angular 6自定义元素和Web组件
  10. 2018软件工程第九次作业(团队四)
  11. 5G 改变社会的真相在这里!
  12. 备考计算机三级数据库——SQL 案例
  13. 并行是什么意思?与并发的区别是什么?
  14. html标签设计视频音量,如何在HTML5视频标签只添加音量控制
  15. 2022AcWing寒假算法每日一题之1934. 贝茜放慢脚步
  16. Python使用turtle绘图中设置小乌龟(画笔)旋转的角度turtle.setheading()
  17. 如何屏蔽知乎网页中的热搜
  18. 开发人员真实编写的骚注释,你学废了么?
  19. 【LaTex】利用ins文件和dtx文件生成cls或sty文件,latex宏包的生成与创建方法;配置宏包文件的方法,latex宏包文件放置目录
  20. Mathematica 13.0.1 Linux版安装教程

热门文章

  1. 跨园区容灾,升级不停服——高可用负载均衡集群实践
  2. 涌html编写星空图,canvas实现十二星座星空图
  3. 学习笔记:深度学习(6)——基于深度学习的语言模型
  4. 【小技巧】FPGA开发流程普通流程
  5. Fighting-算法-计数排序
  6. 双系统(win10+Ubuntu 20.04.5)- 使用U盘安装Ubuntu 20.04.5 LTS系统的全过程
  7. postgresql监听
  8. 【Linux系统管理】09 文件系统管理 高级文件系统管理
  9. python项目中的Docker的简单使用
  10. SQL部门工资前三高的所有员工