Raspberry Pi Basic Configuration (What Worked for Me)
This post is only intended to share what I did with my new Raspberry Pi in order to get it to work as a dedicated server for my external hard drive and as an always-on torrent server.
All the steps described here will take you from a brand new Raspberry Pi (already connected) to a system that has been configured, hostname and password changed, static IP set, torrent server and client downloaded and installed, external hard drive mounted and share established.
Most of the steps here are the direct result of web searches, I knew nothing of Linux or Raspberry before this. But I had to search countless web pages, adapt some things, go through tons of forums, etc to get the results I got. Therefore, I think putting up this summary could be helpful to some people that do not have the time, nor the inclination, to spend the ridiculous number of hours I had to in order to make this work.
I will put a reference to all the web pages I used that I found useful throughout this document.
Anyway, here it is.
Step 1: Create an SD Card
1.1 Get an SD Card of at least 8GB.
1.2 PC: download Win32DiskImager.
1.3 PC: download latest Raspbian. I used a Raw Image of Wheezy.
1.4 PC: insert SD Card, run Win32DiskImager and create an image using the Wheezy file.
1.5 Now you have a working Raspbian SD Card.
Step 2: Connect your Raspberry Pi
I will not go into any detail here. You need to connect your Raspberry Pi to a monitor via HDMI, connect a USB keyboard, insert the SD Card, connect the external hard drive (has to have its own power), a working LAN cable and connect the power supply.
After a long running text list, it will open into its main configuration screen. With the keyboard, do the following:
2.1 Expand filesystem
2.2 Select your internationalization options (especially because of clock)
2.3 Change hostname to something more personal (like rasp, raspi, etc)
2.4 In advanced options you need to activate SSH (it is on by default, but be sure to check ot)
2.5 Finalize and let the system reboot
2.6 Login with the defaults: user = pi, password = raspberry
2.7 When the system is awaiting your command, write ifconfig. Write down the last octet of the IP address (192.168.1.xx).
With this achieved you wont need to do anything else on the Raspberry Pi itself, everything else is done via Telnet (SSH) from your PC.
Step 3: Connect to your Raspberry using Putty and finish configuration
3.1 Download Putty. Open it and select SSH, write the full IP address (192.168.1.xx) and connect.
3.2 A terminal screen opens with login and password. Again, and for the last time, use the defaults.
Step 4: Change Password
Step 5: Update the operating system
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install ntfs-3g
Step 6: Set static IP
Make sure you select the IP you want (replace 192.168.1.10 with 192.168.1.xx), and remember it. Once you reboot your Raspberry, this will be the new IP you will need to use in Putty to Telnet in.
Step 7: Mount external Hard Drive
7.1 Create a drive where the external disk in mounted: sudo mkdir /mnt/disk1
7.2 Mount drive: sudo mount -t ntfs-3g /dev/sda1 /mnt/disk1
Step 8: Install and Configure Samba (to access network share)
8.1.1 sudo apt-get install samba
8.1.2 sudo apt-get install samba-common-bin
8.2 Remove, recreate and open config file
8.2.1 sudo rm /etc/samba/smb.conf
8.2.2 sudo nano /etc/samba/smb.conf
8.2.3 copy the following text into the blank file
workgroup = workgroup
server string = %h
wins support = no
dns proxy = no
security = share
encrypt passwords = yes
panic action = /usr/share/samba/panic-action %d
path = /sites
writeable = yes
browseable = yes
read only = no
guest ok = yes
force user = root
comment = USB Share
path = /mnt/disk1
writeable = Yes
only guest = Yes
create mask = 0777
directory mask = 0777
browseable = Yes
public = yes
8.3 Restart Samba
8.3.1 sudo service samba restart
You should be able to open a file explorer window and connect to \\192.168.1.xx\ and see a folder called “External_1”.
9. Install and configure Deluged
9.1 Install deluged
9.1.1 sudo apt-get install deluged
9.1.2 sudo apt-get install deluge-console
9.2 Start and stop daemon (to create profile configuration file)
9.2.2 sudo pkill deluged
9.3 Configure daemon for your profile
9.3.1 sudo nano ~/.config/deluge/auth
9.3.2 replace only string (localhost, etc) with ::10 (eg: pi:mypass123:10)
9.4 Configure daemon for external access
9.4.3 config -s allow_remote true
9.5 Stop and start daemon (to start with new parameters)
9.2.1 sudo pkill deluged
9.6 Configure Deluge Thin Client
9.6.1 In your external hard drive connected to the Raspberry, create a folder in the root drive called “Torrent” and two subdirectories called “Complete” and “Partial”.
9.6.2 Download client
9.6.3 Run Deluge
9.6.4 Go to Prefences–>Interface–>Unclick Classic Mode Enable
9.6.5 Restart Deluge Thin Client
9.6.6 On the connection manager, erase the local host option
9.6.7 Create a new option: Add and in the new window, the hostname is the Raspberry’s IP (192.168.1.xx), the user and password are pi and the new password you created. Leave the port unchanged.
9.6.9 Go to Preferences–>Downloads and set the drives to /mnt/disk1/Torrent/Partial, /mnt/disk1/Torrent/Complete, /mnt/disk1/Torrent, /mnt/disk1/Torrent in that order.
10 Create a backup of your SD Card
10.1 Once everything is working, a good idea is to create an image of the SD card in case something goes wrong. I’ve had to recreate this 3 times already.
10.2 Use Win32DiskImager in reverse.
10.2.1 Find the directory where the Wheezy image is. Make a copy in the same directory.
10.2.2 Rename this file “SD Card Backup”
10.2.3 Insert the SD Card in the reader
10.2.4 In Win32DiskImager select the file and select “Read”, which will copy the SD Card image into the file.
If you ever need to reflash the SD Card, you will start at a place where you have already configured the system.
Good Luck! Let me know if this worked for you.