RuTorrent on Raspberry Pi

After publishing RTorrent on Raspberry Pi, I did not have enough time to try anything new with the Raspberry Pi, I got requests later to get RuTorrent working with RTorrent on Raspberry Pi.

I decided to use a bash script based setup instead of step by step because it will end up having the same result but with better security measures as the script is written by a much-experienced person and maintained actively.

I would recommended doing this on a clean install for best result.

This setup will contain

  1. libtorrent/rtorrent (Latest/Compiled)
  2. SSH port reassigned
  3. VSFTPD (FTP client) random port assigned
  4. Webmin (Optional) (Admin interface)
  5. autodl-irssi
  6. rutorrent (Web UI)

Download the script

sudo bash -c "$(wget --no-check-certificate -qO - https://raw.githubusercontent.com/arakasi72/rtinst/master/rtsetup)"

Run the script

sudo bash rtinst.sh

The script would respond shown below

Raspbian GNU/Linux 8.0 (jessie)

Your Server IP/Name is 192.168.0.200

Is this correct y/n? 

Choose y

The next response would be to add a password to secure the web interface to the user pi

Set Password for RuTorrent web client
 Enter a password (6+ chars)
 or leave blank to generate a random one
 Please enter the new password:

The next response can take some time depending on the SD card speed and active tasks running in the background

No more user input required, you can complete unattended
 It will take approx 10 minutes for the script to complete

Updating package lists

The final response after the process

crontab entries made. rtorrent and irssi will start on boot for pi

ftp client should be set to explicit ftp over tls using port 48915

If enabled, access https downloads at https://192.168.0.200/download/pi

rutorrent can be accessed at https://192.168.0.200/rutorrent
rutorrent password as set by user
to change rutorrent password enter: rtpass

IMPORTANT: SSH Port set to 26828 - Ensure you can login before closing this session

The above information is stored in rtinst.info in your home directory.
To see contents enter: cat /home/pi/rtinst.info

To install webmin enter: sudo rtwebmin

PLEASE REBOOT YOUR SYSTEM ONCE YOU HAVE NOTED THE ABOVE INFORMATION

Note down the changed SSH and FTP port before exiting the SSH session, the script adds these information to a file named rtinst.info for later access.

ftp client should be set to explicit ftp over tls using port 43915
 If enabled, access https downloads at https://192.168.0.200/download/pi
 rutorrent can be accessed at https://192.168.0.200/rutorrent
 rutorrent password as set by user
 to change rutorrent password enter: rtpass
 ssh port changed to 21828

The script does even more, it adds various options and update functionality with the help of rtadmin

sudo rtadmin

It would respond with these options

Select from the following options:
 1.) rtgetscripts - update the rtinst scripts
 2.) rtadduser - add new user
 3.) rtremove - delete a user
 4.) rtdload enable - enable http downloads
 5.) rtupdate - up/down-grade rtorent/libtorrent
 6.) rutupgrade - upgrade to latest version of RuTorrent
 7.) rtwebmin - install webmin
 Enter option or q to quit

Doing this whole process manually would take a lot of steps and longer time, this script does more and simplifies, things like update, upgrade plugin management, thanks to arakasi72, the repository of the script is on GitHub

If you have more requests for such posts let me know in a comment or contact directly for feedback.

Gogs on CentOS

Gogs also known as Go Git Server is an open source cross-platform self-hosted Git server written in Golang, similar to the GitLab which is written in Ruby. It is easy to install and configure and offers a lot of customization options while installing, it lets you choose between MySQL, SQLite, and PostgreSQL as a Database backend. It is also one of the lightest and fastest self-hosted Git server solutions, it does not offer a lot of features like GitLab, but whatever it offers, it does it without pain. If you don’t already have a CentOS server, you can get a VPS on Digital Ocean, by signing up with this referral you get $10 credit and I get $25 credit. Installing Gogs is easy it’s available as a pre-compiled package from Packager. It receives updates like every other package you would install on your system. So you can do the setup once and receive an update on new builds. This setup being pre-build, might not support SQLite, for this guide, I am using MariaDB. You can use PostgreSQL over MariaDB if you prefer it.

Getting started.

Adding Gogs repository key.

sudo rpm --import https://rpm.packager.io/key  

Add Gogs packager.io repository to your local packages database.

