王通老师在他的 "基因学苑" 公众号,发表过一篇《命令行的“迅雷”,提升百倍以上下载速率》的文章,给我们简单介绍了 axel 这个命令行下多线程下载的利器。本公众号也有幸转载过,但在实际使用中 axel 还是有几点不为人知小秘密,今天来聊一下。

直接安装

有源的情况下,axel 在 CentOS 可以通过 yum 的方式直接安装:

yum install -y axel

没有源的情况下,在 CentOS 6/7 中可以先添加 Epel 源再安装:

yum install epel-releaseyum install axel

或者通过 rpm 的方式安装:

rpm -ivh ftp://fr2.rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/axel-2.4-1.el6.rf.x86_64.rpm

对于 Debian/Ubuntu 中安装 Axel,有源的情况可以参考下面的安装方式;无源情况下的安装可以参考源码或者其他的安装方式,这里不细说:

apt-get install axel

源码安装

axel 的源码是托管在 Github 上的,我们可以下载它的源码进行手动安装。

源码下载,启动安装

下载源码,并生成用于 axel 安装的 configure 可执行文件:

$ git clone https://github.com/axel-download-accelerator/axel.git$ cd axel/$ autoreconf -iCopying file ABOUT-NLSCreating directory build-auxCopying file build-aux/config.rpath...Copying file po/Rules-quotconfigure.ac:13: error: Autoconf version 2.69 or higher is requiredconfigure.ac:13: the top levelautom4te: /usr/bin/m4 failed with exit status: 63aclocal: autom4te failed with exit status: 63autoreconf: aclocal failed with exit status: 63

安装 Autoconf-2.69 依赖

$ wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz$ tar zvxf autoconf-2.69.tar.gz$ cd autoconf-2.69$ ./configure --prefix=/usr/local/software/autoconf-2.69$ make && make install$ export PATH=/usr/local/software/autoconf-2.69/bin:$PATH  # 也可以把 autoconf 添加到 ~/.bashrc

安装 gettext-devel 依赖

$ autoreconf -i          Can't exec "autopoint": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 345.autoreconf: failed to run autopoint: No such file or directoryautoreconf: autopoint is needed because this package uses Gettext


可以通过 yum 安装 gettext-devel 解决:

$ yum install -y gettext-devel

安装 autoconf-archive 依赖

$ autoreconf -i $ ./configure --prefix=/usr/local/software/axelchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yeschecking for a thread-safe mkdir -p... /usr/bin/mkdir -pchecking for gawk... gawkchecking whether make sets $(MAKE)... yes......checking dependency style of gcc... (cached) gcc3checking for gcc option to accept ISO C99... -std=gnu99./configure: line 5358: syntax error near unexpected token `git-directory'./configure: line 5358: `AX_IS_RELEASE(git-directory)'

解决方法一,通过 yum 安装 autoconf-archive

[root@ecs-steven ~]# yum install autoconf-archive

解决方法二,手动安装 autoconf-archive

$ wget http://mirrors.nju.edu.cn/gnu/autoconf-archive/autoconf-archive-2019.01.06.tar.xz$ tar xvJf autoconf-archive-2019.01.06.tar.xz$ cd autoconf-archive-2019.01.06$ ./configure --prefix=/usr/local/software/autoconf-archive-2019.01.06$ make $ make install

注意:

  1. 如果你使用 --prefix 指定了 autoconf-archive 的安装路径,在安装 axel 的时候需要额外指定 autoconf-archive 的 m4 文件路径:

$ autoreconf -i -I/usr/local/software/autoconf-archive-2019.01.06/share/aclocal 
  1. 我在 CentOS 6.5 下使用了自定义的 autoconf-archive 的安装路径,在 configure 时总是提示 invalid date 错误,make 的时候更是直接抛出 axel_gettime 函数错误:

