Debian Squeeze – James Batchelor https://james-batchelor.com Useful I.T & VoIP Ramblings Tue, 28 Jun 2016 11:19:27 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.5 https://james-batchelor.com/wp-content/uploads/2025/05/cropped-cropped-logo-jb-202505-32x32.png Debian Squeeze – James Batchelor https://james-batchelor.com 32 32 Raspberry Pi Torrent Server – From Scratch https://james-batchelor.com/index.php/2016/06/28/raspberry-pi-torrent-server-from-scratch/ Tue, 28 Jun 2016 11:19:27 +0000 http://james-batchelor.com/?p=413 Continue reading "Raspberry Pi Torrent Server – From Scratch"]]> As requested, this is a guide to taking a Raspberry Pi and turning it into an always on Torrent box, complete and self-sufficient with its own mass storage meaning it needs no help from other computers. Also, as the Pi consumes such little power compared to a full desktop PC, money can be saved by using the Pi for overnight transfers while other computers can remain off.

piserver1

For this project I recommend a RPi 2, as its powerful enough to perform the transfers up to its maximum 100Mbps network speed, and is a cheaper choice since the RPi 3 superseded it last year. To get started, you need the following hardware:

  • Raspberry Pi 2 board.
  • Micro USB wall adaptor – Needs to be capable of 2Amp output.
  • Micro SD card – Minimum of 8GB, class 6 or above, plus SD adaptor for connecting to a PC.
  • USB Portable Hard drive – USB powered is preferred, I use a Toshiba Canvio Basics 1TB.
  • Ethernet Cable – And spare port on the modem/router for internet connection.
  • A PC – On the same network as the Pi for connection and configuring.

The Pi was designed to as low cost as possible to the user, so apart from the Pi board you may already have everything to run a Pi, and if not these are cheap and easily available online.

With a RPi 2 at hand, let’s get started…

Setup

Before powering on, an operating system is needed on the micro SD card.

Download the latest version of Debian onto a PC and extract the ISO from the Zip file, then download Win32Imager that will transfer the image to a SD card.

Run Win32Imager as an Administrator by right clicking the icon, Win32IMGAdminbrowse and choose the Debain ISO for the image, select the drive letter for the micro SD card, and click write. When complete, move the micro SD card to the Pi and its ready to boot for the first time.Win32Img

Connecting

To make the Pi less obtrusive in the home, it will be configured and run as a headless server, therefore no monitor or Human Interface Devices needed.

Follow this guide I created earlier to get connected and into a terminal window.

Housekeeping

Once connected it’s a fully functional computer, but it’s worth the extra effort to perform some housekeeping to make it easier to connect to by assigning it a static IP, and changing the password for that extra layer of security.

First the essentials, after a fresh install of Debian the filesystem has to be expanded so it can make full use of the micro SD card’s capacity:

In the terminal window, type raspberrypi-config. Then from the menu choose expand filesystem. Reboot the Pi and connect again, now the full capacity is useable.

raspberrypiconfig

Next, and optionally, change the default password:

From the terminal, type sudo passwd, then follow the prompts to change it. No need to reboot.

Next is to assign the Pi a static IP address, allowing it to be found at the same location on the network every time, handy as connecting to the torrent client requires knowing the Pi’s IP address:

From the terminal, type sudonano /etc/network/interfaces to bring up the network config file. In the text editor that opens, find the string beginning eth0, and edit it to look like the following:

staticIP

Where the gateway is the IP address of your router and the address will be the new home of the Pi, for those not familiar with IP addresses, copy the first three numbers from the routers IP address, and for the final number use a number between 150 and 253, this is usually high enough not to interfere with other devices on the network.

Use Ctrl + O to save the file, then Ctrl + X to exit.

Then type sudo reboot to restart the Pi, and now it can be found on the new chosen IP.

Connecting USB Hard Drive

By default the Pi does not supply enough power to the USB ports to power and mechanical drive, but with a little tweak of the settings it can deliver enough to fully power a USB hard drive.

In a terminal, type sudo nano /boot/config.txt

Scroll to the bottom of the file using the F8 key, then add the following new line:

Max_usb_current=1

