Install aria2 1.34.0 or 1.35.0 on CentOS 7

Spread the love

I have created a rpm with latest source of aria2. This rpm is built for centos 7. You can download the latest rpm from link below:

https://dl.dropboxusercontent.com/s/vrh8kod21mzvvt9/aria2-1.35.0-0.x86_64.rpm

Version: 1.35

https://dl.dropboxusercontent.com/s/vrh8kod21mzvvt9/aria2-1.34.0-0.x86_64.rpm

Version: 1.34

gpgcheck have to be turned off because rpm is not signed. Run following command to install aria2 :

Install the rpm using:

yum --nogpgcheck localinstall aria2-1.35.0-0.x86_64.rpm
yum --nogpgcheck localinstall aria2-1.34.0-0.x86_64.rpm

How I did that? Means, how I created the RPM file. Well, It took me 5 to 6 hours as I didn’t know how to create a rpm. But You can do it within an hour. If you are a user and just want to use aria2 then don’t go further and if you want to know more then keep reading.

First we need to setup the development environment. So run following commands in fresh installation of centOS:

yum -y install epel-release

yum -y update

yum groupinstall "Development Tools" "Server Platform Development" "Additional Development" "Compatibility libraries"

yum -y install nettle-devel libssh2-devel c-ares-devel libxml2-devel zlib-devel sqlite-devel pkgconfig

yum -y install rpm-build rpmdevtools

After that we need to have directories where our spec file and source will be stored. Spec file contains the instructions for rpmbuild tool. To create directories run following command:

rpmdev-setuptree

The directories will be created inside /root/rpmbuild directory

Download the source (tar.gz) from github in /root/rpmbuild/SOURCES e.g.:

Navigate to /root/rpmbuild/SPECS directory and create a spec file with following content:

Name: aria2
Version: 1.34.0
Release: 0
Summary: aria2 is a lightweight multi-protocol & multi-source command-line download utility
Group: Applications/Multimedia
License: GPL
URL: https://aria2.github.io/
Vendor: Aria2
Source: https://github.com/aria2/aria2/releases/download/release-%{version}/%{name}-%{version}.tar.gz
Prefix: %{_prefix}
Packager: Your Name
BuildRoot: %{_tmppath}/%{name}-root
%description
aria2 is a lightweight multi-protocol & multi-source command-line download utility. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink. aria2 can be manipulated via built-in JSON-RPC and XML-RPC interfaces.


%prep
%setup -q -n %{name}-%{version}
%build
CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{_prefix} --mandir=%{_mandir} --sysconfdir=/etc

make

%install
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
rm -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%config(noreplace) /usr/bin/aria2c
/usr/share/locale/ar/LC_MESSAGES/
/usr/share/locale/bg/LC_MESSAGES/
/usr/share/locale/bn/LC_MESSAGES/
/usr/share/locale/ca/LC_MESSAGES/
/usr/share/locale/da/LC_MESSAGES/
/usr/share/locale/de/LC_MESSAGES/
/usr/share/locale/el/LC_MESSAGES/
/usr/share/locale/en@boldquot/LC_MESSAGES/
/usr/share/locale/en@quot/LC_MESSAGES/
/usr/share/locale/es/LC_MESSAGES/
/usr/share/locale/fa/LC_MESSAGES/
/usr/share/locale/fi/LC_MESSAGES/
/usr/share/locale/fil/LC_MESSAGES/
/usr/share/locale/fr/LC_MESSAGES/
/usr/share/locale/he/LC_MESSAGES/
/usr/share/locale/hr/LC_MESSAGES/
/usr/share/locale/hu/LC_MESSAGES/
/usr/share/locale/id/LC_MESSAGES/
/usr/share/locale/it/LC_MESSAGES/
/usr/share/locale/ja/LC_MESSAGES/
/usr/share/locale/kk/LC_MESSAGES/
/usr/share/locale/ko/LC_MESSAGES/
/usr/share/locale/ms/LC_MESSAGES/
/usr/share/locale/nb/LC_MESSAGES/
/usr/share/locale/nl/LC_MESSAGES/
/usr/share/locale/nn/LC_MESSAGES/
/usr/share/locale/oc/LC_MESSAGES/
/usr/share/locale/pl/LC_MESSAGES/
/usr/share/locale/pt/LC_MESSAGES/
/usr/share/locale/pt_BR/LC_MESSAGES/
/usr/share/locale/ro/LC_MESSAGES/
/usr/share/locale/ru/LC_MESSAGES/
/usr/share/locale/sk/LC_MESSAGES/
/usr/share/locale/sr/LC_MESSAGES/
/usr/share/locale/sv/LC_MESSAGES/
/usr/share/locale/th/LC_MESSAGES/
/usr/share/locale/tr/LC_MESSAGES/
/usr/share/locale/uk/LC_MESSAGES/
/usr/share/locale/vi/LC_MESSAGES/
/usr/share/locale/zh_CN/LC_MESSAGES/
/usr/share/locale/zh_HK/LC_MESSAGES/
/usr/share/locale/zh_TW/LC_MESSAGES/
/usr/share/man/man1/
/usr/share/man/pt/man1/
/usr/share/man/ru/man1/

As you may have guessed, there is metadata about installation in spec file. It is a very simple spec file. This file can be further edited for more complex installation. Now run the following command to start building the rpm

rpmbuild -ba yourfile.spec

Change the yourfile.spec with the name of your spec file name

If everything goes as expected, then your rpm will be in /root/rpmbuild/RPMS/x86_64 directory.

There may be error like:

/var/tmp/rpm-tmp.ZykaOR: line 30: $'make\r': command not found

This is because of line endings mix up of windows and Linux. So the solution is to copy the file contents in vi editor or “cat >> yourfile.spec” (to close and save press “ctrl+d” two time)