rTorrent on Raspberry Pi

rTorrent is a command line ncurses BitTorrent client written in C++, based on the libTorrent. rTorrent is very lightweight and has a very clean command line user interface. rTorrent is also one of the most lightweight BitTorrent clients used by most of the BitTorrent distribution servers. rTorrent is a really good BitTorrent client for Raspberry Pi. rTorrent is lighter and faster compared to BitTorrent clients like Transmission, Deluge and takes lesser CPU resource.

rTorrent performs better on the tests I have done on my Raspberry Pi. The Raspberry Pi I have been using is a Model B.

Let’s get started

Updating your local repository database.

sudo apt-get update

Installing screen and rTorrent. If you are a Tmux user you can go ahead and use it instead of the screen.

sudo apt-get install screen rtorrent  

Now create a rtorrent.rc file.

touch ~/.rtorrent.rc  

Open the file in nano and add the example config below.

nano ~/.rtorrent.rc  

Here is an example config of .rtorrent.rc.

You can edit the `.rtorrent.rc as per your needs.`

Now we can start using rTorrent.

screen rtorrent  

You can detach to the rtorrent screen by typing CTRL + A + D.

To connect back to the rTorrent screen.

screen -r 

To add a BitTorrent simply hit ENTER

Now you have you rTorrent running on your Raspberry Pi. If you have any question feel free to leave a comment below.

Sass on Raspberry Pi

Sass also known as Syntactically Awesome Stylesheets is a stylesheet scripting language that is interpreted into Cascading Style Sheet also known as CSS. Sass consists of two syntaxes, The original syntax, called “the indented syntax”, uses a syntax similar to Haml, It uses indentation to separate code blocks and newline characters to separate rules, it uses a .sass extension, The newer syntax uses block formatting that is similar to CSS, It uses braces to denote code blocks and semicolons to separate lines within a block, the new syntax uses a .scss extension.

Sass is really useful when you have to write a lot of stylesheet for a large project or when you want to write maintainable stylesheet library. Sass offers the following features variables, nesting and mixin.

Raspberry Pi can be a really good dedicated hardware to build and manage Sass based projects.

Installing Sass on you Raspberry Pi is really simple.

Installing Ruby.


sudo apt-get install ruby  

(Arch Linux ARM)

pacman -S ruby  

Exporting Ruby path (Only for Arch Linux ARM), place this in your .bashrc.

PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"  
export PATH  

Installing the Sass gem.

gem install sass --no-ri --no-rdoc  

We can now write our first Sass file.

touch style.scss  

If you prefer SASS then.

touch style.sass  

Once you have added these lines to the file, we can now use sass to compile it.

sass style.scss:style.css  


sass style.sass:style.css  

If you have chosen SCSS view the code below. We are creating a mixin and using it.