config.txt

Use Ctrl + O to save the file, then Ctrl + X to exit.

Reboot the Pi by typing sudo reboot.

From a new terminal window, check the drive is connected by typing
sudo blkid, it will appear as dev/sda1

With it recognised, use sudo mkdir /media/HDD to create a folder that will be used as a gateway to the new drive.

Then mount the drive by typing
sudo mount –t auto /dev/sda1  /media/HDD

The Pi can now write to the USB drive for the duration the Pi is powered on, but for simplicity it needs to be available if the Pi reboots…

Configuring & Sharing USB Hard Drive

To allow the drive to automatically mount upon startup, type
sudo nano /etc/fstab to open the file system config file.

Add the following line under the existing entries:

/dev/sda1 /media/USBHDD1 auto noatime 0 0

fstab

Use Ctrl + O to save the file, then Ctrl + X to exit.

Next up is to install samba, it allows the Pi to communicate with windows computers on the network, allowing easy access to downloaded files.

Type sudo apt-get install samba

When installed, open the config file by typing sudo nano /etc/samba/smb.conf

Enter the following information at the bottom of the file:

[Media]
comment = Mass Storage Share
path = /media/HDD
browsable = yes
read only = no
force user = root

Ctrl + O to save the file, then Ctrl + X to exit, then reboot with sudo reboot. When restart completes the Pi can be accessed by typing \\raspberrypi in a folder address bar, or will show as a network device in Windows explorer.

WindowsPi

Installing Transmission

For torrent sharing, Transmission is used as a simple and quick program.

Update the Pi by using sudo apt-get update, followed by sudo apt-get upgrade. These may take a while to complete but ensures the latest software is running, including the latest version of Transmission.

Then type sudo apt-get install transmission-daemon and install the program, pressing Y when prompted.

Configuring Transmission

As you may have guessed, configuring anything in Linux means editing a text file, but first the Transmission service must be stopped to allow changes, by typing sudo server transmission-daemon stop.

Now open the settings by using
sudo nano /etc/transmission-daemon/settings.json

Here are all the settings, but for now scroll (F7&F8 keys) to locate rpc-whitelist, and edit it to include your local ip address range, like below:

torconfig

Then change download-dir and incomplete-dir to point to a folder on the USB hard drive, using /media/HDD/Complete and /media/HDD/Downloading respectively. Be sure to create a Complete and Downloading folder on the hard drive before setting these, this can be done in Windows explorer by navigating to \\raspberrypi .

Also for convenience the password can be switched off by changing
rpc-authentication-required from true to false.

As always, Ctrl + O to save the file, then Ctrl + X to exit.

Using Transmission

The great feature of Transmission is its own web server and that all control is done via a webpage, allowing the Pi to function headless and the torrents managed by any internet capable device.

On another PC, open your favourite browser and navigate to
http://PI-IP:9091 replacing PI-IP with the static address you chose earlier.

From here it’s a fully functional, low cost, low power torrent box. An easy test is to revisit the RPi foundation’s website and download Debian via torrent, then seed it help others discover the wonderful world of Pi.

TorTest

]]>
Connecting to a Headless Raspberry Pi https://james-batchelor.com/index.php/2016/03/25/connecting-to-a-headless-raspberry-pi/ Fri, 25 Mar 2016 13:57:06 +0000 http://james-batchelor.com/?p=373 Continue reading "Connecting to a Headless Raspberry Pi"]]> A great feature of the Raspberry Pi is that it can be fully used as a headless unit, meaning it does not need a monitor, keyboard or any other input device connected. This is great when running it as a server or for automated processes that require the unit to be tucked away.

What is annoying is that setting up the Pi for the first time may need those input devices to be able to configure the network and install applications. Thankfully there is a way to connect to a headless Pi from the start, with it only needing power and Ethernet connection.

Finding the Pi

Most operating systems for a RPi use DHCP on first boot, allowing the machine to connect to the internet automatically. This also means that when booted, the Pi makes itself visible to the network and therefore allow incoming connections. The guess work comes in finding what IP address the Pi was allocated to be able to connect, this is where Angry IP scanner can be used to pinpoint the Pi’s location.

