07-07-2014, 11:27 PM
Replacing a Windows XP virtual machine with a Linux Cent OS 6.5 torrent box VM
Windows XP end of life was April 8, 2014.
This is my journey from replacing an old, slow Windows XP virtual machine with Cent OS.
Distribution: CentOS 6.5 (Linux)
Install option: Minimal Desktop (Includes a GUI)
RAM: 768 MB
Fixed HDD: 20 GB
After searching I choose to go with the torrent client Transmission. It was a choice between Transmission and Deluge. I think I may switch to Deluge though, you may understand after reading the entire article.
How to Install transmission bit torrent client on Linux Cent OS (6.5)
If you go to download section of the Transmission website https://www.transmissionbt.com/download/ under CentOS there is a link named Contrib Packages which takes you to another website. Transmission do not have their own yum repo.
Geekery Repository Installation
RHEL/CentOS 6
Install the Transmission torrent client
You should get an output similar to.
You can now access Transmission under Applications > Internet > Transmissions BitTorrent Client.
This part is option but I like to set these preferences.
Edit > Preferences
Privacy: Require Encryption
Network: Pick a random port every time Transmission is started
Web: Enable web client (The default port is 9091)
One funny thing that I noticed was that the transmission daemon run a separate config to the the transmission GUI.
After enabling the transmission web client it now works locally on the cent OS box (http://127.0.0.1:9091) but not from my other PC, even after adding my IP to the allowed IPs.
Time to start troubleshooting..
Install telnet on the Cent OS box to test.
Telnet to the port locally to see if anything is listening / accepting connections. So that worked.
Trying 127.0.0.1...
Connected to 127.0.0.1.
This now points to a firewall problem because I could telnet locally but not from my Windows PC. Googling for "firewall centos" lead me to one of their wiki articles. Apparently CentOS uses ip tables for its firewall. http://wiki.centos.org/HowTos/Network/IPTables
Inspect the currently loaded iptables rules
Edit iptables config file
Add a new rule
Make sure that is it ABOVE this rule
ctrl + o and ctrl + x to save.
Restart iptables
Result.. the web client is now half working from my host PC.
I am now getting the error message:
In Transmission under Web > Allow only these IP addresses to connect I added my host IP and when that didn't work I disabled IP authentication but that didn't work either which told me the web version was pulling config from somewhere else.
Configuration Files location
The settings are stored in /var/lib/transmission/settings.json
Stop the service before making changes to the config file.
Edit the config file.
Default entry:
Edited entry:
Save the file, ctrl + 0, ctrl + x then start the transmission daemon.
I can now get in to the web interface however if I add a torrent in to the web interface I am now getting permission denied.
The default download directory was set to: /var/lib/transmission/Downloads
Running:
Gives us:
Then we run:
Gives us:
We can confirm what user the deamon runs as by checking the start up script.
Gives us the file, (as well as some others): /etc/rc.d/init.d/transmission-daemon
and scroll down you will see: DAEMON_USER="transmission"
You can also find this user if you run:
We want to give the user transmission access to the completed downloads folder, is this case we'll grant it on it's parent folder which is: /Torrents
For this we have to create a new group, we will call it TorrentsRW.
Check that they were added to the group
Run the command:
Output:
Set the user owner of the /Torrents folder to transmission and the group onwer to the TorrentsRW group:
Run stat again now:
Gives us:
Set permissions on the folder to rwx rwx r-x
Run stat again now
Gives us:
Make new files created inside that directory inherit the parent's user ownership.
Another option is to set it to inherit group ownership but that didn't seem to work as well.
Run stat again now
Gives us:
Whenever you add a new Torrent in the web interface the folder that it makes gets these permissions though ...
Which means that the user transmission can read / write but the TorrerntsRW group can only read..
I still haven't figured that out.. I will most likely just switch to using Deluge which may not have this problem.
Windows XP end of life was April 8, 2014.
This is my journey from replacing an old, slow Windows XP virtual machine with Cent OS.
Distribution: CentOS 6.5 (Linux)
Install option: Minimal Desktop (Includes a GUI)
RAM: 768 MB
Fixed HDD: 20 GB
After searching I choose to go with the torrent client Transmission. It was a choice between Transmission and Deluge. I think I may switch to Deluge though, you may understand after reading the entire article.
How to Install transmission bit torrent client on Linux Cent OS (6.5)
If you go to download section of the Transmission website https://www.transmissionbt.com/download/ under CentOS there is a link named Contrib Packages which takes you to another website. Transmission do not have their own yum repo.
Geekery Repository Installation
RHEL/CentOS 6
Code:
cd /etc/yum.repos.d/
Code:
wget http://geekery.altervista.org/geekery-el6-x86_64.repo
Install the Transmission torrent client
Code:
yum install transmission*
You should get an output similar to.
Quote:Installed:
transmission.x86_64 0:2.82-1geekery
transmission-cli.x86_64 0:2.82-1geekery
transmission-common.x86_64 0:2.82-1geekery
transmission-daemon.x86_64 0:2.82-1geekery
transmission-gtk.x86_64 0:2.33-1geekery
Dependency Installed:
libevent2.x86_64 0:2.0.10-1geekery
You can now access Transmission under Applications > Internet > Transmissions BitTorrent Client.
This part is option but I like to set these preferences.
Edit > Preferences
Privacy: Require Encryption
Network: Pick a random port every time Transmission is started
Web: Enable web client (The default port is 9091)
One funny thing that I noticed was that the transmission daemon run a separate config to the the transmission GUI.
After enabling the transmission web client it now works locally on the cent OS box (http://127.0.0.1:9091) but not from my other PC, even after adding my IP to the allowed IPs.
Time to start troubleshooting..
Install telnet on the Cent OS box to test.
Code:
yum install telnet
Telnet to the port locally to see if anything is listening / accepting connections. So that worked.
Code:
telnet 127.0.0.1 9091
Connected to 127.0.0.1.
This now points to a firewall problem because I could telnet locally but not from my Windows PC. Googling for "firewall centos" lead me to one of their wiki articles. Apparently CentOS uses ip tables for its firewall. http://wiki.centos.org/HowTos/Network/IPTables
Inspect the currently loaded iptables rules
Code:
iptables -L
Edit iptables config file
Code:
nano /etc/sysconfig/iptables
Add a new rule
Code:
-A INPUT -s 192.168.2.0/24 -p tcp -m tcp --dport 9091 -j ACCEPT
Make sure that is it ABOVE this rule
Code:
-A INPUT -j REJECT --reject-with icmp-host-prohibited
ctrl + o and ctrl + x to save.
Restart iptables
Code:
service iptables restart
Result.. the web client is now half working from my host PC.
I am now getting the error message:
Quote:403: Forbidden
Unauthorized IP Address.
In Transmission under Web > Allow only these IP addresses to connect I added my host IP and when that didn't work I disabled IP authentication but that didn't work either which told me the web version was pulling config from somewhere else.
Configuration Files location
The settings are stored in /var/lib/transmission/settings.json
Stop the service before making changes to the config file.
Code:
service transmission-daemon stop
Edit the config file.
Code:
nano /var/lib/transmission/settings.json
Default entry:
Quote:"rpc-whitelist": "127.0.0.1",
Edited entry:
Quote:"rpc-whitelist": "127.0.0.1, 192.168.2.*",
Save the file, ctrl + 0, ctrl + x then start the transmission daemon.
Code:
service transmission-daemon start
I can now get in to the web interface however if I add a torrent in to the web interface I am now getting permission denied.
Quote:Error: Permission denied (/Torrents/CompleteTorrents/)
The default download directory was set to: /var/lib/transmission/Downloads
Running:
Code:
stat /var/lib/transmission/Downloads
Gives us:
Quote:Access: (0755/drwxr-xr-x) Uid: ( 495/transmission) Gid: ( 492/transmission)
Then we run:
Code:
stat /Torrents
Gives us:
Quote:Access: (0755/drwxr-xr-x) Uid: ( 500/ Mark) Gid: ( 500/ Mark)
We can confirm what user the deamon runs as by checking the start up script.
Code:
find / -iname "transmission-daemon
Code:
less /etc/rc.d/init.d/transmission-daemon
You can also find this user if you run:
Code:
cat /etc/passwd
Quote:transmission:x:495:492:transmission daemon account:/var/lib/transmission:/sbin/nologin
We want to give the user transmission access to the completed downloads folder, is this case we'll grant it on it's parent folder which is: /Torrents
For this we have to create a new group, we will call it TorrentsRW.
Code:
groupadd TorrentsRW
Code:
usermod -a -G TorrentsRW Mark
Code:
usermod -a -G TorrentsRW transmission
Check that they were added to the group
Run the command:
Code:
groups Mark transmission
Output:
Quote:Mark : Mark TorrentsRW
transmission : transmission TorrentsRW
Set the user owner of the /Torrents folder to transmission and the group onwer to the TorrentsRW group:
Code:
chown transmission:TorrentsRW /Torrents
Run stat again now:
Code:
stat /Torrents
Gives us:
Quote:Access: (0755/drwxr-xr-x) Uid: ( 495/transmission) Gid: ( 501/TorrentsRW)
Set permissions on the folder to rwx rwx r-x
Code:
chmod -R 775 /Torrents
Run stat again now
Code:
stat /Torrents
Gives us:
Quote:Access: (0774/drwxrwxr--) Uid: ( 495/transmission) Gid: ( 501/TorrentsRW)
Make new files created inside that directory inherit the parent's user ownership.
Code:
chmod -R u+s /Torrents
Another option is to set it to inherit group ownership but that didn't seem to work as well.
Code:
chmod -R g+s /Torrents
Run stat again now
Code:
stat /Torrents
Gives us:
Quote:Access: (2774/drwxrwsr--) Uid: ( 495/transmission) Gid: ( 501/TorrentsRW)
Whenever you add a new Torrent in the web interface the folder that it makes gets these permissions though ...
Quote:Access: (2755/drwxr-sr-x) Uid: ( 495/transmission) Gid: ( 501/TorrentsRW)
Which means that the user transmission can read / write but the TorrerntsRW group can only read..
I still haven't figured that out.. I will most likely just switch to using Deluge which may not have this problem.