How to make a Raspberry Pi VPN Torrent box
Note, this guide is intended to instruct users on how to build a PIA VPN/Torrent box for the sharing of legal torrent files ie those which do not violate copyright eg Linux ISOs and other freely distributed software. This guide assumes you have a Raspberry Pi 3 Model B with the Raspbian Jessie Lite OS installed. This will be a headless server build so when you log in type raspi-config, go to Advanced Options, Memory Split, set it to 16 and then click OK and exit. You'll need to set your pi with a static IP. This can be done by modifying /etc/dhcpcd.conf and adding something like the below:interface eth0
static ip_address=192.168.1.122/24
static routers=192.168.1.254
static domain_name_servers=8.8.8.8 8.8.4.4 If you want to use your wireless card instead of your ethernet port use wlan0 in the above example. To connect to your WiFi you'll need to edit /etc/wpa_supplicant/wpa_supplicant.conf and include your SSID and password eg:
network={
ssid="my_wifi"
psk="wifi_password"
} As the pi has limited storage connect it to a NAS so that the torrent files can be stored on there. You can connect to a CIFS share on a NAS by modifying your /etc/fstab file, this will ensure it mounts at boot. Sample fstab entry:
//192.168.1.190/shared /mnt/ cifs user,credentials=/root/.id,_netdev 0 0 The .id file in the above line contains the credentials you use to map to the cifs share in the format of:
username=your_username:
password=your_password PIA VPN
Install openvpn with apt-get install openvpn. Make a directory named openvpn, enter the directory and type wget http://privateinternetaccess.com/openvpn/openvpn.zip. Unzip the file by typing unzip openvpn.zip. Create a password file named pass.txt. The contents of the file will be two lines, first line your PIA username, last name your PIA password. Copy your desired ovpn region file eg US Texas.ovpn to a new file named vpn.conf. In vpn.conf modify the line auth-user-pass by appending the path of your pass.txt file eg auth-user-pass /home/user/openvpn/pass.txt. Also add the relevant path to lines crl-verify and ca prior to the .pem and .crt files eg crl-verify /home/user/openvpn/crl.rsa.2048.pem. Now copy the vpn.conf file to /etc/openvpn/ and overwrite the existing file. To configure the openvpn service to start after a reboot type systemctl enable openvpn@vpn.service. To configure it start right away type systemctl start openvpn@vpn.service. To verify that the VPN is giving you a new IP type curl http://checkip.dyndns.org.
Source Deluge
To install the torrent daemon deluge type apt-get install deluged python-mako deluge-web. The Web-UI will now be available at http://192.168.1.102:8112 or whatever your pi's IP address is. The port is 8112. The default password is deluge. In the Web-UI you can configure download preferences and proxy settings etc. I will leave that configuration up to you. To configure the daemon to launch at startup takes a bunch of steps. These are documented in the below source under the section titled "Configuring Deluge to Run on Startup".
Source