Angry IP Scanner Interface
Angry IP Scanner Interface

Download and run Angry IP scanner on a computer connected to the same router/hub, the IP address range to scan is already entered based on your computers IP address. Click on the Preferences button Angry IP Preferences Button and move to the Ports tab.

In the Ports field, enter number 22, this is the port number for Linux SSH protocol that allows command line controls of a system, and is open on most distributions.

Click OK out of the menus and start the scan.

After the scan is complete a list of all possible IP addresses on the local network is displayed, some will be “alive” connections which are active devices on the network, look for a device with an active port 22 and a Hostname that relates to the Pi or distribution installed on it, like below:

Angry IP Scan

This will be the IP address for the Pi, dependant on the router / hub its connected to, this will remain the same until the router is restarted, so it may be of use to allocate a static IP address to allow easier connections.

Connecting to the Pi

With the IP address found, it’s time to connect to the Pi. To achieve this a terminal program is needed, Windows systems used to have this on all installs but more recently has been relegated to an optional add-on. However, a free and lightweight program called Putty is easily available to make connections to a Linux system.

Download and install Putty, enter the Pi’s address in the IP field and make sure the port number is 22, then hit connect. If it’s the first time connecting, a certificate warning will appear, click yes and the connection is made.

Putty Connection Screen
Putty Connection Screen

Log on using the default credentials of the distribution and full control is made over the Pi, simple a that!

Adding remote desktop control

If controlling the Pi using command line only is a bit daunting, there is a way to simulate the desktop of the Pi on another computer. Setup is via command line but is simple and will get to a desktop environment quickly.

Use Putty to connect and log in to the Pi, then enter sudo apt-get update in the command line, followed by sudo apt-get upgrade when the screen stops scrolling and your able to type commands in again. These actions ensure the operating system is fully up to date.

Next, enter sudo apt-get install xrdp to install the remote desktop server on the Pi, you may have to enter Y to confirm the installation.

Pi running sudo apt-get update
Pi running sudo apt-get update

That’s it for command lines, type exit to finish the session and close Putty. Now from a Windows machine, look for Remote Desktop Connection in the start menu and open.

In the address field, enter the IP address for the Pi and click connect.

Enter the login credentials for the Pi and soon the Pi’s desktop will appear, as if it was a monitor connected directly to the Pi.

Debian Desktop on a remote screen via RDP
Debian Desktop on a remote screen via RDP
]]>
Its Alive! https://james-batchelor.com/index.php/2012/06/17/its-alive-2/ https://james-batchelor.com/index.php/2012/06/17/its-alive-2/#respond Sun, 17 Jun 2012 18:41:19 +0000 http://james-batchelor.com/?p=34 Continue reading "Its Alive!"]]> Finally, 4 days after delivery I finally get my Raspberry Pi powered up and functioning!

P1000684

First off, Debian Squeeze was installed, Samba added and worked out what is could, or could not do. Then it was about deciding what to do with it, first thoughts were a web server to host this Blog, but that was quickly solved by my other purchase of 4GB RAM for my Server.

The second choice was a media server, initially this looked dubious considering its performance when running Debian. But a bit of research yielded a program called xbmc, which in essence is a Linux version of Windows Media Centre. Further searching revelled a new project called Raspbmc, I thought I’d share this:

P1000745
Xbmc running on a Raspberry Pi

Raspbmc is built on a custom Linux platform that boots straight into xbmc and so acts as a purpose media player exclusively for the Raspberry Pi, and is tailored to new users not up to scratch with *nix. So much so it installs to a SD card via a single click of a program running in Windows or Mac OS X.

So far it is in Beta stage but stable, it is clear that the xbmc software on which it is based is designed for more powerful hardware than a RPi, the menus can slow and seem jerky if requesting menus in quick succession, but video playback is unaffected and is just as smooth as my Intel Core i7 laptop.

For now it suits me fine, the Pi as a media player is excellent for my needs. The fact that a quick swap of the SD card changes it from media player to desktop means I still explore Linux through Debian without messing with my current setup.

]]>
https://james-batchelor.com/index.php/2012/06/17/its-alive-2/feed/ 0