@mixin bg($bg-color, $bg-fonts) {
    background-color: $bg-color;
    font-family: $bg-fonts;

If you have chosen SASS view the code.

=bg($bg-color, $bg-font)
 background-color: $bg-color
 font-family: $bg-font

 +bg(#ddd, sans-serif)

The CSS output would look something like this for both files.

body {  
  background-color: #dddddd;
  font-family: sans-serif; }

If you want the Sass compiler to actively watch the file changes and update the output this can be done by a simple command.

sass --watch style.scss:style.css  


sass --watch style.sass:style.css  

Now you have Sass installed and setup on your Raspberry Pi.

Happy Coding!

LEMP on Raspberry Pi

Raspberry Pi is a single board ARM based computer developed in the UK by the Raspberry Pi foundation.

Raspberry Pi can be a really good web server for development/production environment, setting up a LEMP (Linux NGINX MariaDB PHP) stack on a Raspberry Pi running Arch Linux ARM is a really easy.

Why Arch Linux ARM?

Arch Linux ARM comes with the latest stable packages and the most recent firmware available for the Raspberry Pi. Arch Linux ARM is also the least memory consuming OS for Raspberry Pi.

I am assuming you have your Raspberry Pi running Arch Linux ARM with access via SSH.


Updating your Raspberry Pi.

 sudo pacman -Syu  

Once the update is done we can now start installing NGINX Web Server.

 sudo pacman -S nginx  

Installing PHP and php extensions

This will install php-fpm and other PHP extensions. This will also install Composer.

 sudo pacman -S php-fpm php-mysql php-sqlite php-xsl php-tidy php-pspell php-mcrypt php-snmp php-mongo php-pear php-composer php-embed php-enchant php-gd php-intl php-ldap php-odbc xdebug  

Installing MariaDB (MariaDB 10).

 sudo pacman -S mariadb  

Now we need to edit our NGINX configuration to pass files through PHP-FPM, I will be using nano but you can use any editor of your choice.

 nano /etc/nginx/nginx.conf 

Once you have the file opened in nano or you prefered editor, replaces the content with the following code block.

 # nginx.conf for 1.6.xworker_processes 1; # Number of nginx process

events {  
 worker_connections 5000;  

http {

server {

    listen 80;
    server_name localhost;

    location / {
        root /srv/http;
        index index.php index.html;

    location ~ \.php$ {
        root /srv/http;
        try_files      $uri = 404;
        fastcgi_pass   unix:/run/php-fpm/php-fpm.sock;
        fastcgi_index  index.php;
        include        fastcgi.conf;



Enabling NGINX. PHP-FPM, MariaDB to run at the startup of the Raspberry Pi

systemctl enable mysqld.service; systemctl enable nginx.service; systemctl enable php-fpm.service  

Now we can reboot your Raspberry Pi.


Your web-root or the place where your PHP files are stored is

Getting inside the web-root.

 cd /srv/http  

Now we can create an “index.php file.

 touch index.php 

Add the following lines inside the index.php file.

Now visit your Raspberry Pi ip address. This should display a web page displaying LEMP stack information and list of PHP plugins and plugin configurations

Done, Happy Coding!

Jekyll on Raspberry Pi

green and black circuit board

Jekyll is a blog aware static website generator written in Ruby that converts Markdown files into static HTML files. It supports many Markdown interpreter here are some of them RDiscount , Maruku, Kramdown and RedCarpet. Jekyll stores its configuration in a ‘_config.yml’ file that contains information about how to built the static website and which module and plugins should be used, It is one of the most widely used static website generators. It is recommended due to its popularity and large community support and active development.

It also supports plugin to add more functionality and extensions that are not available by default, these plugins can be written in Ruby and can be placed under the ‘_plugins’ folder, The file must end with the ‘.rb’ extension. Any file placed under the ‘_plugins’ folder will be loaded before the website is generated.

It is available as a Ruby gem that installs with its dependencies, It is easy and fast in terms of usage and performance.

Here is how you can get It running on your Raspberry Pi. We will be compiling Ruby 2.1.2 using RVM, we also would be installing Node.js to avoid the ExecJS issue, I have chosen Node.js over the ‘TheRubyRacer’ gem because Node.js is faster more stable and installs in a shorter time than ‘TheRubyRacer’, If you want a pure Ruby based Jekyll setup you can skip the Node.js install step and go with ‘TheRubyRacer’ gem, It’s all based upon personal preference. The big reason why I am compiling Ruby is that I prefer the latest version of Ruby and compiling Ruby make Jekyll and other Ruby stuff, even more, faster due to adaptation to the CPU cycles. I highly recommend not to overclock you Raspberry Pi over 800 MHz as this process uses means of compiling and might cause damage if you don’t have a stable source of power supply.

I have used PiBang Linux Server Edition, but you can use Raspbian. PiBang Linux is based on Raspbian but it does not come with the extra educational software that Raspbian offers, PiBang Linux Server does not come with GUI or Xorg. I have used SSH to follow the instruction below.


Updated: This is method is for Debian Jessie or newer.

sudo apt-get update
sudo apt-get install software-properties-common
sudo apt-get install ruby-full
sudo gem install jekyll
sudo gem install bundler

If you prefer compiling Ruby, follow the setup below.

We need to first install RVM on our Raspberry Pi.

\curl -sSL https://get.rvm.io | bash -s stable

Once RVM is installed we need to exit the terminal.

/bin/bash --logout

Now RVM can be executed.

We can now fetching dependencies needed to compile Ruby on Raspberry Pi. This command will ask you for your user password by default on Raspbian it’s. raspberrypi If you are I PiBang Linux user it depends on what you have set as the password while going through the setup screen, You have to enter the password of the user you what to log in as.

rvm requirements  

Once we have the build essential and the required packages for compiling Ruby on our Raspberry Pi, we can now install Ruby. ‘2.1.2’ is the current latest version of Ruby at the time of this post being published. Installation of Ruby will take a least 2 hours or more depending on the internet connection and clock speed.

rvm install 2.1.2 # installing Ruby  

Now that we have Ruby installed, we can now finally install Jekyll. By choosing not to install ‘ri and ‘rdoc’ we are saving time and avoiding to install thing we don’t require.

gem install jekyll --no-ri --no-rdoc  

To avoid the ‘ExeJS’ error we need to install Node.js on your Raspberry Pi. A precompiled version of Node.js is already available for the Raspberry Pi. You can install Node.js by reading this post. If you want to build Jekyll based website purely using Ruby you can install ‘TheRubyRacer’ gem. TheRubyRacer takes a lot of time to as it needs to build native extensions.

gem install therubyracer --no-ri --no-rdoc  

Now we can create our Jekyll project/website.

jekyll new website # jekyll new   

Now you can get into the directory.

cd website/  

Once you are in the directory you can start the Jekyll preview server.

jekyll serve  

You can now enter your Raspberry Pi IP address with the port set to ‘4000’ example.  

You will get Jekyll running with its stock setup on your web browser.

You can edit the _config.yml and customize the website. You can read the It documentation and learn more about customization over here.

You can deploy your static website that we just created using ‘Glynn’ or ‘Git’, It depends all on you.

Now we have Jekyll installed on our Raspberry Pi. Thanks for reading and feel free to subscribe using RSS. If you have any problem feel free to leave a comment below.

Node.js installation for Raspberry Pi…

Node.js is a brilliant platform for creating network applications. It is mainly known for its non-blocking I/O and event driven system. In simple terms, Node.js can easily handle a large number of requests while simultaneously consuming lesser server memory. These are the attributes one should be looking for in a low power server like, you guessed it, Raspberry Pi. Here, you’ll learn how to setup Node.js for Raspberry Pi.



Raspberry Pi

Why use Node.js?

Node.js comes with a built in HTTP server library. This means it doesn’t require the help of any external piece of software to act as a web-server. Using Node.js alone one can have greater control of the web-server parameters.

Of course, all we care about it tinkering. Cool new web applications require Node.js to function and we like our Raspberry Pi not being a source of heat all the time. Of course, you could check the Wikipedia entry as well as their very own site.

Installing Node.js on Raspberry Pi

1. Download the Node.js package for ARM

As you must be aware, the Raspberry Pi sports an ARM11 chip. So, the package optimised for ARM will have to be downloaded. It can be done by entering the following command into the terminal.

wget http://node-arm.herokuapp.com/node_latest_armhf.deb

2. Install the package

Once the download is complete, it needs to be installed and can be done using the following command.

sudo dpkg -i node_latest_armhf.deb

And that’s it! Quick, wasn’t it?

By its end, we will have NodeJS and NPM (Node Package Manager) installed on your Raspberry Pi.

Testing the installation

The process is pretty foolproof but it wouldn’t hurt to test the installation with a simple server script.

1. Write the server script

Below, we have written a script that displays “Hello World!” to the client.

var http = require('http');
http.createServer(function (request,response) {
 response.writeHead(200, {'Content-Type': 'text/plain'});
 response.end('Hello World!\n');
console.log("Web Server running at")

Update: There’s a chance the code might not appear in with proper line-breaks on your PC. So, here below we’ve enlisted the above code in its right syntax:


#### Save the script in a file

Save the script in a .js javascript file. Something like greetings.js would be a good idea if you’re not feeling particularly creative.

2. Run the script

Use the node program from the command line to execute the server. Something like so.

node greetings.js

You’ll receive an output like this.

Hello World!

If you’d like you could visit and be greeted “Hello World!”.

And that is that!

Stay tuned for more on Raspberry Pi, Node.js and all of the web-apps based on it. Do leave us comments if you’d like us to do anything for you…