Archive for the ‘ Tutorials ’ Category

Headless Ubuntu Server Torrent Box

Install Server Ubuntu 10
During the install, you can usually go with the default options. I chose to install an SSH server, PostregSQL server, and LAMP server. It gives you these options during install.


Create a static IP Address

Once installed modify your IP address to be static so we can always hit the same IP when connecting to our box. Do this by editing your interfaces file.
joel@torrentserver:/$ sudo nano /etc/network/interfaces

Here is what my interfaces file looks like:
(Note: Change the IP address to something that matches your LAN):
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.11.25
netmask 255.255.255.0
network 192.168.11.0
broadcast 192.168.11.255
gateway 192.168.11.1


Additional Hard drive for Data
For my install, I have 2 drive in my linux server to prevent my downloads from filling up my system disk.  This isn’t completely necessary but it’s what I prefer.

By default only the system drive is mounted, so this leaves us to find and mount the extra drive.

List your devicesjoel@torrentserver:/$ sudo fdisk -l
Disk /dev/sdb: 40.0 GB, 40000000000 bytes
255 heads, 63 sectors/track, 4863 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Create a directory to mount our drive:
joel@torrentserver:/$ sudo mkdir /data

Mount the drive to the directory we created:
joel@torrentserver:/$ sudo mount /dev/sdb /data


Adjust Permissions

Make sure our username is part of the debian-transmission group
joel@torrentserver:/$sudo usermod -a -G debian-transmission joel

Make sure our /data directory is owned by the debian-transmission group
joel@torrentserver:/$ sudo chgrp debian-transmission /data

Modify our permissions on our /data folder
joel@torrentserver:/$ sudo chmod 777 /data


Install Transmission Daemon

joel@torrentserver:/$ sudo apt-get install transmission-daemon

When asked, type ‘Y’ to continue

Stop the transmission-daemon so we can modify the settings file.
joel@silvertorrent:/$ sudo service transmission-daemon stop

Copy the settings.json file so we have a backup if necessary
joel@torrentserver:/$ sudo cp /etc/transmission-daemon/settings.json /etc/transmission-daemon/settings.json.bak

Edit the settings.json file:
joel@torrentserver:/$ sudo nano /etc/transmission-daemon/settings.json

Here is my settings.json file:

(NOTE: Adjust “rpc-password”: “password” and “rpc-username”: “username” to the username and password you would like (The password will encrypt automatically). Also make sure you set “download-dir”: “” to a valid disk directory, mine is set to “/data” as I have that mapped to a second drive in my server.)
{
"alt-speed-down": 500,
"alt-speed-enabled": true,
"alt-speed-time-begin": 480,
"alt-speed-time-day": 127,
"alt-speed-time-enabled": true,
"alt-speed-time-end": 0,
"alt-speed-up": 10,
"bind-address-ipv4": "0.0.0.0",
"bind-address-ipv6": "::",
"blocklist-enabled": false,
"dht-enabled": true,
"download-dir": "/data",
"download-limit": 1000,
"download-limit-enabled": 0,
"encryption": 2,
"incomplete-dir": "/var/lib/transmission-daemon/info/Incomplete",
"incomplete-dir-enabled": false,
"lazy-bitfield-enabled": true,
"lpd-enabled": false,
"max-peers-global": 200,
"message-level": 2,
"open-file-limit": 32,
"peer-limit-global": 240,
"peer-limit-per-torrent": 60,
"peer-port": 20635,
"peer-port-random-high": 20500,
"peer-port-random-low": 20599,
"peer-port-random-on-start": true,
"peer-socket-tos": 0,
"pex-enabled": true,
"port-forwarding-enabled": true,
"preallocation": 1,
"proxy": "",
"proxy-auth-enabled": false,
"proxy-auth-password": "",
"proxy-auth-username": "",
"proxy-enabled": false,
"proxy-port": 80,
"proxy-type": 0,
"ratio-limit": 0.2500,
"ratio-limit-enabled": true,
"rename-partial-files": true,
"rpc-authentication-required": true,
"rpc-bind-address": "0.0.0.0",
"rpc-enabled": true,
"rpc-password": "transmission",
"rpc-port": 9091,
"rpc-username": "transmission",
"rpc-whitelist": "127.0.0.1,*.*.*.*",
"rpc-whitelist-enabled": true,
"script-torrent-done-enabled": false,
"script-torrent-done-filename": "",
"speed-limit-down": 1000,
"speed-limit-down-enabled": false,
"speed-limit-up": 10,
"speed-limit-up-enabled": true,
"start-added-torrents": true,
"trash-original-torrent-files": false,
"umask": 2,
"upload-limit": 100,
"upload-limit-enabled": 0,
"upload-slots-per-torrent": 4,
"watch-dir": "/data/_torrents",
"watch-dir-enabled": true
}

