安装aria2及使用yaaw配置WebGUI界面

现在一般的linux发行版的gcc都不太新,而aria2 1.18之后需要gcc 4.8,所以只能装之前的版本咯。反正下载功能没有区别,都支持http、ftp、bt、magnet磁力链接等协议。

wget http://jaist.dl.sourceforge.net/project/aria2/stable/aria2-1.17.1/aria2-1.17.1.tar.gz
tar zxf aria2-1.17.1.tar.gz
cd aria2-1.17.1
./configure --prefix=/usr/local/blog.creke.net/aria2 --enable-static=true --enable-shared=true --enable-libaria2 --with-tcmalloc --with-sqlite3=/usr/local
#注:configure输出最主要看Xml-RPC是yes就行
make
make install

然后摸一下session文件:

touch /home/blog.creke.net/work/aria2/aria2.session

配置(/home/blog.creke.net/work/aria2/aria2.conf):

#Basic
dir=/home/blog.creke.net/work/aria2/download
continue=true

#HTTP
user-agent=Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0

#BT
enable-dht=true
seed-time=0
dht-listen-port=6882
dht-entry-point=router.bittorrent.com:6881

#network
max-overall-download-limit=5M
max-overall-upload-limit=1M
max-upload-limit=512K

#RPC
enable-rpc=true
#rpc-listen-all=true
rpc-allow-origin-all=true
rpc-listen-port=35002
#rpc-user=none
#rpc-passwd=none

#Advanced

配置nginx代理aria2的jsonrpc:

location /aria2/jsonrpc {
proxy_pass http://localhost:35002/jsonrpc;
proxy_redirect off;
proxy_set_header        X-Real-IP       $remote_addr;
proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
}

安装web gui:

wget https://github.com/binux/yaaw/archive/master.zip
mv master yaaw.zip
unzip yaaw.zip
mv yaaw-master/ yaaw/

值得一提的是,yaaw不支持用户名密码,所以用nginx进行反向代理。修改
打开yaaw的js目录中aria2.js和yaaw.js,搜寻端口号,改成自己定义的端口号和路径。

附:init.d适用的自动启动脚本如下:

#! /bin/sh
# chkconfig: 2345 55 25
# Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and
# run 'update-rc.d -f nginx defaults', or use the appropriate command on your
# distro. For CentOS/Redhat run: 'chkconfig --add aria2'

### BEGIN INIT INFO
# Provides:          aria2c
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts aria2c
# Description:       starts aria2c as a service
### END INIT INFO

# Author:   Creke
# website:  http://blog.creke.net/

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DESC="aria2c daemon"
NAME=aria2c
DAEMON=/usr/local/blog.creke.net/aria2/bin/$NAME
CONFPATH=/home/blog.creke.net/work/aria2/aria2.conf
SESSION=/home/blog.creke.net/work/aria2/aria2.session
#PIDFILE=/usr/local/haproxy/etc/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
USER="blog.creke.net"

set -e
[ -x "$DAEMON" ] || exit 0

do_start() {
su - $USER -c "$DAEMON --conf-path=$CONFPATH -D --input-file=$SESSION --save-session=$SESSION" || echo -n "aria2c already running"
}

do_stop() {
killall -INT $NAME || echo -n "aria2c not running"
}

do_reload() {
kill -HUP $NAME || echo -n "aria2c can't reload"
}

case "$1" in
start)
echo -n "Starting $DESC: $NAME"
do_start
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME"
do_stop
echo "."
;;
reload|graceful)
echo -n "Reloading $DESC configuration..."
do_reload
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
do_stop
do_start
echo "."
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|reload|restart}" >&2
exit 3
;;
esac

exit 0

 

Leave a comment