Hi,
Despite last versions of ClearOS provide a torrent client : Transmission Bittorrent Client, I feel more confortable with rtorrent (rutorrent as gui).
I've looked for turials here but I do not found any. Here is "my humble" HowTo :
Despite last versions of ClearOS provide a torrent client : Transmission Bittorrent Client, I feel more confortable with rtorrent (rutorrent as gui).
I've looked for turials here but I do not found any. Here is "my humble" HowTo :
Share this post:
Responses (6)
-
Accepted Answer
Trouble shooting
Let me know the trouble you've met. Because this HowTo has been made from my notes and memory.
Keep in mind to change one think a time when :
- Switch from "port bind" to "socket file"
- Add watch directory
- Run as service
- Do advanced test (like create torrent or move torrent)
My sources :
- https://wiki.archlinux.org/index.php/RTorrent#systemd_service_file_with_tmux_or_screen
- ... others that I can't remember
- Switch from "port bind" to "socket file"
-
Accepted Answer
-
Accepted Answer
Install rutorrent
Here are the steps :
- Download rutorrent & Plugins
- Configure rutorrent
- Configure apache
- Test
Download rutorrent & Plugins
yum install mktorrent --enablerepo=clearos-epel-unverified
cd /tmp
wget https://bintray.com/artifact/download/novik65/generic/rutorrent-3.6.tar.gz
wget https://bintray.com/artifact/download/novik65/generic/plugins-3.6.tar.gz
cd /usr/share
tar zxvf /tmp/rutorrent-3.6.tar.gz
chmod 755 rutorrent/
cd /usr/share/rutorrent/
tar zxvf /tmp/plugins-3.6.tar.gz
Configure rutorrent
Edit/Create/Adapt Config file : /usr/share/rutorrent/conf/config.php
// $scgi_port = 5000;
// $scgi_host = "127.0.0.1";
// For web->rtorrent link through unix domain socket
// (scgi_local in rtorrent conf file), change variables
// above to something like this:
//
$scgi_port = 0;
$scgi_host = "unix:///home/rtorrent/scgi-web.socket";
Edit/Create/Adapt Config file : /usr/share/rutorrent/plugins/create/conf.php
$useExternal = "mktorrent"; // Valid choices:
// false - use internal realization (may be too slow for large files)
// "transmissioncli" - use program transmissioncli (see http://www.transmissionbt.com/)
// "transmissioncreate" - use program transmissioncreate (see http://www.transmissionbt.com/)
// "createtorrent" - use program createtorrent (see http://www.createtorrent.com)
// "mktorrent" - use program createtorrent (see http://mktorrent.sourceforge.net)
// "buildtorrent" - use program buildtorrent (see http://claudiusmaximus.goto10.org/cm/torrent.html)
$pathToCreatetorrent = ''; // Something like /bin/createtorrent, or /bin/transmissioncli. If empty, program will be found in PATH.
$pathToExternals["pgrep"] = ''; // Something like /usr/bin/pgrep. If empty, will be found in PATH.
Configure apache
Create apache Config file : /etc/httpd/conf.d/rutorrent.conf
# RuTorrent Apache conf
Alias /rutorrent /usr/share/rutorrent
Alias /rtorrent /usr/share/rutorrent
# SCGI for rTorrent and web GUI
# Needed only if using SCGI through IP adress : not needed coz' socket is used.
# SCGIMount /RPC2 127.0.0.1:5000
<Directory /usr/share/rutorrent>
AllowOverride Options FileInfo
# Restricted access to rTorrent WebGUI
AuthType Basic
AuthName "rTorrent restricted access"
include /etc/httpd/conf.d/ldap.auth
# HTTPS forced (if needed)
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
# Compress pages with Deflate (saves bandwith)
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|7z|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</Directory>
Create ldap Authentication file : /etc/httpd/conf.d/ldap.auth
This file is made to mutualize ldap authentification
# ldap Authenticate users from ClearOS OpenLDAP
AuthType Basic
AuthBasicProvider ldap
# AuthzLDAPAuthoritative On #Disabled on apache 2.4
# Bind to OpenLDAP
AuthLDAPBindDN cn=manager,ou=Internal,dc=example,dc=org
AuthLDAPBindPassword Y2BHkvorIFhQshtX
# Authorize access to users defined here (change 'userX')
AuthLDAPURL ldap://localhost/ou=Users,ou=Accounts,dc=example,dc=org
#Require ldap-user MY_USER
Require ldap-group cn=MY_ALLOWED_USER_GROUP,ou=Groups,ou=Accounts,dc=example,dc=org
# Comment/Uncomment these three lines if access needed without auth (from this LAN IP)
Order Allow,Deny
Allow from 10.
# router IP
Deny from 10.0.0.138
Satisfy any
apache should be able to read this 2 files.
Restard apache to ensure config file is OK :
service httpd restart
Please note that ssl has been enabled in : /etc/httpd/conf.d/ssl.conf
By using ClearOS certificates instead of self-signed certificate (localhost). If you import CA certificate in you browaser you won't get any security warning :
# SSL Engine Switch:
# Enable/Disable SSL for this virtual host.
SSLEngine on
# SSL Protocol support:
# List the enable protocol levels with which clients will be able to
# connect. Disable SSLv2 access by default:
#default commented : SSLProtocol all -SSLv2
#from Flexshare
# No weak export crypto allowed
SSLHonorCipherOrder on
SSLProtocol all -SSLv2 -SSLv3 -TLSv1
# SSL Cipher Suite:
# List the ciphers that the client is permitted to negotiate.
# See the mod_ssl documentation for a complete list.
#default commented : SSLCipherSuite HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA
#from Flexshare
SSLCipherSuite ECDH+AESGCMH+AESGCM:ECDH+AES256H+AES256:ECDH+AES128H+AES:ECDH+3DESH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5
...
# Server Private Key:
# If the key is not combined with the certificate, use this
# directive to point at the key file. Keep in mind that if
# you've both a RSA and a DSA private key you can configure
# both in parallel (to also allow the use of DSA ciphers, etc.)
#default commented : SSLCertificateKeyFile /etc/pki/tls/private/localhost.key
#from Flexshare
SSLCertificateKeyFile /etc/pki/CA/private/sys-0-key.pem
...
# Certificate Authority (CA):
# Set the CA certificate verification path where to find CA
# certificates for client authentication or alternatively one
# huge file containing all of them (file must be PEM encoded)
#default commented : SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
#from Flexshare
SSLCACertificateFile /etc/pki/CA/ca-cert.pem
Test
Call your url for test :
- http://clearos.example.org/rtorrent/
- https://clearos.example.org/rtorrent/
- http://clearos.example.org/rutorrent/
- https://clearos.example.org/rutorrent/
All URLs should works without authentication on LAN and require authentication on WAN/Internet.
Hope it will helps some of you.... - Download rutorrent & Plugins
-
Accepted Answer
Hi Bensiali,
Thanks for the HowTo.
Can I suggest you that when you do the useradd, you add the -r switch to force it to have a UID of less than 1000 or you'll probably have to recreate it every time you restart as LDAP will trample on it. Then you'll also need the -m switch to get a /home directory.
Nick -
Accepted Answer
Install rtorrent as a service
Here are the steps :
- Install packages
- Create user, group and directory structure
- Test rtorrent
- Use socket file (optional)
- Run as service
Install packages
yum --enablerepo=clearos-epel-unverified install rtorrent
rtorrent.x86_64 0.9.6-2.el7 @clearos-epel-unverified
yum --enablerepo=centos-unverified install tmux
tmux.x86_64 1.8-4.el7 @centos-unverified
Create user, group and directory structure
- Create user rtorrent
- Create group rtorrent_http with rtorrent, apache (and other user you need)
- Create Watch directory (optional)
- Create Complete directory (optional)
- Create
useradd -r -m rtorrent
groupadd rtorrent_http
usermod -a -G rtorrent_http rtorrent
usermod -a -G rtorrent_http apache
usermod -a -G rtorrent_http my_own_user(optional)
mkdir /home/rtorrent/complete/
mkdir /home/rtorrent/download/
mkdir /home/rtorrent/watch/
mkdir /home/rtorrent/session/
chown :rtorrent_http /home/rtorrent/*
Note : You might need to create sub directory with in "complete" directory for :
- Videos
- Audio
- Games
- ....
You might use bind mount in /etc/fstab
/store/lv_store/divx /home/rtorrent/complete/videos none bind,rw 0 0
/store/lv_store/ISO /home/rtorrent/complete/iso none bind,rw 0 0
Test rtorrent
Edit/Adapt rtorrent config file : /home/rtorrent/.rtorrent.rc
Note that below I only highligh parameters that you need to adapt or check but not all.
# Default directory to save the downloaded torrents.
directory = /home/rtorrent/download
# Default session directory. Make sure you don't run multiple instance of
# rtorrent using the same session directory. Perhaps using a relative path?
session = /home/rtorrent/session
# Watch a directory for new torrents, and stop those that have been deleted.
#schedule = untied_directory,60,60,stop_untied=
#schedule = watch_directory,60,60,load_start=/home/shared/download.torrents/*.torrent
#schedule = watch_directory,60,60,"load_start=/home/rtorrent/watch/*.torrent,d.set_directory=/home/rtorrent/complete"
#schedule = watch_directory,60,60,"load_start=/home/rtorrent/watch/*.torrent"
###################### Watch Dir #########################################"
# Videos
schedule = surv_videos,5,60,"load_start=/home/rtorrent/watch/films/*.torrent,d.set_custom1=\"/home/rtorrent/complete/videos/\""
# Others
schedule = surv_otherss,5,60,"load_start=/home/rtorrent/watch/*.torrent,d.set_custom1=/home/rtorrent/complete/"
# Games
schedule = surv_gamez,5,60,"load_start=/home/rtorrent/watch/games/*.torrent,d.set_custom1=/home/rtorrent/complete/games/"
# Apps
schedule = surv_appz,5,60,"load_start=/home/rtorrent/watch/apps/*.torrent,d.set_custom1=/home/rtorrent/complete/apps/"
########################################## ON COMPLETE #######################################################
# on_finished = move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
# Equivalent on_finished for rtorrent > 0.8.4
# system.method.set_key = event.download.finished,<name>,<command>
#system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_custom1= ;execute=mv,-u,$d.get_base_path=,$d.get_custom1="
system.method.set_key = event.download.finished,move_complete,"execute=/home/rtorrent/move.sh,$d.get_base_path=,$d.get_custom1=;d.set_directory=$d.get_custom1="
########################################## ON COMPLETE #######################################################
# Close torrents when diskspace is low.
schedule = low_diskspace,5,60,close_low_diskspace=100M
Here is the part that is optional : Choose either port bind (low security) or socket file :
# Enable XMLRPC-C API (needs rTorrent > 0.7.5, compiled with "--with-xmlrpc-c")
#scgi_port = 127.0.0.1:5000
scgi_local = /home/rtorrent/scgi-web.socket
# Apache need RW access to this file when running ruTorrent PHP interface
schedule = chmod,0,0,"execute=chmod,777,/home/rtorrent/scgi-web.socket"
Now you're ready to test rtorrent => to calid the config file
su rtorrent
rtorrent -n -o import=/home/rtorrent/.rtorrent.rc
Use Ctrl + Q to quit.
Run as service
Create file : /etc/systemd/system/rtorrent.service
[Unit]
Description=rTorrent Daemon
After=network.target
[Service]
Type=forking
KillMode=none
User=rtorrent
ExecStart=/usr/bin/tmux new-session -d -s rtorrent -n rtorrent "/usr/bin/rtorrent -n -o import=/home/rtorrent/.rtorrent.rc"
ExecStop=/usr/bin/bash -c "/usr/bin/tmux send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done"
WorkingDirectory=/home/rtorrent/
Restart=on-failure
[Install]
WantedBy=multi-user.target
Test command line (under rot user) :
# run start command
/usr/bin/tmux new-session -d -s rtorrent -n rtorrent "/usr/bin/rtorrent -n -o import=/home/rtorrent/.rtorrent.rc"
# check rtorrent is running
ll /home/rtorrent/scgi-web.socket
# Stop rtorrent
/usr/bin/bash -c "/usr/bin/tmux send-keys -t rtorrent C-q && while pidof rtorrent > /dev/null; do sleep 0.5; done"
Then Start service :
service rtorrent start
service rtorrent status
Result :
Redirecting to /bin/systemctl status rtorrent.service
● rtorrent.service - rTorrent Daemon
Loaded: loaded (/etc/systemd/system/rtorrent.service; enabled; vendor preset: disabled)
Active: active (running) since Mon 2016-03-28 16:21:06 CEST; 3h 56min ago
Main PID: 12603 (tmux)
CGroup: /system.slice/rtorrent.service
├─12603 /usr/bin/tmux new-session -d -s rtorrent -n rtorrent /usr/bin/rtorrent -n -o import=/home/rtorrent/.rtorrent.rc
└─12604 /usr/bin/rtorrent -n -o import=/home/rtorrent/.rtorrent.rc
Mar 28 16:21:06 home.bensiali.net systemd[1]: Starting rTorrent Daemon...
Mar 28 16:21:06 home.bensiali.net systemd[1]: Started rTorrent Daemon.
remember to add service start on boot :
chkconfig rtorrent on
- Install packages
-
Accepted Answer
Objectives :
- Use rtorrent
- with php/web gui : rutorrent
- use socket file
- been able to create rtorrent file from web gui
Tools required
- rtorrent : Version used 0.9.6
- rutorrent : Version used 3.6
- tmux : Version used 1.8
- mktorrent : Version used 1.0
Steps :
- Install rtorrent, run as a service on user rtorrent
- Install rutorrent
- Trouble shooting
- Use rtorrent
Please login to post a reply
You will need to be logged in to be able to post a reply. Login using the form on the right or register an account if you are new here.
Register Here »