openwrt路由器安装Transmission软件包与web控制台(中文界面)

梦里梦外; 2022-10-05 11:49 1542阅读 0赞

简单

ssh登录openwrt路由器,执行以下命令。

  1. opkg update
  2. opkg install transmission-daemon
  3. opkg install transmission-cli
  4. opkg install transmission-web
  5. opkg install transmission-remote
  6. opkg install luci-app-transmission

随系统启动/etc/init.d/transmission enable ,启动/etc/init.d/transmission start,
停止/etc/init.d/transmission stop
注意,配置文件在cat /etc/config/transmission,你需要修改config_dir目录,download_dir目录,incomplete_dir目录(在文件完成之前存储文件的位置)。
有一个option enabled 0的选项,你要把它改为option enabled 1

安装transmission-web-control
获取脚本

  1. wget https://gitee.com/culturist/transmission-web-control/raw/master/release/install-tr-control-gitee.sh

安装,执行安装脚本(如果系统不支持 bash 命令,请尝试将 bash 改为 sh ):

  1. bash install-tr-control-cn.sh

Transmission下载出现错误的解决办法 Unable to save resume file: No such file or directory

出现这个问题的原因是配置的config文件夹权限不对,一定要指定所有者为 transmission 这个账号,如果不是的话,就算你设置成0777也未必有用。

设置的方法为 chown transmission.transmission config_dir -R ,其中的config_dir为你自己的配置路径。

挂PT至少以下要修改:

“dht-enabled”: false,

UI

在这里插入图片描述打开http://你的路由器IP地址:9091/transmission/,后面的transmission一般不用加,加端口就可以自动跳转。在没有用迅雷和百度网盘的情况下,下载速度达到了600kB/s,挺不错的。

详细

There are several implementations of the BitTorrent peer-to-peer file sharing protocol. Transmission is only one of them. After installation (opkg install transmission-daemon) there should be a config file in the uci directory.

A few more details about configuration file (/etc/config/transmission) can be found here.

You’ll probably need to set up USB support and format your drives for storage first, see the articles here and here.

