Slackware ARM on a Raspberry Pi
Install rTorrent on Slackware ARM on the Raspberry Pi
This SARPi project will enable you to install, configure, and run rTorrent on Slackware ARM 14.2 or -current on a Raspberry Pi 1, 2, or 3. rTorrent is a ncurses BitTorrent client which uses the libTorrent library and is written in C++. It's a command-line text-based client which has almost no overhead, uses minimal resources, and is programmed with an emphasis on speed and efficiency, while delivering equivalent features to those found in GUI based clients. rTorrent supports the saving of sessions, partial downloading of multi-file torrents, and allows the user to add and remove torrents on-the-fly. BitTorrent protocol encryption, PEX, DHT, and initial seeding is also supported.
What you will need for this project
• A Raspberry Pi 1, 2, or 3 Model A/B running Slackware ARM 14.2 or -current.
• curl installed on your system (installed by default during Slackware ARM setup if it wasn't omitted).
• libsigc++ installed on your system (installed by default during Slackware ARM setup if it wasn't omitted).
• libtorrent-0.13.6 Slackware ARM package.
• rtorrent-0.9.6 Slackware ARM package.
The Slackware ARM packages required to complete this project are available from SARPi Downloads.
For the purpose of this tutorial we will be using a Raspberry Pi 3 Model B which has the HOSTNAME 'drie'. As we're intending to use our system as a BitTorrent client/file server, and needing a little storage space, we've installed Slackware ARM -current on a Kingston SDCA3/32GBSP (32GB) microSD card. This means we will have adequate amounts of free space for storing data. You might want to think about the kind of storage space you're going to need and if a microSD card alone is going to suit your requirements. At least a 16GB microSD card is recommended. If you'd like to mount an external USB hard drive and use that as dedicated storage space for your files then that's very possible and easy to achieve. The most important thing is to use a powered hard drive with its own PSU, or a powered USB hub, and not one that takes power from the USB port(s) on the Raspberry Pi. The Raspberry Pi cannot supply enough power to an external USB hard drive for it to operate adequately.
Installation and configuration
So, let's get started. First, you're going to log in as 'root' user and 'cd' to the /tmp directory:
It's always good policy to check the current system time is relatively accurate, using the 'date' command, and make sure your system is up-to-date by running 'slackpkg update' and/or 'rpi-update' before installing any new software on your Slackware ARM system.
The first thing you should do is check to see if curl is installed on your system. Do this by typing the following command(s):
Or, you could also do this:
The results from these commands will let you know if you already have curl installed...
If you don't already have curl then type the following command to install it:
Press the < Enter > key when the message appears informing you that curl is a package ready to be installed and it shall be done.
Notes for Slackware ARM packages: Make sure, when you are downloading your own individual packages, to only install package(s) for the Slackware ARM version you're running. Packages that are built for -current hard float port will not work with 14.2 soft float port (and vice versa).
Slackware packages are always easily identifiable by their filenames. So, whether the package is built for -current hard float port or 14.2 soft float port can be seen in the filename _tag_; 'slack14.2' and 'slackcurrent'.
e.g. rtorrent-0.9.6-arm-1_slack14.2_fd0.txz and rtorrent-0.9.6-armv7-1_slackcurrent_fd0.txz
To understand more about the anatomy and structure of Slackware packages, and building/installing/manipulating them yourself, there's an excellent "Introduction to Slackware packages by Stuart Winter" (PDF) available.
Now you need to check if you have libsigc++ installed on your system. This package is included when performing a full install of Slackware ARM 14.2 or -current. So, if you've carried out a full installation, libsigc++ should already be installed. To verify that you have it, use the following command:
If you can see a libsigc++ package listed, then skip to the next section of this page - Install libTorrent.
If you don't locate libsigc++ on your system then, before going any further, you should download and install the libsigc++-2.10.0 package now! This software implements a typesafe callback system for standard C++.
To download and install libsigc++-2.10.0 on Slackware ARM -current use the following commands:
root@drie:/tmp# installpkg libsigc++-2.10.0-armv7-1_slackcurrent_fd0.txz
To download and install libsigc++-2.10.0 on Slackware ARM 14.2 use the following commands:
root@drie:/tmp# installpkg libsigc++-2.10.0-arm-1_slack14.2_fd0.txz
When installation is complete, you should see something similar to the screenshot below:
With libsigc++ installed on your system, you need to download the following packages and install them in the order shown here.
The reason why you need to install these packages in this order is because;
rTorrent is dependant on libTorrent, is dependant on libsigc++, is dependant on curl, being installed.
So, now you need to download and install the libtorrent-0.13.6 package. This software is an open source implementation of the BitTorrent protocol, written in C++.
To download and install libtorrent-0.13.6 on Slackware ARM -current use the following commands:
root@drie:/tmp# installpkg libtorrent-0.13.6-armv7-1_slackcurrent_fd0.txz
To download and install libtorrent-0.13.6 on Slackware ARM 14.2 use the following commands:
root@drie:/tmp# installpkg libtorrent-0.13.6-arm-1_slack14.2_fd0.txz
When installation is complete, you should see something similar to the screenshot below:
To download and install rtorrent-0.9.6 on Slackware ARM current use the following commands:
root@drie:/tmp# installpkg rtorrent-0.9.6-armv7-1_slackcurrent_fd0.txz
To download and install rtorrent-0.9.6 on Slackware ARM 14.2 use the following commands:
root@drie:/tmp# installpkg rtorrent-0.9.6-arm-1_slack14.2_fd0.txz
When installation is complete, you should see something similar to the screenshot below:
If there were no errors then you're done with installing software. You should keep/save/backup these installed packages in case you ever need to install them again, or remove them from the system. You can also delete the downloaded packages if you prefer by using the 'rm' command. Be VERY careful while using this command as 'root' if/when you do!
Now you should log out from being 'root' because the next task is to configure rTorrent to run on your Slackware ARM system. You need to do this as a normal user and not 'root'. So, you'll be logging in as the username that you wish to run your rTorrent client under. If you don't yet have a normal user account (i.e. not 'root'), SHAME ON YOU!!! Should you need to, create one now (for example purposes we'll name our normal user 'dave') and add a new user to the Slackware system like this:
You'll be asked a few questions and you can fill in each field as required. Alternatively you don't have to fill in any of the fields when asked and can just hit the < Enter > key to skip through them. Until the password. When you are asked for a password you need to enter it twice. Then the user is all set up and ready to be used. You should see something similar to the screenshot below.
Type 'exit' and press the < Enter > key to logout from being the 'root' user.
Configuring rTorrent for Slackware ARM
Login to your normal user account. We've logged in as 'dave' for the purposes of this tutorial. You might have noticed that we're logging in remotely, via ssh. It makes no difference at all to this tutorial, or Slackware ARM, or rTorrent, how you log in. ;-)
When you login you should already be in your home/user directory. You're going to make sure by typing:
You're going to create a directory named 'rtorrent' and 3 new directories inside of it, all within your home/user/ directory. These are required and will be used for; storing downloads and shared data, storing session cache data, storing *.torrent files. You can name them anything you like but we've chosen our own folder names which helps us to identify them easily.
dave@drie:~$ mkdir rtorrent/downloads
dave@drie:~$ mkdir rtorrent/session
dave@drie:~$ mkdir rtorrent/torrents
dave@drie:~$ ls -lah rtorrent
Or, a "cut-n-paste" one-liner for those who are in a hurry:
Type 'ls -lh rtorrent', if you didn't use the one-liner command, and press the < Enter > key to list the contents of the rtorrent/ directory. You should see the 3 new directories which you've just created, similar to the screenshot below:
So, you should now have your rTorrent directories set-up.
Next you're going to need the all-important rtorrent.rc config file. rTorrent will not work without it. This file contains all the settings and parameters for rTorrent. You are going to configure some of those settings.
Download this example rtorrent.rc configuration file into your /home/user/ directory:
This configuration file needs to be renamed in order for rTorrent to recognise it. Rename the file by putting a dot "." infront of the filename, like this:
dave@drie:~$ ls -lah
And you should be looking at something very similar to the screenshot below, given that there may be other files and folders within your /home/user/ directory. Just make sure the .rtorrent.rc file has a dot "." in front of the filename.
Now you need to configure rTorrent and specify the new directories you've created as the ones you want to use, within the .rtorrent.rc config file. You're going to use 'nano' to achieve this:
Set the speed of your torrent downloads and uploads in the section highlighted by the red dashed surround in the screenshot below. You also need to remove the hash "#" from the beginning of the lines as shown. The value you set for upload shouldn't be too high but then you'll know best where your Internet connection speeds are concerned. A setting of "0" (zero) means there is no limit.
Next, set the directory where your uploads and downloads will be stored. Here we use a full path, as shown in the screenshot below, but a relative path would work too. Remember to remove the hash "#" from the beginning of the line. The directory which you are using for storing downloaded torrent files/data is the path you need to set here:
Now specify the path to the directory where the session cache data will be stored. Session data contains the statistics of your latest torrent activity; the size of the download(s), how much has been download/uploaded, etc. So the directory you are using for this is the path you need to enter here. Remember to remove the hash "#" from the beginning of the line as shown below:
Next you need to set a 'watch_directory' where you should keep any currently active torrents. This is the directory where rTorrent looks for *.torrent files and if it finds any it will automatically load them. The directory you are using to store your *.torrent files is the one that needs to be set here. Again, we have used a full path to our .torrent directory. Remember to remove the hash "#" from the beginning of the line.
If you need to set a specific port_range then specify it as shown in the screenshot below. You can use just a single port by specifying 'port_range = 6982-6982' (for example) here. You may assign any port(s) which are not currently being used by the system for other purposes. Remember to remove the hash "#" from the beginning of the line.
When you have finished editing the .rtorrent.rc config file, press the CTRL+X keys, type "Y" (yes) when asked to save the file, and then press the < Enter > key to save and exit.
That's the rTorrent configuration all done. Providing you've specified the correct paths to the directories you should be all setup to run rTorrent. So get ready to "rock 'n' roll" with your new BitTorrent client, rTorrent! ;-)
Running rTorrent on Slackware ARM
Before running rTorrent here's a simple few words of advice, which is common sense really; NEVER download more data than what you have storage space for. Your Slackware ARM system (or any other system for that matter) does not take kindly to you filling up partitions to the hilt! Make sure what you're downloading isn't going to take up your entire storage space.
Having experience with 'screen' will give you a distinct advantage while running rTorrent. 'screen' is a tool that comes with Slackware by default and doesn't need installing. If you've never used 'screen' before, or don't know much about it, there's a very good "How To Use Linux Screen" video tutorial on YouTube that might be helpful. The video starts at 2:48 because the maker of the video is installing 'screen' up until then and not using Slackware anyway. The rest of the tutorial is very informative and educational.
So, you're going to need some *.torrent files to use with rTorrent. For the purposes of this tutorial we will download the Slackware 14.2 DVD ISO and Slackware64 14.2 DVD ISO torrents from the official Slackware.com website. Of course, you can use your own *.torrent files from this point forward.
You can 'cd' to the rtorrent/torrents/ directory before downloading any *.torrent files. Just so you know they are in the right place. This is the directory where all your *.torrent files must be in order for rTorrent to pick them up. Whenever you download new *.torrent files you must put, move, or copy them into this directory.
dave@drie:~/rtorrent/torrents$ wget http://www.slackware.com/torrents/slackware-14.2-install-dvd.torrent
dave@drie:~/rtorrent/torrents$ wget http://www.slackware.com/torrents/slackware64-14.2-install-dvd.torrent
Typing 'ls -lh rtorrent/torrents/' should show you this...
As you can see from our example screenshot above, there's two Slackware 14.2 .torrent files, in the /rtorrent/torrents/ directory, all ready for rTorrent to use. So without further ado, run rTorrent right now, but don't run it from your current login session. Run it in a 'screen' session. (Have you watched the YouTube video on how to use screen yet?)
To start a new 'screen' session, give it a name (ID), and start the rTorrent client running within that screen session, type the following at the command prompt...
screen -S rtorrent = You're telling the system you want to start a new screen session and name that screen session 'rtorrent'. screen [option] [PID], where [option] is "-S" (i.e. Start a new screen session) and [PID] is the name (i.e. rtorrent) by which to identify it.
Please, if you're not already familiar with 'screen' then do yourself a favour and watch the YouTube video on how to use screen. It's a simple, low-level, program that's very handy indeed. Not just for rTorrent.
What happens next is... rTorrent comes to life!
Apologies for our display not being wide enough here. :-(
You'll see statistics on your current downloads and shared data. You also see a lot of other info such as throttle, rate, ports, and [U]/[D]/[H]/[S]. This tutorial is not going to get into what everything does and how to use it. That's for you to educate yourself with, and the best place to find out how to use rTorrent and all of its functions is the rTorrent Wiki on the libtorrent and rTorrent Project website. There's also other tutorials and guides by community members which you may find useful. It's advisable to read up on rTorrent commands and functions in order to understand and gain the best experience from using it.
You can detach from this screen session that rTorrent is running in and download more torrents, putting them in the rtorrent/torrents/ directory the same as you did before, and you can do all this while rTorrent is still running. To detatch from a screen session press 'CTRL+A+D' keys and you'll find yourself back at the command prompt. If you get a message saying "no other window" just try the 'CTRL+A+D' key combination again.
Once you're back at the command prompt you can download/copy more *.torrent files to the rtorrent/torrents/ directory. Do this exactly as you did earlier in this tutorial, whichever way is easiest for you. As an example, we downloaded a Slackware 14.1 DVD ISO .torrent into our torrents directory. A few seconds after that we took the screenshot below:
Any *.torrent file you put in the rtorrent/torrents/ directory will automatically be picked up by rTorrent. At which time downloading (leeching) and uploading (seeding) will commence. You can set up to share (upload) rather than download first if you already have the complete torrent data. To do this, copy the downloaded torrent data into the rtorrent/downloads/ directory and then copy the associated *.torrent file to the rtorrent/torrents/ directory. The *.torrent will be loaded and, after hashing has successfully completed, your shared data will become available for others to download. This saves having to download the entire associated *.torrent data again. So, keeping a backup of all your *.torrent files is probably a good idea.
There's an impressive array of settings, features, and functions within rTorrent that allows you to easier control and fine-tune this BitTorrent client. Read the rTorrent and libtorrent Wiki for more information, if you haven't already done so.
So, sometime you'll want to get back into the screen session running rTorrent. You can view a list of active screen sessions by typing the following command:
To get back into the rTorrent screen session use the following command: 'screen -x rtorrent'
This will re-attach you to the screen session you've named 'rtorrent' which your rTorrent client is running in. Running rTorrent in a screen means you can detach from the session and leave it running whilst you perform other tasks, or even log out altogether and go walk the dog, or maybe watch a movie with a beer. Then for as long as you leave the Raspberry Pi powered on, or exit the 'screen' session, rTorrent will just run all on its own. Any 'screen' session will remain active until you 'exit' that screen or shut down/reboot the system.
Screen is certainly something you'll want to learn and know about because it's so useful for so many purposes. You'll probably find that once you start to use it, you'll wonder how you ever managed without it. Screen has that kind of effect on its users.
Eventually your torrent downloads are going to complete and you'll see the word "done" is displayed underneath the torrent name. Although any *.torrent data is no longer downloading others may be leeching (downloading) from you.
When you want to shut down the rTorrent client, press 'CTRL+Q' keys to quit. You will find yourself back at the command prompt but still in the screen session named 'rtorrent'. To quit this screen session simply type 'exit'.
If you're wondering what happened to the Slackware 14.1 DVD ISO torrent download... we removed it as it was only an example to show how rTorrent works. :-p
From the screenshot above you can see our downloaded ISOs are all present and correct. They are now ready to be burned onto a DVD and installed on some very lucky computer hardware. ;-)
Because we love Slackware at SARPi.co.uk, and want to share it as much as possible, we will keep our screen session and rTorrent client running so that others may benefit and share from us, from that which we gained by others sharing with us. We urge you to do the same.
This concludes the rTorrent SARPi project. If you've followed this tutorial and now have rTorrent installed and running successfully on Slackware ARM on a Raspberry Pi 1,2 or 3, "WELL DONE to you!" Great work!
Thanks & Credits!
Thank you for reading and taking part in this fun little project. We trust other Slackware ARM users will find it useful, informative, interesting, and hopefully educational. We sure did here at SARPi.co.uk while we were creating it.
Credit and a HUGE "thank you" to alienBOB for his libsigc++.SlackBuild script; and, as always, Stuart Winter for his ceaseless efforts towards Slackware ARM. Without you guys, and the work you do, this project would not have been possible. <3