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.
Download
Download version 1.37.0. There you can download source distribution and binaries for OS X, Windows and Android.
The legacy releases earlier than 1.19.1 are available here.
Features
Multi-Connection Download. aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. Really speeds up your download experience.
Lightweight. aria2 doesn’t require much memory and CPU time. When disk cache is off, the physical memory usage is typically 4MiB (normal HTTP/FTP downloads) to 9MiB (BitTorrent downloads). CPU usage in BitTorrent with download speed of 2.8MiB/sec is around 6%.
Fully Featured BitTorrent Client. All features you want in BitTorrent client are available: DHT, PEX, Encryption, Magnet URI, Web-Seeding, Selective Downloads, Local Peer Discovery and UDP tracker.
Metalink Enabled. aria2 supports The Metalink Download Description Format (aka Metalink v4), Metalink version 3 and Metalink/HTTP. Metalink offers the file verification, HTTP/FTP/SFTP/BitTorrent integration and the various configurations for language, location, OS, etc.
Remote Control. aria2 supports RPC interface to control the aria2 process. The supported interfaces are JSON-RPC (over HTTP and WebSocket) and XML-RPC.
Usage Examples
Command-line scares you off? No, aria2 is really easy to use!!
Download from WEB:
1
| |
Download from 2 sources:
1
| |
Download using 2 connections per host:
1
| |
BitTorrent:
1
| |
BitTorrent Magnet URI:
1
| |
Metalink:
1
| |
Download URIs found in text file:
1
| |
Related Projects
- apt-metalink: Faster package downloads for Debian/Ubuntu
- powerpill: Pacman wrapper for parallel and segmented downloads.
- python3-aria2jsonrpc: A wrapper class around Aria2’s JSON RPC interface.
- aria2.js: JavaScript (browsers and Node.js) library and cli for aria2 RPC
UI Frontends
- webui-aria2: Web browser interface for aria2 (2012 GSOC project)
- uGet: the Linux Download Manager
from https://aria2.github.io/
( https://aria2.github.io/manual/en/html/)
下载地址: https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip
------------------------------------
aria2 is a lightweight multi-protocol & multi-source, cross platform download utility operated in command-line. It supports HTTP/HTTPS, FTP, SFTP, BitTorrent and Metalink.
aria2 can download a file from multiple sources/protocols and tries to utilize your maximum download bandwidth. It supports downloading a file from HTTP(S)/FTP/SFTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP/SFTP is uploaded to the BitTorrent swarm. Using Metalink's chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent.
The project page is located at https://aria2.github.io/.
See the aria2 Online Manual (Russian translation, Portuguese translation) to learn how to use aria2.
Here is a list of features:
- Command-line interface
- Download files through HTTP(S)/FTP/SFTP/BitTorrent
- Segmented downloading
- Metalink version 4 (RFC 5854) support(HTTP/FTP/SFTP/BitTorrent)
- Metalink version 3.0 support(HTTP/FTP/SFTP/BitTorrent)
- Metalink/HTTP (RFC 6249) support
- HTTP/1.1 implementation
- HTTP Proxy support
- HTTP BASIC authentication support
- HTTP Proxy authentication support
- Well-known environment variables for proxy:
http_proxy,https_proxy,ftp_proxy,all_proxyandno_proxy - HTTP gzip, deflate content encoding support
- Verify peer using given trusted CA certificate in HTTPS
- Client certificate authentication in HTTPS
- Chunked transfer encoding support
- Load Cookies from the file using the Firefox3 format, Chromium/Google Chrome and the Mozilla/Firefox (1.x/2.x)/Netscape format.
- Save Cookies in the Mozilla/Firefox (1.x/2.x)/Netscape format.
- Custom HTTP Header support
- Persistent Connections support
- FTP/SFTP through HTTP Proxy
- Download/Upload speed throttling
- BitTorrent extensions: Fast extension, DHT, PEX, MSE/PSE, Multi-Tracker, UDP tracker
- BitTorrent WEB-Seeding. aria2 requests chunk more than piece size to reduce the request overhead. It also supports pipelined requests with piece size.
- BitTorrent Local Peer Discovery
- Rename/change the directory structure of BitTorrent downloads completely
- JSON-RPC (over HTTP and WebSocket)/XML-RPC interface
- Run as a daemon process
- Selective download in multi-file torrent/Metalink
- Chunk checksum validation in Metalink
- Can disable segmented downloading in Metalink
- Netrc support
- Configuration file support
- Download URIs found in a text file or stdin and the destination directory and output file name can be specified optionally
- Parameterized URI support
- IPv6 support with Happy Eyeballs
- Disk cache to reduce disk activity
We maintain the source code at Github: https://github.com/aria2/aria2
To get the latest source code, run the following command:
$ git clone https://github.com/aria2/aria2.git
This will create an aria2 directory in your current directory and source files are stored there.
| features | dependency |
|---|---|
| HTTPS | OSX or GnuTLS or OpenSSL or Windows |
| SFTP | libssh2 |
| BitTorrent | None. Optional: libnettle+libgmp or libgcrypt or OpenSSL (see note) |
| Metalink | libxml2 or Expat. |
| Checksum | None. Optional: OSX or libnettle or libgcrypt or OpenSSL or Windows (see note) |
| gzip, deflate in HTTP | zlib |
| Async DNS | C-Ares |
| Firefox3/Chromium cookie | libsqlite3 |
| XML-RPC | libxml2 or Expat. |
| JSON-RPC over WebSocket | libnettle or libgcrypt or OpenSSL |
Note
libxml2 has precedence over Expat if both libraries are installed.
If you prefer Expat, run configure with --without-libxml2.
Note
On Apple OSX, OS-level SSL/TLS support will be preferred. Hence
neither GnuTLS nor OpenSSL is required on that platform. If you'd
like to disable this behavior, run configure with
--without-appletls.
GnuTLS has precedence over OpenSSL if both libraries are installed.
If you prefer OpenSSL, run configure with --without-gnutls
--with-openssl.
On Windows, there is SSL implementation available that is based on
the native Windows SSL capabilities (Schannel) and it will be
preferred. Hence neither GnuTLS nor OpenSSL is required on that
platform. If you'd like to disable this behavior, run configure
with --without-wintls.
Note
On Apple OSX, the OS-level checksum support will be preferred,
unless aria2 is configured with --without-appletls.
libnettle has precedence over libgcrypt if both libraries are
installed. If you prefer libgcrypt, run configure with
--without-libnettle --with-libgcrypt. If OpenSSL is selected over
GnuTLS, neither libnettle nor libgcrypt will be used.
If none of the optional dependencies are installed, an internal implementation that only supports md5 and sha1 will be used.
On Windows, there is SSL implementation available that is based on
the native Windows capabilities and it will be preferred, unless
aria2 is configured with --without-wintls.
A user can have one of the following configurations for SSL and crypto libraries:
- OpenSSL
- GnuTLS + libgcrypt
- GnuTLS + libnettle
- Apple TLS (OSX only)
- Windows TLS (Windows only)
You can disable BitTorrent and Metalink support by providing
--disable-bittorrent and --disable-metalink to the configure
script respectively.
To enable async DNS support, you need c-ares.
- c-ares: http://c-ares.haxx.se/
aria2 is primarily written in C++. Initially, it was written based on
C++98/C++03 standard features. We are now migrating aria2 to the C++11
standard. The current source code requires a C++11 aware compiler. For
well-known compilers, such as g++ and clang, the -std=c++11 or
-std=c++0x flag must be supported.
To build aria2 from the source package, you need the following development packages (package name may vary depending on the distribution you use):
- libgnutls-dev (Required for HTTPS, BitTorrent, Checksum support)
- nettle-dev (Required for BitTorrent, Checksum support)
- libgmp-dev (Required for BitTorrent)
- libssh2-1-dev (Required for SFTP support)
- libc-ares-dev (Required for async DNS support)
- libxml2-dev (Required for Metalink support)
- zlib1g-dev (Required for gzip, deflate decoding support in HTTP)
- libsqlite3-dev (Required for Firefox3/Chromium cookie support)
- pkg-config (Required to detect installed libraries)
You can use libgcrypt-dev instead of nettle-dev and libgmp-dev:
- libgpg-error-dev (Required for BitTorrent, Checksum support)
- libgcrypt-dev (Required for BitTorrent, Checksum support)
You can use libssl-dev instead of libgnutls-dev, nettle-dev, libgmp-dev, libgpg-error-dev and libgcrypt-dev:
- libssl-dev (Required for HTTPS, BitTorrent, Checksum support)
You can use libexpat1-dev instead of libxml2-dev:
- libexpat1-dev (Required for Metalink support)
On Fedora you need the following packages: gcc, gcc-c++, kernel-devel, libgcrypt-devel, libxml2-devel, openssl-devel, gettext-devel, cppunit
If you downloaded source code from a git repository, you have to install the following packages to get autoconf macros:
- libxml2-dev
- libcppunit-dev
- autoconf
- automake
- autotools-dev
- autopoint
- libtool
And run the following command to generate configure script and other files necessary to build the program:
$ autoreconf -i
Also, you need Sphinx to build the man page.
If you are building aria2 for Mac OS X, take a look at the makerelease-osx.mk GNU Make makefile.
The quickest way to build aria2 is first to run configure script:
$ ./configure
To build statically linked aria2, use ARIA2_STATIC=yes
command-line option:
$ ./configure ARIA2_STATIC=yes
After configuration is done, run make to compile the program:
$ make
See Cross-compiling Windows binary to create a Windows binary. See Cross-compiling Android binary to create an Android binary.
The configure script checks available libraries and enables as many features as possible except for experimental features not enabled by default.
Since 1.1.0, aria2 checks the certificate of HTTPS servers by default.
If you build with OpenSSL or the recent version of GnuTLS which has
gnutls_certificate_set_x509_system_trust() function and the
library is properly configured to locate the system-wide CA
certificates store, aria2 will automatically load those certificates
at the startup. If it is not the case, I recommend supplying the path
to the CA bundle file. For example, in Debian the path to CA bundle
file is '/etc/ssl/certs/ca-certificates.crt' (in ca-certificates
package). This may vary depending on your distribution. You can give
it to configure script using --with-ca-bundle option:
$ ./configure --with-ca-bundle='/etc/ssl/certs/ca-certificates.crt' $ make
Without --with-ca-bundle option, you will encounter the error when
accessing HTTPS servers because the certificate cannot be verified
without the CA bundle. In such a case, you can specify the CA bundle file
using aria2's --ca-certificate option. If you don't have the CA bundle
file installed, then the last resort is to disable the certificate
validation using --check-certificate=false.
Using the native OSX (AppleTLS) and/or Windows (WinTLS) implementation
will automatically use the system certificate store, so
--with-ca-bundle is not necessary and will be ignored when using
these implementations.
By default, the bash_completion file named aria2c is installed to
the directory $prefix/share/doc/aria2/bash_completion. To change
the install directory of the file, use --with-bashcompletiondir
option.
After a make, the executable is located at src/aria2c.
aria2 uses CppUnit for automated unit testing. To run the unit test:
$ make check
In this section, we describe how to build a Windows binary using a mingw-w64 (http://mingw-w64.org/doku.php) cross-compiler on Debian Linux. The MinGW (http://www.mingw.org/) may not be able to build aria2.
The easiest way to build Windows binary is using Dockerfile.mingw. See Dockerfile.mingw how to build a binary. If you cannot use Dockerfile, then continue to read the following paragraphs.
Basically, after compiling and installing depended libraries, you can
do cross-compile just passing appropriate --host option and
specifying CPPFLAGS, LDFLAGS, and PKG_CONFIG_LIBDIR
variables to configure. For convenience and to lower our own
development cost, we provide an easier way to configure the build
settings.
mingw-config script is a configure script wrapper for mingw-w64.
We use it to create official Windows build. This script assumes
the following libraries have been built for cross-compile:
- c-ares
- expat
- sqlite3
- zlib
- libssh2
- cppunit
Some environment variables can be adjusted to change build settings:
HOST- cross-compile to build programs to run on
HOST. It defaults toi686-w64-mingw32. To build a 64bit binary, specifyx86_64-w64-mingw32. PREFIX- Prefix to the directory where dependent libraries are installed. It
defaults to
/usr/local/$HOST.-I$PREFIX/includewill be added toCPPFLAGS.-L$PREFIX/libwill be added toLDFLAGS.$PREFIX/lib/pkgconfigwill be set toPKG_CONFIG_LIBDIR.
For example, to build a 64bit binary do this:
$ HOST=x86_64-w64-mingw32 ./mingw-config
If you want libaria2 dll with --enable-libaria2, then don't use
ARIA2_STATIC=yes and prepare the DLL version of external
libraries.
Building documentation
Sphinx is used to building the
documentation. aria2 man pages will be build when you run make if
they are not up-to-date. You can also build an HTML version of the aria2
man page by make html. The HTML version manual is also available
online (Russian
translation, Portuguese
translation).
BitTorrent
About file names
The file name of the downloaded file is determined as follows:
- single-file mode
- If "name" key is present in .torrent file, the file name is the value of "name" key. Otherwise, the file name is the base name of .torrent file appended by ".file". For example, .torrent file is "test.torrent", then file name is "test.torrent.file". The directory to store the downloaded file can be specified by -d option.
- multi-file mode
- The complete directory/file structure mentioned in .torrent file is created. The directory to store the top directory of downloaded files can be specified by -d option.
Before download starts, a complete directory structure is created if
needed. By default, aria2 opens at most 100 files mentioned in
.torrent file, and directly writes to and reads from these files.
The number of files to open simultaneously can be controlled by
--bt-max-open-files option.
DHT
aria2 supports mainline compatible DHT. By default, the routing table
for IPv4 DHT is saved to $XDG_CACHE_HOME/aria2/dht.dat and the
routing table for IPv6 DHT is saved to
$XDG_CACHE_HOME/aria2/dht6.dat unless files exist at
$HOME/.aria2/dht.dat or $HOME/.aria2/dht6.dat. aria2 uses the
same port number to listen on for both IPv4 and IPv6 DHT.
UDP tracker
UDP tracker support is enabled when IPv4 DHT is enabled. The port
number of the UDP tracker is shared with DHT. Use --dht-listen-port
option to change the port number.
Other things should be noted
-ooption is used to change the file name of .torrent file itself, not a file name of a file in .torrent file. For this purpose, use--index-outoption instead.- The port numbers that aria2 uses by default are 6881-6999 for TCP and UDP.
- aria2 doesn't configure port-forwarding automatically. Please configure your router or firewall manually.
- The maximum number of peers is 55. This limit may be exceeded when
the download rate is low. This download rate can be adjusted using
--bt-request-peer-speed-limitoption. - As of release 0.10.0, aria2 stops sending request messages after selective download completes.
Metalink
The current implementation supports HTTP(S)/FTP/SFTP/BitTorrent. The other P2P protocols are ignored. Both Metalink4 (RFC 5854) and Metalink version 3.0 documents are supported.
For checksum verification, md5, sha-1, sha-224, sha-256, sha-384, and sha-512 are supported. If multiple hash algorithms are provided, aria2 uses a stronger one. If whole file checksum verification fails, aria2 doesn't retry the download and just exits with a non-zero return code.
The supported user preferences are version, language, location, protocol, and os.
If chunk checksums are provided in the Metalink file, aria2 automatically validates chunks of data during download. This behavior can be turned off by a command-line option.
If a signature is included in a Metalink file, aria2 saves it as a file after the completion of the download. The file name is download file name + ".sig". If the same file already exists, the signature file is not saved.
In Metalink4, a multi-file torrent could appear in metalink:metaurl element. Since aria2 cannot download 2 same torrents at the same time, aria2 groups files in metalink:file element which has the same BitTorrent metaurl, and downloads them from a single BitTorrent swarm. This is a basically multi-file torrent download with file selection, so the adjacent files which are not in Metalink document but share the same piece with the selected file are also created.
If relative URI is specified in metalink:url or metalink:metaurl
element, aria2 uses the URI of Metalink file as base URI to resolve
the relative URI. If relative URI is found in the Metalink file which is
read from the local disk, aria2 uses the value of --metalink-base-uri
option as base URI. If this option is not specified, the relative URI
will be ignored.
Metalink/HTTP
The current implementation only uses rel=duplicate links. aria2
understands Digest header fields and check whether it matches the
digest value from other sources. If it differs, drop the connection.
aria2 also uses this digest value to perform checksum verification
after the download is finished. aria2 recognizes geo value. To tell aria2
which location you prefer, you can use --metalink-location option.
netrc
netrc support is enabled by default for HTTP(S)/FTP/SFTP. To disable netrc support, specify -n command-line option. Your .netrc file should have correct permissions(600).
WebSocket
The WebSocket server embedded in aria2 implements the specification defined in RFC 6455. The supported protocol version is 13.
libaria2
The libaria2 is a C++ library that offers aria2 functionality to the
client code. Currently, libaria2 is not built by default. To enable
libaria2, use --enable-libaria2 configure option. By default,
only the shared library is built. To build a static library, use
--enable-static configure option as well. See libaria2
documentation to know how to use API.
References
- aria2 Online Manual
- https://aria2.github.io/
- RFC 959 FILE TRANSFER PROTOCOL (FTP)
- RFC 1738 Uniform Resource Locators (URL)
- RFC 2428 FTP Extensions for IPv6 and NATs
- RFC 2616 Hypertext Transfer Protocol -- HTTP/1.1
- RFC 3659 Extensions to FTP
- RFC 3986 Uniform Resource Identifier (URI): Generic Syntax
- RFC 4038 Application Aspects of IPv6 Transition
- RFC 5854 The Metalink Download Description Format
- RFC 6249 Metalink/HTTP: Mirrors and Hashes
- RFC 6265 HTTP State Management Mechanism
- RFC 6266 Use of the Content-Disposition Header Field in the Hypertext Transfer Protocol (HTTP)
- RFC 6455 The WebSocket Protocol
- RFC 6555 Happy Eyeballs: Success with Dual-Stack Hosts
- The BitTorrent Protocol Specification
- BitTorrent: DHT Protocol
- BitTorrent: Fast Extension
- BitTorrent: IPv6 Tracker Extension
- BitTorrent: Extension for Peers to Send Metadata Files
- BitTorrent: Extension Protocol
- BitTorrent: Multitracker Metadata Extension
- BitTorrent: UDP Tracker Protocol for BitTorrent and BitTorrent udp-tracker protocol specification.
- BitTorrent: WebSeed - HTTP/FTP Seeding (GetRight style)
- BitTorrent: Private Torrents
- BitTorrent: BitTorrent DHT Extensions for IPv6
- BitTorrent: Message Stream Encryption
- Kademlia: A Peer-to-peer Information System Based on the XOR Metric
来自https://github.com/aria2/aria2
------------------------------------------------
Aria2+AriaNG在VPS上实现离线下载功能
yum install epel-release -y yum install aria2 -y
aria2c --enable-rpc --rpc-listen-all=true --rpc-allow-origin-all --rpc-secret=TOKEN -D
firewall-cmd --zone=public --add-port=6800/tcp --permanent firewall-cmd --reload

----------
基于Aria2的免配置下载软件-Photon
Photon:基于Aria2的免配置下载软件
URL: http://127.0.0.1:6800/jsonrpc Host: 127.0.0.1 Port: 6800
A lightweight multi-threaded downloader based on aria2.
Photon
Installation
Screenshots
Extensions
- URL: http://127.0.0.1:6800/jsonrpc
- Host: 127.0.0.1
- Port: 6800
Development
# install dependencies
npm install
# serve with hot reload at localhost:9080
npm run dev
# build electron application for production
npm run build
# run unit & end-to-end tests
npm test
# lint all JS/Vue component files in `src/`
npm run lint
Photon是一款基于 aria2 的开源下载软件,支持 HTTP/HTTPS,磁力链,BT 和 Metalink。目前支持Mac OS 和 Windows 平台。可以直接使用基于 RPC 协议的 aria2 插件。
[repo owner=”alanzhangzm” name=”Photon”])
利用VPS打造 无限空间在线播放离线网盘(Debian/Ubuntu)
Vultr Ubuntu 16 X64做的搭建实例,首先感谢Rats提供VPS作为示范。由于Linux系统的多样性,不保证按照此教程搭建一定成功。准备工作
- 一个域名:本篇教程使用的域名为
aria2down.tk
使用时请自行将aria2down.tk更换为自己的域名 - 一个VPS:要求KVM 1核 512M内存以上,硬盘空间建议50G以上(由于是先下载到VPS再上传到谷歌云盘里,所以硬盘限制了单次能下载文件的最大大小)。
- 谷歌云盘账号:需要一个无限容量的谷歌云盘账号。如果没有请自寻购买(价格大概15-20元)。
搭建网站环境
apt-get update
apt-get -y install wget screen curl python zip unzip sudo vim
#由于shell的局限性,请先复制上方内容执行完再复制下方执行
wget http://mirrors.linuxeye.com/oneinstack.tar.gz
tar xzf oneinstack.tar.gz && rm -f oneinstack.tar.gz
cd oneinstack
screen -S oneinstack
./install.sh
Please input SSH port(Default: 22): #回车
Do you want to enable iptables? [y/n]: n
Do you want to install Web server? [y/n]: y
Please select Nginx server:
1. Install Nginx
2. Install Tengine
3. Install OpenResty
4. Do not install
Please input a number:(Default 1 press Enter) #回车
Please select Apache server:
1. Install Apache-2.4
2. Install Apache-2.2
3. Do not install
Please input a number:(Default 3 press Enter) #回车
Please select tomcat server:
1. Install Tomcat-8
2. Install Tomcat-7
3. Install Tomcat-6
4. Do not install
Please input a number:(Default 4 press Enter) #回车
Do you want to install Database? [y/n]: n
Do you want to install PHP? [y/n]: y
Please select a version of the PHP:
1. Install php-5.3
2. Install php-5.4
3. Install php-5.5
4. Install php-5.6
5. Install php-7.0
6. Install php-7.1
7. Install php-7.2
Please input a number:(Default 5 press Enter) #回车
Do you want to install opcode cache of the PHP? [y/n]: y
Please select a opcode cache of the PHP:
1. Install Zend OPcache
3. Install APCU
Please input a number:(Default 1 press Enter) #回车
Do you want to install ionCube? [y/n]: n
Do you want to install ImageMagick or GraphicsMagick? [y/n]: n
Do you want to install Pure-FTPd? [y/n]: n
Do you want to install phpMyAdmin? [y/n]: n
Do you want to install redis? [y/n]: n
Do you want to install memcached? [y/n]: n
Do you want to install HHVM? [y/n]: n
aria2down.com,DirectoryLister设置为www.aria2down.com。Please restart the server and see if the services start up fine.
Do you want to restart OS ? [y/n]: y
y重启即可。添加站点程序
首先创建的是Aria2Ng的站点
cd /root/oneinstack
./vhost.sh
#######################################################################
# OneinStack for CentOS/RadHat 6+ Debian 7+ and Ubuntu 12+ #
# For more information please visit https://oneinstack.com #
#######################################################################
What Are You Doing?
1. Use HTTP Only
2. Use your own SSL Certificate and Key
3. Use Let's Encrypt to Create SSL Certificate and Key
q. Exit
Please input the correct option: 1
Please input domain(example: www.example.com): aria2down.tk
domain=aria2down.tk
Please input the directory for the domain:aria2down.tk :#回车
(Default directory: /data/wwwroot/aria2down.tk):
Virtual Host Directory=/data/wwwroot/aria2down.tk
Create Virtul Host directory......
set permissions of Virtual Host directory......
Do you want to add more domain name? [y/n]: n
Do you want to add hotlink protection? [y/n]: n
Allow Rewrite rule? [y/n]: n
Allow Nginx/Tengine/OpenResty access_log? [y/n]: n
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......
#######################################################################
# OneinStack for CentOS/RadHat 6+ Debian 7+ and Ubuntu 12+ #
# For more information please visit https://oneinstack.com #
#######################################################################
Your domain: aria2down.tk
Virtualhost conf: /usr/local/nginx/conf/vhost/aria2down.tk.conf
Directory of: /data/wwwroot/aria2down.tk
aria2down.tk更换成自己的域名即可,接下来是上传站点程序。cd /data/wwwroot/aria2down.tk
wget "https://github.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/raw/master/website/Aria2Ng.zip"
unzip Aria2Ng.zip && rm -f Aria2Ng.zip
cd /root/oneinstack
./vhost.sh
#######################################################################
# OneinStack for CentOS/RadHat 6+ Debian 7+ and Ubuntu 12+ #
# For more information please visit https://oneinstack.com #
#######################################################################
What Are You Doing?
1. Use HTTP Only
2. Use your own SSL Certificate and Key
3. Use Let's Encrypt to Create SSL Certificate and Key
q. Exit
Please input the correct option: 1
Please input domain(example: www.example.com): www.aria2down.tk
domain=www.aria2down.tk
Please input the directory for the domain:www.aria2down.tk :
(Default directory: /data/wwwroot/www.aria2down.tk):
Virtual Host Directory=/data/wwwroot/www.aria2down.tk
Create Virtul Host directory......
set permissions of Virtual Host directory......
Do you want to add more domain name? [y/n]: n
Do you want to add hotlink protection? [y/n]: n
Allow Rewrite rule? [y/n]: n
Allow Nginx/Tengine/OpenResty access_log? [y/n]: n
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
Reload Nginx......
#######################################################################
# OneinStack for CentOS/RadHat 6+ Debian 7+ and Ubuntu 12+ #
# For more information please visit https://oneinstack.com #
#######################################################################
Your domain: www.aria2down.tk
Virtualhost conf: /usr/local/nginx/conf/vhost/www.aria2down.tk.conf
Directory of: /data/wwwroot/www.aria2down.tk
www.aria2down.tk更换成自己的域名即可,接下来是上传站点程序。cd /data/wwwroot/www.aria2down.tk
wget "https://github.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/raw/master/website/DirectoryLister.zip"
unzip DirectoryLister.zip && rm -f DirectoryLister.zip
mkdir Download
mkdir Cloud
编译安装Aria2
aria2,虽然耗时比较久,但是不容易出错。在编译之前,先要安装GCC-4.9。由于安装BBR魔改版自动把GCC4.9安装上了,BBR加速也很有用。
wget https://github.com/aria2/aria2/releases/download/release-1.33.1/aria2-1.33.1.tar.gz
tar xzvf aria2-1.33.1.tar.gz
cd aria2-1.33.1
./configure
make
make install
编译过程有些慢,大概需要10-15分钟。大家可以喝口水等等。编译完成后我们可以输入aria2c测试是否可以运行。mkdir "/root/.aria2" && cd "/root/.aria2"
wget "https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/aria2.conf"
wget "https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/autoupload.sh"
wget "https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/dht.dat"
wget "https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/trackers-list-aria2.sh"
echo '' > /root/.aria2/aria2.session
chmod +x /root/.aria2/trackers-list-aria2.sh
chmod +x /root/.aria2/autoupload.sh
chmod 777 /root/.aria2/aria2.session
wget --no-check-certificate https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/aria2 -O /etc/init.d/aria2
chmod +x /etc/init.d/aria2
update-rc.d -f aria2 defaults
输入命令
vim aria2.conf,按i进行编辑## 用户必改项 ##
# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置
dir=
# 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项
rpc-secret=
dir为下载目录。在这里,我设置为/data/wwwroot/www.aria2down.tk/Download
rpc-secret为访问秘钥,是Aria2Ng连接Aria2唯一的验证。输入自己记得的密码即可。
esc,输入:wq保存文件。autoupload.sh是下载文件后自动将下载文件移动到挂载目录下的脚本。我们暂时不进行配置,等到rclone时再进行配置。我们先配置trackers-list-aria2.sh脚本。trackers-list-aria2.sh脚本是自动更新bt下载的trackers服务器的脚本。我们并不需要修改脚本内容,只需要把它添加进入计划任务。输入crontab -e进入任务计划管理.0 3 */7 * * /root/.aria2/trackers-list-aria2.sh
*/5 * * * * /usr/sbin/service aria2 start
bash /etc/init.d/aria2 start启动aria2。
挂载谷歌云盘
cd /root
wget https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/rclone_debian.sh && bash rclone_debian.sh
rm -f rclone_debian.sh
rclone config
n) New remote
s) Set configuration password
q) Quit config
n/s/q> n
name> aria2down #随便填,后面要用到
Type of storage to configure.
Choose a number from below, or type in your own value
1 / Alias for a existing remote
\ "alias"
2 / Amazon Drive
\ "amazon cloud drive"
3 / Amazon S3 (also Dreamhost, Ceph, Minio, IBM COS)
\ "s3"
4 / Backblaze B2
\ "b2"
5 / Box
\ "box"
6 / Cache a remote
\ "cache"
7 / Dropbox
\ "dropbox"
8 / Encrypt/Decrypt a remote
\ "crypt"
9 / FTP Connection
\ "ftp"
10 / Google Cloud Storage (this is not Google Drive)
\ "google cloud storage"
11 / Google Drive
\ "drive"
12 / Hubic
\ "hubic"
13 / Local Disk
\ "local"
14 / Microsoft Azure Blob Storage
\ "azureblob"
15 / Microsoft OneDrive
\ "onedrive"
16 / Openstack Swift (Rackspace Cloud Files, Memset Memstore, OVH)
\ "swift"
17 / Pcloud
\ "pcloud"
18 / QingCloud Object Storage
\ "qingstor"
19 / SSH/SFTP Connection
\ "sftp"
20 / Webdav
\ "webdav"
21 / Yandex Disk
\ "yandex"
22 / http Connection
\ "http"
Storage> 11 #选择11
Google Application Client Id - leave blank normally.
client_id> #留空
Google Application Client Secret - leave blank normally.
client_secret> #留空
Scope that rclone should use when requesting access from drive.
Choose a number from below, or type in your own value
1 / Full access all files, excluding Application Data Folder.
\ "drive"
2 / Read-only access to file metadata and file contents.
\ "drive.readonly"
/ Access to files created by rclone only.
3 | These are visible in the drive website.
| File authorization is revoked when the user deauthorizes the app.
\ "drive.file"
/ Allows read and write access to the Application Data folder.
4 | This is not visible in the drive website.
\ "drive.appfolder"
/ Allows read-only access to file metadata but
5 | does not allow any access to read or download file content.
\ "drive.metadata.readonly"
scope> 1 #选择1
ID of the root folder - leave blank normally. Fill in to access "Computers" folders. (see docs).
root_folder_id> #留空
Service Account Credentials JSON file path - leave blank normally.
Needed only if you want use SA instead of interactive login.
service_account_file> #留空
Remote config
Use auto config?
* Say Y if not sure
* Say N if you are working on a remote or headless machine or Y didn't work
y) Yes
n) No
y/n> n #选择n
If your browser doesn't open automatically go to the following link: https://accounts.google.com/o/oauth2/auth.... #复制到浏览器打开,获取验证码
Log in and authorize rclone for access
Enter verification code> #填入上面获取到的验证码
Configure this as a team drive?
y) Yes
n) No
y/n> y #选择y
Fetching team drive list...
No team drives found in your account--------------------
[Rats]
client_id =
client_secret =
service_account_file =
token = {"access_token":"ya29.GltFBd7UJN2qrxdG8FnG_rMuB18ogb8QlujdL7glvXtfV"}
team_drive =
--------------------
y) Yes this is OK
e) Edit this remote
d) Delete this remote
y/e/d> y #选择y
Current remotes:
Name Type
==== ====
aria2down drive
e) Edit existing remote
n) New remote
d) Delete remote
r) Rename remote
c) Copy remote
s) Set configuration password
q) Quit config
e/n/d/r/c/s/q> q #选择q退出
rclone的自启动脚本。wget https://raw.githubusercontent.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng/master/sh/rcloned
vim rcloned
NAME="" #rclone name名
REMOTE='' #远程文件夹
LOCAL='' #挂载地址
NAME 即是刚刚rclone配置是输入的name。这里我填写的是aria2down。
REMOTE 填写的是谷歌云盘中文件夹的名称,我在云盘里新建了一个chikage的文件夹,所以这里填写的就是chikage。
LOCAL 填写挂载在vps中位置的地址,在这里我填写的是/data/wwwroot/www.aria2down.tk/Cloud
输入完成后保存。我们将其设置自启,并尝试启动。
mv rcloned /etc/init.d/rcloned
chmod +x /etc/init.d/rcloned
update-rc.d -f rcloned defaults
bash /etc/init.d/rcloned start
autoupload.sh,输入vim /root/.aria2/autoupload.shdownloadpath='' #下载目录
rclone='' #rclone挂载的目录
downloadpath 为之前在aria2.confdir的值。
rclone 为刚刚填入rclonedLOCAL的值
结束语
脚本地址:https://github.com/chiakge/Aria2-Rclone-DirectoryLister-Aria2Ng


No comments:
Post a Comment