Install

  1. the daemon: transmission-daemon is a daemon that runs in the background and is designed to not have any form of visual interface, consult transmission

    1. opkg update
    2. opkg install transmission-daemon
  2. a control instance:

    • transmission-cli: to control the transmission daemon via [CLI (Command-line interface)](https://en.wikipedia.org/wiki/Command-line interface) on the server, consult transmissioncli

      opkg install transmission-cli

    • transmission-web to control the transmission daemon over [HTTP (Hypertext Transfer Protocol)](https://en.wikipedia.org/wiki/Hypertext Transfer Protocol) from a remote host machine with a web browser

      opkg install transmission-web

    • transmission-remote to control the transmission daemon over the transmission JSON-[RPC (Remote Procedure Call)](https://en.wikipedia.org/wiki/Remote procedure call) from a remote host machine with a GUI program, e.g. transmission-gtk/transmission-qt or a python-transmissionrpc or transmisson-remote-gui for OS other then Debian ;-)

      opkg install transmission-remote

Basic setup

To enable Transmission at all, put option enable 1 into /etc/config/transmission.

If you want to start Transmission on boot, run

  1. /etc/init.d/transmission enable

To start Transmission, run

  1. /etc/init.d/transmission start

If you wish to use the web server, besides installing the package (see above), you might need to whitelist your IP address (if it is not in 192.168.1.0/24) via option rpc_whitelist '127.0.0.1,192.168.1.*,your_ip_address’ in the transmission configuration. By default, the server listens on port 9091. ie. 192.168.0.1:9091

To control transmission remotely via RPC, install Transmission Remote GUI and set it up just like the webserver above. The RPC interface uses the same port as the web interface.

Sections

There is only one section: /etc/config/transmission.

You’ll probably want to change the config_dir, download_dir, and incomplete_dir variables to point to locations on external storage.
您可能需要更改config_dir、download_dir和incomplete_dir变量以指向外部存储上的位置

  1. config transmission
  2. option enable 1
  3. option config_dir '/etc/transmission'
  4. option alt_speed_down 50
  5. option alt_speed_enabled false
  6. option alt_speed_time_begin 540
  7. option alt_speed_time_day 127
  8. option alt_speed_time_enabled false
  9. option alt_speed_time_end 1020
  10. option alt_speed_up 50
  11. option bind_address_ipv4 '0.0.0.0'
  12. option bind_address_ipv6 '::'
  13. option blocklist_enabled false
  14. option dht_enabled true
  15. option download_dir '/mnt/sda4/'
  16. option encryption 1
  17. option incomplete_dir '/mnt/sda4/incomplete'
  18. option incomplete_dir_enabled false
  19. option lazy_bitfield_enabled true
  20. option lpd_enabled false
  21. option message_level 2
  22. option open_file_limit 32
  23. option peer_limit_global 240
  24. option peer_limit_per_torrent 60
  25. option peer_port 51413
  26. option peer_port_random_high 65535
  27. option peer_port_random_low 49152
  28. option peer_port_random_on_start false
  29. option peer_socket_tos 0
  30. option pex_enabled true
  31. option port_forwarding_enabled false
  32. option preallocation 1
  33. option proxy ""
  34. option proxy_auth_enabled false
  35. option proxy_auth_password ''
  36. option proxy_auth_username ''
  37. option proxy_enabled false
  38. option proxy_port 80
  39. option proxy_type 0
  40. option ratio_limit 2.0000
  41. option ratio_limit_enabled false
  42. option rename_partial_files true
  43. option rpc_authentication_required false
  44. option rpc_bind_address '0.0.0.0'
  45. option rpc_enabled true
  46. option rpc_password ''
  47. option rpc_port 9091
  48. option rpc_username ''
  49. option rpc_whitelist '127.0.0.1,192.168.1.*'
  50. option rpc_whitelist_enabled true
  51. option script_torrent_done_enabled false
  52. option script_torrent_done_filename ''
  53. option speed_limit_down 100
  54. option speed_limit_down_enabled false
  55. option speed_limit_up 40
  56. option speed_limit_up_enabled true
  57. option start_added_torrents false
  58. option trash_original_torrent_files false
  59. option umask 18
  60. option upload_slots_per_torrent 14
  61. option watch_dir_enabled false
  62. option watch_dir ''

Editing-Configuration-Files














































































































































































































































































































































































































































































































































































































Name Type Required Default Option Description
config_dir path Where the configuration files are
bind_address_ipv4 IP Address
bind_address_ipv6 IPv6 Address
download_dir path Where to store you downloaded files
incomplete_dir_enabled boolean Whether to store incomplete files somewhere else
incomplete_dir path Where to store files untill they are finished
dht_enabled boolean Whether to enable dht (distributed hash tables)
blocklist_enabled boolean Whether to make use of the blocklist defined in config_dir
encryption integer Whether to use encrypted connections only (allow encryption: 0, prefer encryption: 1, require encryption: 2)
pex_enabled boolean
speed_limit_down_enabled boolean Whether transmission should limit its download speed
speed_limit_down integer in KByte/s
speed_limit_up_enabled boolean Whether transmission should limit its download speed
speed_limit_up integer in KByte/s
alt_speed_enabled boolean Whether transmission should use two speed limit settings
alt_speed_down integer in KByte/s
alt_speed_up integer in KByte/s
alt_speed_time_enabled boolean Whether to switch between the two speed-setting on a time table
alt_speed_time_day 7-bit bitmask, 0000001=sunday, 1000000=saturday
alt_speed_time_begin default = 540, in minutes from midnight, 9am
alt_speed_time_end default = 1020, in minutes from midnight, 5pm
upload_slots_per_torrent how many peers can download a torrent at a time
open_file_limit integer remember the low system memory
peer_limit_global integer the max number of peers globaly
peer_limit_per_torrent integer the max number of peers with connection per torrent
peer_port integer the fixed port transmission listens to incomming connections
peer_port_random_high integer highest port of the port range
peer_port_random_low integer lowest port of the port range
peer_port_random_on_start boolean whether to use random ports instead of a fixed one from the beginning
peer_socket_tos boolean whether type of service is enabled
port_forwarding_enabled boolean
preallocation boolean whether to fill the space for chunks not yet downloaded with “0” (helps avoiding fragmentation)
ratio_limit_enabled boolean whether to use a limit ratio
ratio_limit integer automaticaly stop seeding a torrent when it reaches this ratio (with a GUI you can enable this for every torrent separately)
rename_partial_files boolean
rpc_enabled boolean Whether transmission-daemon should be remote controlled by a GUI on a host machine
rpc_bind_address IP Address the address on which transmission-daemon listens to rpcs
rpc_port IP Port the port on which transmission-daemon listens to rpcs
rpc_authentication_required boolean whether rpc needs authentication
rpc_username string user name
rpc_password string password
rpc_whitelist_enabled boolean whether to make use of the whitelist
rpc_whitelist IP Addresses the IPs of the hosts allowed
watch_dir_enabled boolean Whether to check a directory for new torrents put there. Leave this disabled It requres inotify enabled in kernel to works, which is not enabled by default in openwrt.
watch_dir path Path to the directory
script_torrent_done_enabled boolean
script_torrent_done_filename
start_added_torrents boolean
trash_original_torrent_files
umask integer Sets file mode creation mask. The mask should be in base 10 due to the json markup language used by Transmission. For instance, the standard umask octal notation 022 is written as 18. If you want to save downloaded torrents to be world-writable (equivalent to chmod 777 or chmod a+rwx) set this value to 0.
lazy_bitfield_enabled boolean
lpd_enabled boolean
message_level integer
proxy_enabled boolean whether to use a proxy
proxy IP address IP adress of the proxy
proxy_port integer IP port of the proxy
proxy_type integer Type of the proxy (http: 0, socks4: 1, socks5: 2)
proxy_auth_enabled boolean Whether proxy needs authentication
proxy_auth_username string username for the proxy
proxy_auth_password string password for the proxy

Notes

  • Transmission performs much better when swap is mounted.

Example

A video demonstration of how Transmission 2.84 can be installed on OpenWrt 14.07 Barrier Breaker: https://www.youtube.com/watch?v=\_R1Kcpy4pj4 (video removed)

Scripts

A script for adding alternative trackers to the select torrent searching it from its name or number. Source

  1. #!/bin/ash
  2. # Source: https://github.com/oilervoss/openwrt/tree/transmission
  3. TRANSMISSION_REMOTE='/usr/bin/transmission-remote'
  4. # Below is a command that will generate a tracker list with one tracker per line. Using live updated https://github.com/ngosang/trackerslist
  5. # You can use /some/path/trackers.txt for a static list
  6. LIVE_TRACKERS_LIST_CMD='curl -s --url https://raw.githubusercontent.com/ngosang/trackerslist/master/trackers_best_ip.txt'
  7. TORRENTS=`$TRANSMISSION_REMOTE -l 2>/dev/null`
  8. PARAMETER=$1
  9. if [ $? -ne 0 ]; then
  10. echo -e "\n\e[0;91;1mFail on transmission. Aborting.\n\e[0m"
  11. exit 1
  12. fi
  13. if [ $# -eq 0 ]; then
  14. echo -e "\n\e[31mThis script expects one parameter\e[0m"
  15. echo -e "\e[0;36maddtracker \t\t- list current torrents "
  16. echo -e "addtracker \$number\t- add trackers to torrent of number \$number"
  17. echo -e "addtracker \$name\t- add trackers to first torrent with part of name \$name"
  18. echo -e "\n\e[0;32;1mCurrent torrents:\e[0;32m"
  19. echo "$TORRENTS" | sed -n 's/\(^.\{4\}\).\{64\}/\1/p'
  20. echo -e "\n\e[0m"
  21. exit 1
  22. fi
  23. # return number by searching
  24. # transmission-remote -l | grep -i "Blueray" | sed -n 's/ *\([0-9]\+\).*/\1/p'
  25. if [ "${PARAMETER//[0-9]}" != "" ] ; then
  26. PARAMETER=`echo "$TORRENTS" | grep -i "$PARAMETER" | sed -n 's/\([0-9]\+\).*/\1/p'`
  27. if [ "${PARAMETER//[ ]}" != "" -a "${PARAMETER//[0-9 ]}" = "" ] ; then
  28. echo -e "\n\e[0;32;1mI found the following torrent:\e[0;32m"
  29. echo "$TORRENTS" | sed -n 's/\(^.\{4\}\).\{64\}/\1/p' | grep -i "$1"
  30. fi
  31. fi
  32. NUMBERCHECK=`echo "$TORRENTS" | sed -n '1d;s/\(^.\{4\}\).*/\1/;/Sum/!p'|grep "$PARAMETER"`
  33. if [ "${PARAMETER//[0-9 ]}" != "" -o "${NUMBERCHECK//[ ]}" = "" ] ; then
  34. echo -e "\n\e[0;31;1mI didn't find a torrent with text/number: \e[21m$1"
  35. echo -e "\n\e[0;32;1mCurrent torrents:\e[0;32m"
  36. echo "$TORRENTS" | sed -n 's/\(^.\{4\}\).\{64\}/\1/p'
  37. echo -e "\e[0m"
  38. exit 1
  39. fi
  40. echo
  41. $LIVE_TRACKERS_LIST_CMD | while read TRACKER
  42. do
  43. if [ "$TRACKER" != "" ]; then
  44. echo -ne "\e[0;36;1mAdding $TRACKER\e[0;36m"
  45. $TRANSMISSION_REMOTE -t $PARAMETER-td $TRACKER 1>/dev/null 2>&1
  46. if [ $? -eq 0 ]; then
  47. echo -e " -> \e[32mSuccess! "
  48. else
  49. echo -e " - \e[31m< Failed > "
  50. fi
  51. fi
  52. done
  53. echo -e "\e[0m"

发表评论

表情:
评论列表 (有 0 条评论,1542人围观)

还没有评论,来说两句吧...

相关阅读

    相关 Transmission下载安装

    前言 > Transmission 是一款流行的 BT 下载软件,比其他客户端使用更少的资源,守护程序非常适合服务器,并且可以通过桌面 GUI、Web > 界面和终端