Installing Transmission BitTorrent client from the source code on CentOS 7
Configuration parameters:
installation directory - /opt/transmission
user account used to run the service - transmission
directory used to store downloads - /opt/transmission/downloads
application version - 2.92
The whole process will be divided into 3 stages: at first, we will setup a basic configuration, then an additional hard drive will be mounted to the downloads directory, and finally we will share the downloads directory using Samba
Basic configuration
add the following lines to the /etc/sysctl.d/99-sysctl.conf file to increase the size of the socket buffers
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
Comment: otherwise, the Transmission log will be populated with these messages
UDP Failed to set receive buffer: requested 4194304, got 425984 (tr-udp.c:78)
UDP Failed to set send buffer: requested 1048576, got 425984 (tr-udp.c:89)
reboot the server
reboot
install the packages required for the compilation
yum install gcc gcc-c++ libcurl-devel libevent-devel zlib-devel openssl-devel intltool
download and unpack the source code
curl -L https://github.com/transmission/transmission-releases/raw/master/transmission-2.92.tar.xz | tar xJ -C /root
configure, compile and install the application
./configure --prefix=/opt/transmission
make
make install
create the /etc/profile.d/transmission.sh file with the following content in order to add the binary files path into the PATH environment variable
export PATH=$PATH:/opt/transmission/bin
add the man pages path to the /etc/man_db.conf file
MANDATORY_MANPATH /opt/transmission/share/man
create the /opt/transmission/settings.json configuration file
{
«alt-speed-down»: 50,
«alt-speed-enabled»: false,
«alt-speed-time-begin»: 540,
«alt-speed-time-day»: 127,
«alt-speed-time-enabled»: false,
«alt-speed-time-end»: 1020,
«alt-speed-up»: 50,
«bind-address-ipv4»: «0.0.0.0»,
«bind-address-ipv6»: «::»,
«blocklist-enabled»: false,
«blocklist-url»: «http://www.example.com/blocklist»,
«cache-size-mb»: 512,
«dht-enabled»: true,
«download-dir»: «/opt/transmission/downloads»,
«download-queue-enabled»: false,
«download-queue-size»: 5,
«encryption»: 2,
«idle-seeding-limit»: 30,
«idle-seeding-limit-enabled»: false,
«incomplete-dir»: «/opt/transmission/downloads»,
«incomplete-dir-enabled»: false,
«lazy-bitfield-enabled»: true,
«lpd-enabled»: false,
«message-level»: 2,
«peer-congestion-algorithm»: «»,
«peer-id-ttl-hours»: 6,
«peer-limit-global»: 200,
«peer-limit-per-torrent»: 50,
«peer-port»: 51413,
«peer-port-random-high»: 65535,
«peer-port-random-low»: 49152,
«peer-port-random-on-start»: false,
«peer-socket-tos»: «default»,
«pex-enabled»: true,
«pidfile»: «/opt/transmission/transmission.pid»,
«port-forwarding-enabled»: false,
«preallocation»: 1,
«prefetch-enabled»: true,
«queue-stalled-enabled»: true,
«queue-stalled-minutes»: 30,
«ratio-limit»: 2,
«ratio-limit-enabled»: false,
«rename-partial-files»: false,
«rpc-authentication-required»: true,
«rpc-bind-address»: «0.0.0.0»,
«rpc-enabled»: true,
«rpc-password»: «some_password»,
«rpc-port»: 9091,
«rpc-url»: «/transmission/»,
«rpc-username»: «some_user»,
«rpc-whitelist»: «127.0.0.1»,
«rpc-whitelist-enabled»: true,
«scrape-paused-torrents-enabled»: true,
«script-torrent-done-enabled»: false,
«script-torrent-done-filename»: «»,
«seed-queue-enabled»: false,
«seed-queue-size»: 10,
«speed-limit-down»: 100,
«speed-limit-down-enabled»: false,
«speed-limit-up»: 100,
«speed-limit-up-enabled»: false,
«start-added-torrents»: true,
«trash-original-torrent-files»: true,
«umask»: 63,
«upload-slots-per-torrent»: 14,
«utp-enabled»: true,
«watch-dir»: «/opt/transmission/watch»,
«watch-dir-enabled»: true
}
Comment 1: when the service starts the value of the rpc-password parameter is substituted with its hash
Comment 2: all the configuration changes should be made with the service stopped, otherwise they will be lost
create the required directories
mkdir /opt/transmission/{blocklists,downloads,resume,torrents,watch}
create a user account for running the service
useradd -M transmission
passwd some_password
change owners and permissions of the /opt/transmission directory
chown -R transmission:transmission /opt/transmission
find /opt/transmission -type d -exec chmod 700 {} \;
find /opt/transmission -type f -exec chmod 600 {} \;
chmod 700 /opt/transmission/bin/*
create the /usr/lib/systemd/system/transmission.service unit file
[Unit]
Description=Transmission BitTorrent Client
After=network.target
[Service]
Type=simple
ExecStart=/opt/transmission/bin/transmission-daemon —foreground —pid-file /opt/transmission/transmission.pid —config-dir /opt/transmission —logfile /opt/transmission/transmission.log
PIDFile=/opt/transmission/transmission.pid
User=transmission
[Install]
WantedBy=multi-user.target
reload the systemd configuration
systemctl daemon-reload
start the service
systemctl start transmission
add a torrent using the command
transmission-remote --auth some_user:some_password --add /file/path
list torrents using the command
transmission-remote --auth some_user:some_password --list
remove a torrent using the command
transmission-remote --auth some_user:some_password --torrent torrent_id --remove
Mount an additional hard drive
determine the right hard drive
fdisk -l
Comment: let's assume that the hard drive is named /dev/sdb
create a new LVM physical volume
pvcreate /dev/sdb
create a new LVM volume group
vgcreate downloads_vg /dev/sdb
create a new LVM logical volume
lvcreate -l 100%FREE -n downloads_lv downloads_vg
create a filesystem on the LVM logical volume
mkfs --type ext4 /dev/downloads_vg/downloads_lv
add the following line to the /etc/fstab file in order to enable mounting of the LVM logical volume on the system startup
/dev/downloads_vg/downloads_lv /opt/transmission/downloads ext4 defaults 0 0
mount all filesystems listed in the /etc/fstab file
mount -a
change owners and permissions of the root directory of the LVM logical volume
chown -R transmission:transmission downloads
chmod -R 700 downloads
Configure Samba
install Samba
yum install samba
change the SELinux context of the /opt/transmission/downloads and /opt/transmission/watch directories to samba_share_t as described here
replace the content of the /etc/samba/smb.config file with the following
[global]
security = user
server role = standalone
server min protocol = SMB2
server max protocol = SMB3
passdb backend = tdbsam:/etc/samba/passdb.tdb
log level = 1
[downloads]
path=/opt/transmission/downloads
guest ok = no
writable = yes
browsable = yes
create mask = 0700
directory mask = 0700
[watch]
path=/opt/transmission/watch
guest ok = no
writable = yes
browsable = yes
create mask = 0700
directory mask = 0700
create a Samba user account
smbpasswd -a transmission
Comment 1: as a result the file /etc/samba/passdb.tdb will be created
Comment 2: although authentication will be performed via the file, the corresponding system account must exist and its password must be set
change owners and permissions of the /etc/samba directory
chmod 400 /etc/samba/*
test the configuration
testparm
restart Samba
systemctl restart smb