Smoothwall Firewall project

Showing posts with label bitorrent. Show all posts
Showing posts with label bitorrent. Show all posts

Sunday, 31 August 2014

Using Docker to run rtorrent to reduce your servers resource requirements



Let me state early and clearly , any one who thinks Docker is a new technology, knows nothing about IT and even less about virtualisation. So if some smartalec in your office starts spouting about this new technology, take them down a peg or two with a few links to Solaris containers, OpenVZ or LXC.

What the Docker team have done extremely well, is make these ancient technologies very accessible and very easy to use, with a well defined tool set and API. This they must be highly praised for.

In the words of Einstein however, they work on the shoulders of giants, who did a lot of the heavy lifting, and let us all not forget this.

I have been using containers for years, and we worked on a very successful cloud at Nokia using OpenVZ, where we built our own tools.

So I thought I would give Docker a spin on one of my cloud servers and just kick the tyres to start. I picked an application I use a lot for downloading Linux ISO's so it seemed a good choice. It was very straight forward indeed.

The host operating system was CentOS 6.5 - which I'm growing less fond of as each week passes, as in the fast moving cloud space, Ubuntu is simply better. It was installed however, and I couldn't be bothered to change it. You need to enable the EPEL repository and install docker with yum.

I decided to download and use the userland tools of a Docker Ubuntu image - but whatever image you choose - the host kernel is the one that will be used. This is to do with the historically well thought out ABI built into the Linux kernel that allows this all to work.



Once the image was retrieved from the Docker registry - I fired up a container with Ubuntu 14.04 tools and installed screen, rtorrent , vim and htop.

I always run rtorrent with screen so I can just leave it running and come back to it when required. Also importantly - when starting your container use /bin/bash so you can have an interactive session with it to be able to go back and check your screen/rtorrent session. A command like the following will do.

docker run -i -t my-ubuntu-image /bin/bash

Be care however when you want to exit this container , DON'T type exit but CTRL-p, CTRL-q , so everything keeps running and you can reattach to the container when you wish to check on progress.

This uses significantly less resources than spinning up a KVM virtual image to do the same job, as it uses the resources of the host system that are already running.

I have deliberately not put all the commands need to do this here , as the Docker documentation is good and very clear, so duplication is pointless




Thursday, 30 June 2011

Using rtorrent on a remote Centos server for 24/7 downloads




As I'm sure you all know a lot of information is passed around the Web using bittorrent. Most of the clients have a nice GUI front end that allow you to easily grab the torrent files and start downloading.

What if you don't have a GUI on the machine you wish to use, or what if this is to be a 24/7 service for you. Well Linux as always has solutions, and one of those is a program called rtorrent. If you only like flashy interfaces this is not for you, but it works perfectly, and is very reliable.

I use a Centos 5.6 virtual server in the cloud for all sorts of uses, like a socks proxy and an SSL endpoint, and this is where I wanted to run the client. This machine is not very powerful, so you don't need to worry on that score. There are many Linux virtual machines you can obtain these days, for not a great deal of money.

Firstly, you need to visit this web site and download three RPM's.
Site for RPMS

libsigc++20-2.0.17-1.el5.rf.x86_64.rpm
libtorrent-0.12.6-1.el5.rf.x86_64.rpm
rtorrent-0.8.6-2.el5.rf.x86_64.rpm

Now, depending on how you configured your machine, there may be other dependencies, so check when you install these as follows

rpm -ivh *.rpm

Once this is done, I would then also make sure that the "screen" application is installed, as this will allow you to start rtorrent on the remote server, and re-connect to it when you desire. Spend a few moments looking at "screen" commands on the web to understand how it fits together - like here.

Using Screen

So now, I run screen and then I run rtorrent.

Once rtorrent is loaded, read this web page for an excellent quick guide to using the application:

How to use rtorrent as pro

Once you have your torrent running, you can detach from your screen session, with the CTRL-A d command. You can now logout of remote server, and all is still running.

To re-connect, you just login to the remote server again, and then run screen -r, and you will be back looking at rtorrent happily running.

This is very useful for downloading Linux ISO distribution files etc.