echo "[gogs]  
name=Repository for pkgr/gogs application.  
baseurl=https://rpm.packager.io/gh/pkgr/gogs/centos7/pkgr  
enabled=1" | sudo tee /etc/yum.repos.d/gogs.repo  

Installing Gogs

sudo yum install gogs

Installing MySQL

sudo yum install mysql-server -y  

Setting up MySQL

sudo mysql_secure_installation  

Logging into MySQL console.

mysql -u root -p  

Creating a new Database for Gogs.

CREATE DATABASE gogs;  

Exiting MySQL console.

exit  

Installing NGINX to reverse proxy Gogs to port 80.

sudo rpm -Uhv http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm  


sudo yum install -y nginx  

Editing the NGINX config /etc/nginx/conf.d/default.conf

sudo nano /etc/nginx/conf.d/default.conf  

Add the following lines to your NGINX config.

server {  
listen          80;  
  server_name     ${HOSTNAME};
  location / {
    proxy_pass      http://localhost:3000;
  }
}

Restart NGINX.

sudo service nginx restart  

You can access the newly setup Gogs Server at http://127.0.0.1/, and further configure it to your preference and create your new user, you can now store your projects on your private Git server. Have a question, leave a comment below.

Gogs on Debian

Gogs also known as Go Git Server is an open source cross-platform self-hosted Git server written in Golang, similar to the GitLab which is written in Ruby. It is easy to install and configure and offers a lot of customization options while installing, it lets you choose between MySQL, SQLite, and PostgreSQL as a Database backend. It is also one of the lightest and fastest self-hosted Git server solution, it does not offer a lot of features like GitLab, but whatever it offers, it does it without pain. If you don’t already have a Debian server, you can get a VPS on Digital Ocean, by signing up with this referral you get $10 credit and I get $25 credit. Installing Gogs is easy it’s available as a pre-compiled package from Packager. It receives updates like every other package you would install on your system. So you can do the setup once and receive an update on new builds. This setup being pre-build, might not support SQLite, for this guide, I am using MariaDB. You can use PostgreSQL over MariaDB if you prefer it.

Getting started.

Adding Gogs repository key.

wget -qO - https://deb.packager.io/key | sudo apt-key add -  

Add Gogs packager.io repository to your sources.list.d directory/ For Jessie

sudo echo "deb https://deb.packager.io/gh/pkgr/gogs jessie pkgr" | sudo tee /etc/apt/sources.list.d/gogs.list  

For Wheezy

sudo echo "deb https://deb.packager.io/gh/pkgr/gogs wheezy pkgr" | sudo tee /etc/apt/sources.list.d/gogs.list  

Updating local package database to fetch meta of the new repository.

sudo apt-get update  

Installing Gogs

sudo apt-get install gogs  

Adding MariaDB repository, choose the setup depending on the version of Debian you are using and the closest mirror you prefer, from here.

sudo apt-get update  

Logging into MariaDB console.

mysql -u root -p  

Creating a new Database for Gogs.

CREATE DATABASE gogs;  

Exiting MySQL console.

exit  

Installing NGINX to reverse proxy Gogs to port 80.

sudo apt-get install nginx-full  

Editing the NGINX config /etc/nginx/sites-enabled/default

sudo nano /etc/nginx/sites-enabled/default  

Add the following lines to your NGINX config.

server {  
  listen          80;
  server_name     yourhostname;

  location / {
    proxy_pass      http://127.0.0.1:3000;
  }
}

Restart NGINX.

sudo service nginx restart  

You can access the newly setup Gogs Server at http://127.0.0.1/, and further configure it to your preference and create your new user, you can now store your projects on your private Git server. Have a question, leave a comment below.

WordPress app for Mac/Windows/Linux

WordPress recently announced their clients for Mac, Windows and Linux, this app gives you access to the WordPress dashboard as a native client to the supported platform you are using.

So now you can access all your self-hosted WordPress(requires Jetpack to be enabled) or your hosted WordPress blogs, with the beautifully designed WordPress dashboard.

You can get a copy of the client for Mac, Windows or Linux by simply visiting here, and downloading the client for your system.

Thank you for reading,

If you have any questions feel free to leave a comment below.

PHP 7 on Ubuntu

