Arch 服务器配置aria2+webui+token

作者: 艾雨寒 | 来源:发表于2016-12-20 16:51 被阅读1619次

如何配置aria2(RPC) + webui + TOKEN

下载必要文件

aria2

$ sudo pacman -S aria2

webuiRPC

https://github.com/ziahamza/webui-aria2

$ git clone https://github.com/ziahamza/webui-aria2.git

apache

# pacman -S apache

编辑配置文件

aria2 配置

给aria2 创建一个新用户

# useradd aria2

建立家目录并写入配置文件

# mkdir /home/aria2
nano /home/aria2/aria2.conf

配置文件内容

具体可见 https://aria2.github.io/manual/en/html/aria2c.html

#必须
enable-rpc=true
rpc-listen-all=true
daemon=true
#file-allocation=trunc 对于Linux 系统用trunc 会比较好
#secret=<TOKEN> 如果有TOKEN 的话请添加
#文件保存路径(可以自拟,确保aira2 用户拥有写入该目录的权限)
dir=/mnt/data/Downloads/

写一个systemd 脚本便于启动服务

nano /etc/systemd/system/aria2c.service

内容如下(其中配置文件的路径可以自己指定)

[Unit]
Description=Aria2c download manager
After=network.target
[Service]
User=aria2
Type=forking
ExecStart=/usr/bin/aria2c --conf-path=/home/aria2/aria2.conf
[Install]
WantedBy=multi-user.target

apache 配置

nano /etc/httpd/conf/httpd.conf

唯一需要修改是将DocumentRoot修改到webui-aria2 文件夹所在的目录。

默认目录是/srv/http/

至此最基本的配置就完成了
启动服务

# systemctl start httpd
# systemctl start aria2c

允许开机启动

# systemctl enable httpd
# systemctl enable aria2c 

生成TOKEN

http://ninghao.net/blog/2834

这里仅介绍PyJWT 的方式

所使用的Python 版本2、3均可

安装和配置pip

# pacman -S python2 python2-pip
# pip install pyjwt

如果碰到需要更新pip 的情况请更新

pip install --upgrade pip

然后进入python

# python

import jwt
payload = {"sub": "1234567890", "name": "John Doe", "admin": true}
encoded = jwt.encode(payload, 'secret', algorithm='HS256') #secret 是你自己的小语句,用于在webui 输入密码令牌
print encoded

生成之后可以到 https://jwt.io/ 进行验证


访问和使用

http://ziahamza.github.io/webui-aria2/

可以使用官方提供的页面,也可以加载本地页面(输入ip 进入webui即可)

进入之后在

设置 > 连接设置 > 主机输入你服务器的IP(或者你的本地IP) > 端口号(没改就默认) > 在密码令牌填入你的secret

提示连接成功后便可以使用了。

更多其他玩法可在网上自行搜索。

相关文章

  • Arch 服务器配置aria2+webui+token

    如何配置aria2(RPC) + webui + TOKEN 下载必要文件 aria2 webuiRPC http...

  • arch-linux安装小记(一)

    Arch-Linux 配置小记(一) 一、Arch-Linux简介 1.简介 Arch Linux是朝向轻量(li...

  • Arch声卡配置

    ALSA UtilitiesInstall the alsa-utils package. This contai...

  • MVVM-DataSource

    MVVM-导入配置 简介 熟悉谷歌arch框架的同学都知道,arch中mvvm思想主要依靠LiveData来作为数...

  • 2018-06-13

    先为工程初始化fastlane 配置: 1. fastlane init执行 2. Fastfile配置(arch...

  • glusterfs 性能配置优化

    glusterfs 性能配置优化 修改配置 arch-img 为存储名称 命令合集 命令作用备注gluster v...

  • Arch Linux UEFI+GRUB 安装

    arch linux 笔记 我在自己的笔记本装的,SSD+HDD 双显卡(配置比较高的, arch好像很不错的样子...

  • Arch Linux配置教程

    以arch的基本系统为基础,我们可以对其进行各种配置操作,让其更符合个人喜好。下面介绍了一些常用的配置。 1.用户...

  • Enjoy arch —— 应用配置

    转载至:http://wawei.gitcafe.io/ 在上一篇文章中我们已经成功地安装了桌面环境,本篇文章将介...

  • Enjoy arch —— 基础配置

    转载至:http://wawei.gitcafe.io/ 在上一篇文章中我们已经安装好了最基本的系统,本篇文章将介...

网友评论

    本文标题:Arch 服务器配置aria2+webui+token

    本文链接:https://www.haomeiwen.com/subject/qecfvttx.html