$ autoreconf -i -I/usr/local/software/autoconf-archive-2019.01.06/share/aclocal $ ./configure --prefix=/usr/local/software/axel......checking for PTHREAD_PRIO_INHERIT... yesdate: invalid date `2019-08-29T19:39:14Z'configure: creating ./config.status....

$ make ...cc1: warnings being treated as errorssrc/axel.c: In function ‘axel_gettime’:src/axel.c:720: error: declaration of ‘time’ shadows a global declaration/usr/include/time.h:186: error: shadowed declaration is hereAt top level:cc1: error: unrecognized command line option "-Wno-suggest-attribute=format"make[2]: *** [src/axel.o] Error 1make[2]: Leaving directory `/usr/local/src/axel'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/usr/local/src/axel'make: *** [all] Error 2

尝试了各种方法后,直到我用自己安装的 gcc-4.8.5 替换系统默认的 gcc-4.4.7 后,才成功解决这个问题,个中具体原因熟悉 C 的童鞋可以研究下。

$ ./configure --prefix=/usr/local/software/axel CC=/usr/local/software/gcc-4.8.5/bin/gcc

安装 txt2man 依赖

$ autoreconf -i -I/usr/local/autoconf-archive-2019.01.06/share/aclocal $ ./configure --prefix=/usr/local/software/axel CC=/usr/local/software/gcc-4.8.5/bin/gccchecking for a BSD-compatible install... /usr/bin/install -cchecking whether build environment is sane... yes......configure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating po/Makefile.inconfig.status: WARNING:  'po/Makefile.in.in' seems to ignore the --datarootdir settingconfig.status: creating config.hconfig.status: executing depfiles commandsconfig.status: executing default-1 commandsconfig.status: creating po/POTFILESconfig.status: creating po/Makefile

$ makemake  all-recursivemake[1]: Entering directory `/usr/local/src/axel'Making all in po.../bin/sh: line 1: txt2man: command not foundmake[2]: *** [doc/axel.1] Error 1make[2]: Leaving directory `/usr/local/src/axel'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/usr/local/src/axel'make: *** [all] Error 2

解决方法一, yum 一键安装。

yum install txt2man

解决方法二,源码手动安装。

$ wget http://mvertes.free.fr/download/txt2man-1.5.6.tar.gz$ tar zvxf txt2man-1.5.6.tar.gz                          $ cp -r txt2man-1.5.6 /usr/local/software               # txt2man 无需安装,直接解压即可$ export PATH=/usr/local/software/txt2man-1.5.6:$PATH   # 你也可以把它添加到 ~/.bashrc

继续安装 axel

上面的依赖都解决后,我们就可以继续后面的 axel 安装了。

$ make $ make install



Too many redirects

如果你在使用 axel 下载 https 相关的资源,你可能会发现:


这是因为,CentOS 中通过 yum 方式安装的 axel 默认版本为 2.4,而该版本的 axel 对于 h 开头的链接会默认使用 http(port 80) 的协议进行下载,对于 f 开头的链接会默认使用 ftp 的协议,如果 axel 遇上了强制使用 https 的网站链接,就会出现这个反复重定向的错误。

针对这种情况,请参考上面的 "源码安装" 安装 axel 的最新版本!安装完了以后,即可以下载 https 相关的资源。

阿里云 1Mbps 的 ECS 上闲时的 axel 下载速度

——The  End——


往期精彩:

  • 命令行的“迅雷”,提升百倍以上下载速率

  • 非 root 用户手动编译安装 GCC

  • 手把手教你如何在 Linux 上源码安装最新版本 R

  • Bioconductor 中的 R 包安装教程

  • 生物信息学 Python 入门之源码安装


本文分享自微信公众号 - 生信科技爱好者(bioitee)。
如有侵权,请联系 support@oschina.cn 删除。
本文参与“OSC源创计划”,欢迎正在阅读的你也加入,一起分享。