Start the Daemon again
sudo /etc/init.d/transmission-daemon start


Web Access

Internally, you should be able to access your server via your browser:

(Note: Change Ubuntu_Server_IP_or_Hostname to your server IP address or host name)
http://Ubuntu_Server_IP_or_Hostname:9091

If you want to access your transmission server from outside your house you will need to forward port 9091 to your ubuntu server on your router.


References

http://1000umbrellas.com/2010/10/04/updated-transmission-installationconfiguration-on-ubuntu-server

Share

Installing World Community Grid on a Headless Ubuntu Server

Install BOINC client:
sudo aptitude install boinc-client

Find your account key:
boinccmd --lookup_account http://www.worldcommunitygrid.org username password

You should get a response something like this
dfb74c9b94e1129c2eac322052eb5f98

Attach to your project:
boinccmd --project_attach http://www.worldcommunitygrid.org dfb74c9b94e1129c2eac322052eb5f98

If you want to verify your attached enter the following command:
boinccmd --get_state

You should get something like the following back, along with a bunch more info:
======== Projects ========
1) -----------
name: World Community Grid
master URL: http://www.worldcommunitygrid.org/
user_name: joelcpatterson
team_name: Preeminent Nonpareil
resource share: 100.000000
user_total_credit: 392663.547845
user_expavg_credit: 0.071871
host_total_credit: 0.000000
host_expavg_credit: 0.000000
nrpc_failures: 0
master_fetch_failures: 0
master fetch pending: no
scheduler RPC pending: no
attached via Account Manager: no
ended: no
suspended via GUI: no
don't request more work: no
disk usage: 0.000000
last RPC: 1297181772.312611
project files downloaded: 1297181833.027173

You can also take a look to verify your processor is being used by typing:
top

This will display your processes that are currently running and how much CPU they are utilizing.

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
20051 boinc 39 19 88388 77m 1484 R 99 3.9 10:21.74 wcg_c4cw_lmps_6
20050 boinc 39 19 88388 77m 1484 R 97 3.9 10:22.88 wcg_c4cw_lmps_6

Further resources:

Tutorial:Disable Ads with DD-WRT

If you are running DD-WRT on your router and you hate ads, here is the solution to disable them on every computer in your home.

  1. Navigate to the “Services | Services” tab on your DD-WRT router.
  2. Under “DNSMasq“, make sure “DNSMasq” and “Local DNS” are enabled. Then copy and paste the following code into the “Additional DNSMasq Options” text box.
    addn-hosts=/tmp/dlhosts

  3. Next, navigate to “Administration | Commands“.  Copy and paste the following code into the “Commands” form.  Then click the “Save Startup” button.
    _rogue=0.0.0.0
    echo -e "#!/bin/sh\nn=1\nwhile sleep 60\ndo\n\twget -q -O - http://www.mvps.org/winhelp2002/hosts.txt | grep \"^127.0.0.1\" | grep -v localhost | awk '{print \"$_rogue\\\t\"\$2}' | tr -d '\\\015' >/tmp/dlhosts\n" >/tmp/write_dlhosts
    echo -e "\t[ \`grep -il doubleclick /tmp/dlhosts\` ] && break\n\t[ \$n -gt 5 ] && break\n\tlet n+=1\ndone\nkillall -HUP dnsmasq" >>/tmp/write_dlhosts
    chmod +x /tmp/write_dlhosts
    /tmp/write_dlhosts &

  4. Reboot your router.

If you would like to confirm that your blocking is enabled, open a command prompt and type in “nslookup admarket.cz“. You should get an address of 0.0.0.0 back from your DNS server.

For further information and the source of this information, take a look over on the DD-WRT forums

Wiki Tutorial:MySQL Table Repair

Just recently I noticed one of my websites HLstatsX, displaying the error the table hlstats_players needs to be repairedHere is a quick step guide on the repair.

Here is a tutorial I just added to my wiki. Found it on About.com.

SSH Tunneling

SSH Tunneling

I just created a tutorial on my wiki page about SSH tunneling. Useful for encrypting all communication between you and home network over the internet. It can also be used to securely tunnel all http traffic through your home network connection.