It has been quite some time since PHP 7 was released, it has major bug fixes, improved and new ways of writing syntax and many other changes you can find here.

So I decided to write a guide on how to upgrade or install and setup PHP 7.x.x on your Ubuntu based system.

This is a major update, this can break your website or web application, please test your website or web application in a development environment before applying this to your production environment.

Installing

Adding PHP 7 ppa to the local database.

sudo add-apt-repository ppa:ondrej/php-7.0  

Updating the local database.

sudo apt-get update  

Installing PHP 7.

sudo apt-get install php7.0 php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-sqlite3  

Now you can run PHP -v in the terminal to check if it has been installed successfully.

Upgrading from PHP 5 to PHP 7.

This will purge PHP 5 and remove unwanted dependencies and then clean up the temporary files

sudo apt-get purge php5* && sudo apt-get --purge autoremove && apt-get clean && sudo apt-get install php7.0 php7.0-cli php7.0-common php7.0-curl php7.0-fpm php7.0-gd php7.0-json php7.0-mcrypt php7.0-mysql php7.0-opcache php7.0-sqlite3  

Switching NGINX to PHP 7 from PHP 5

Edit the NGINX config to work with PHP 7 FPM, go the specific server config and change the following lines.

From this

location ~ .php$ {  
            try_files $uri =404;
            fastcgi_split_path_info ^(.+.php)(/.+)$;
            fastcgi_pass unix:/var/run/php5-fpm.sock;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            include        fastcgi_params;
        }

To this

location ~ .php$ {  
        try_files $uri =404;
        fastcgi_split_path_info ^(.+.php)(/.+)$;
        fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

The only line changed is the fastcgi_pass.

From this

fastcgi_pass unix:/var/run/php5-fpm.sock;  

To this

fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;  

Now all the PHP config files are moved to /etc/php/7.x from /etc/php5/.

So the path to the php.ini is now located in /etc/php/7.x/fpm/php.ini, this means any edits done to the older PHP 5 php.ini need to be re-applied because this is a fresh new in file.

You can restart PHP 7 FPM by entering this command.

sudo service php7.0-fpm restart  

Thank you for reading,

If you have any question leave a comment below.

Linux Kernel 4.3 on Ubuntu

Linux Kernel 4.3 ships with 20.6 million lines of code with support for Skylake lines of CPU by Intel. So Skylake based hardware can run efficiently with good stability.

The performance improvement is noticeable on some hardware’s running this build of Kernel on Ubuntu based Linux distributions (I have not worked on this personally these are according to user reports).

This is a stable release, Linux Kernel 4.4 will be the LTS (Long Term Service) build currently in RC-2.

The steps below can be used on Ubuntu and Ubuntu-based Linux distributions to upgrade the Kernel.

Installing

It’s really easy to install it on Ubuntu or Ubuntu based Linux distributions. But first, you need to know which build you’re using 64 Bit or 32 Bit.

You can check this by using this command.

uname -r  

Download these packages (The install process is the same).

64 Bit. {#64bit}

wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-wily/linux-headers-4.3.0-040300-generic_4.3.0-040300.201511020949_amd64.deb  


wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-wily/linux-headers-4.3.0-040300_4.3.0-040300.201511020949_all.deb  


wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-wily/linux-image-4.3.0-040300-generic_4.3.0-040300.201511020949_amd64.deb  

32 Bit. {#32bit}

wget kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-unstable/linux-headers-4.3.0-040300_4.3.0-040300.201511012034_all.deb  


wget kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-unstable/linux-headers-4.3.0-040300-generic_4.3.0-040300.201511012034_i386.deb  


 wget kernel.ubuntu.com/~kernel-ppa/mainline/v4.3-unstable/linux-image-4.3.0-040300-generic_4.3.0-040300.201511012034_i386.deb

Installing the packages that we just downloaded.

sudo dpkg -i linux-*.deb  

Updating the bootloader.

sudo update-grub  

Now you can reboot the system to switch to the new Kernel you have just installed.

If you have issues this Kernel builds you can uninstall it with a few steps.

 sudo apt-get purge linux-headers-4.3* linux-image-4.3*

Removing dependencies permanently that are not required by the system.

sudo apt-get auto remove && sudo apt-get clean  

Thank you for reading, if you have any questions leave a comment below.