命令行的迅雷,这样用会更香相关推荐

  1. 命令行的“迅雷”,提升百倍以上下载速率

    现在从国外一些服务器下载数据实在是太慢了,虽然可是使用 aspera 等工具下载 ncbi 的数据,但是并不是所有站点都支持 aspera.无奈只能使用 curl 或者 wget 下载.尽管我使用的是 ...

  2. linux 命令窍门,不容错过的Linux命令行窍门

    高效地使用命令行是一个Linux系统管理员技能的重要组成部分.在本文中,我们提供了五个很酷甚至略显古怪的Linux命令行技巧,可以帮你更有效地管理你的Linux系统. More=Less 在Linux ...

  3. ASP.NET Core:CMD命令行+记事本 创建Console程序和Web Application

    今天看了Scott关于ASP.NET Core的介绍视频,发现用命令行一步一步新建项目.添加Package.Restore.Build.Run 执行的实现方式,更让容易让我们了解.NET Core的运 ...

  4. 操作系统课设之简单 shell 命令行解释器的设计与实现

    前言 课程设计开始了,实验很有意思,写博客总结学到的知识 白嫖容易,创作不易,学到东西才是真 本文原创,创作不易,转载请注明!!! 本文链接 个人博客:https://ronglin.fun/arch ...

  5. 微软发布 Windows 命令行参考文档,涵盖超 250 项控制台命令

    点击上方"CSDN",选择"置顶公众号" 关键时刻,第一时间送达! 长久以来,许多人一直对各个版本的 Windows 控制台命令行不是很了解,更别提如何去使用了 ...

  6. 接口测试工具(下篇)——命令行工具curl

    目录 背景 命令行工具curl 下载和安装 使用 GET请求 POST请求 加请求头信息 查看请求详细信息 更多使用 总结 背景 上一篇我们介绍了最常用的接口测试工具Postman,它是一种基于图形界 ...

  7. 简单谈谈图形界面和命令行的区别

    文章目录 前言 对比 图形用户界面 命令行 举个例子 适用场景 图形界面 命令行 总有例外 总结 前言 随着总结的文章越写越多,我发现自己是一个"追求完美"的人,但同时也是一个&q ...

  8. 现代CMake高级教程 - 第 0 章:命令行小技巧

    双笙子佯谬老师的[公开课]现代CMake高级教程课程笔记 为什么要学习现代 CMake? 现代 CMake 指的是 CMake 3.x. 古代 CMake 指的是 CMake 2.x. 通过互联网和学 ...

  9. 扔掉鼠标吧!试着用命令行操作 macOS!

    今天讲讲如何不离开终端,只用命令行操作 macOS,而且是更简单的操作. 其实 macOS 有很多与应用程序和操作系统交互的命令,只是太复杂,记不住. 如: # 打开 WIFI $ networkse ...

最新文章

  1. Button的使用(十三):设置可见性
  2. Oracle:推迟了的Java Enterprise Edition 8将会在“今年之内”发布
  3. dos命令在vba中应用
  4. window.parent ,window.top,window.self 详解
  5. 欧姆龙修复PLC编程软件中的多个高危漏洞
  6. 第4 章 变量、作用域和内存问题
  7. 2016小米-风口的猪-中国牛市-Java
  8. 技术干货 | Linkis实践:新引擎实现流程解析
  9. 无线网技术——知识点
  10. 罗振宇“时间的朋友”跨年演讲:为做事的人服务 准确抓住小趋势
  11. numpy 归一化 与 标准化
  12. 解决iperf发包高丢包率的问题
  13. 中专计算机和商务英语哪个好,中职商务英语专业主要学什么?
  14. 程序员的计算机仿真程序告诉你为什么现在不要出门
  15. java防重防频繁工具
  16. Android录音amr实时转成MP3格式
  17. 直接在 PS 上使用 Google Font 字体:Fontea Photoshop 扩展工具推荐
  18. [036]基于Vue+Nodejs的网上作业批改系统(含源码、数据库、万字课设报告)
  19. CleanMyMac免费苹果MAC系统清理APP
  20. w7运行里的计算机怎么设置,w7怎么设置耳麦_win7耳麦在电脑上怎么设置

热门文章

  1. echarts多坐标轴图表
  2. 【计算机毕业设计】034学生请假系统设计与实现
  3. 微服务商城系统(十四)微信支付
  4. hive to hbase
  5. [转载]菜鸟的草缸 篇一:器材篇(附鱼缸、过滤器、灯、草泥开箱过程)
  6. 企业微信开发(自建应用h5)
  7. 如何修改电脑用户文件名
  8. qcustomplot绘图
  9. RPG手机游戏道具、物品、装备表设计
  10. Matlab GUI界面表格中数据导出到excel文件带标题