Updated for 10.10
OK, totally upgraded after nearly three years. This is now a SAMBA sharing, Bit Torrent, NAS, Webserving, remote access headless server. You can start torrents downloading from your smart phone and download them to a device via a simple webpage or use the mapped drive from your LAN.
Things have changed since I first wrote this and I've only ran this install 4 or 5 times, if something is typed up wrong, lemme know. I know I need to overhaul the Azureus Daemon. This works with XP, Vista and Win7.
The machine I have attached now is a P4 2.4 with 2GB RAM, 300GB system disk and 2 x 1.5TB storage.
Old post with updated
Your guide to a DIY BT NAS SAMBA server remote controlled by Windows XP / Web browser.
Seems I'll need to format it better at a later date.
Updated again, I had to remove about 5000 words to get it into another forum lol. I will add the ftp via
vsftp for samba users and webserver, though you shouldnt really need since I can access my samba as a network drive from
anywhere and the tuts are clear enough for ftp usage. The ftp part, once its refined will cover users having home
directories and being able to access the torrents, or whichever way you want it. I also added 5 beeps on startup, since
this is headless and you may want to know when its finished booting.
I also use rc.local which I havent seen any of in any tuts, being a newb I dunno if its the done thing but as far as Im
concerned its there to be used.
This has auto resume, ssh and anything else you might need for a full setup. This is how I have setup a shared resource
for torrents and files. Basically you can tell it to download, everyone can access it and you can switch any other
computers on your network off and leave it to download. Its a NAS, Bit Torrent client, webserver and if you add it in
RAID/backup. Theres also all the other possibilities that go with Ubuntu but heres the quick 'n' dirty NAS BT client
version. If you add in a dynamic IP redirect service you could queue your torrents from anywhere in the world, even using
a mobile phone.
You can use any old rubbish and fire a couple of big drives in there, even go as far as getting an IDE to SATA to get the
best. This is what I used, since I cant afford £250 for just an enclosure that actually does less that this old junk.
Duron 900
Old iWill RAID mobo
512MB RAM
64MB something ancient AGP video card
30GB HDD thats actually 9 years old and I remember buying it 9 years ago and I have no idea how it turned up
Ubuntu 8.04 LTS Server Edition which is free anyway
Now all I need are a couple of big disks Right now Im thinking 2 x 1TB and I wonder, if this is archived and read in 2
years how 2TB total sounds lol.
This 'guide' assumes your network is already setup correctly, your client machines are XP and you, like me, have little
experience with any of this. This is my 2nd day (less than 20hrs) with Ubuntu, so difficulty level is set to easy.
You may run into trouble and need to open up ports on your router, generally the ports you are working on are the ones
that need opened/forwarded/virtual servered. Your gonna need the instruction manual for that if you havent done it before
If running Windows 7 you will need to right click and 'Run as administrator' putty and xming (OK John?).
I wont go into the basic obvious setup stuff unless its referred to later.
Code:
Hostname: The name you want to call your box (I sometimes refer to it as yourboxname).
Guided - Use entire partition.
Username and password: This will be your main account for logging on and doing 'stuff'.
Now go download PuTTY for windows while waiting and after
reboot login using the Username and password from setup like this.
Start PuTTY and in the Hostname/IP box type the name you gave your box earlier, dont hit return yet though.
Click SSH > X11 > Tick Enable X11 forwarding and in X display location put 127.0.0.1
Go back to the sessions page and under Saved Sessions put in your box name and then hit SAVE. Now you can hit open and
connect.
When using putty you can copy from text in Windows and just a right click in PuTTY will paste it. If you highlight in
PuTTY it automatically copies.
Any code for commands you should enter one line at a time. If its a config file you can copy and paste it all in.
Make your servers IP static (optional but necessary if you want to access webpages and torrent client from the internet):
Check your current IP and settings:
[CODE]ifconfig]
/CODE
From this you will get your current IP. For example 'inet addr:192.168.1.4'. When you set a static IP you are as well to
use the one assigned if you are unsure. Just copy the '192.168.1.4' part from your ifconfig. The gateway is your routers
IP. If you dont know it, check the manual. It is the same as the login page for your routers configs.
Code:
sudo cp /etc/network/interfaces /etc/network/interfaces.bak
sudo nano /etc/network/interfaces
You want the file to look like the one below. DHCP is edited to STATIC and a few lines are added. It is IMPORTANT you
keep the eth# the same as it is, it is your network adapter.
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth1
iface eth1 inet static
address 192.168.1.4
netmask 255.255.255.0
gateway 192.168.1.1
Reboot your machine and make sure you can still connect:
Still works?
Put these commands in:
Code:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openssh-server
sudo apt-get install mysql-server mysql-client
sudo apt-get apache2
sudo apt-get php5 libapache2-mod-php5
sudo /etc/init.d/apache2 restart
sudo apt-get install xauth
sudo apt-get install azureus
sudo apt-get install screen
sudo apt-get install beep
sudo apt-get install samba smbfs
sudo apt-get install mediatomb
Let's check the webserver is running. In your browser go to http://yourboxname
In PuTTY lets make a shared folder called shared that everyone can eventually use:
Code:
sudo mkdir /shared
sudo chmod 0777 /shared
Now lets backup and remake the config file for samba:
Code:
sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.bak
sudo nano /etc/samba/smb.conf
Paste this in:
Code:
[global]
; General server settings
netbios name = hostname
server string = ishare
workgroup = MSHOME
announce version = 5.0
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_$
passdb backend = tdbsam
security = user
null passwords = true
username map = /etc/samba/smbusers
name resolve order = hosts wins bcast
wins support = yes
printing = CUPS
printcap name = CUPS
syslog = 1
syslog only = yes
; NOTE: If you need access to the user home directories uncomment the
; lines below and adjust the settings to your hearts content.
;[homes]
; valid users = %S
; create mode = 0600
; directory mode = 0755
; browseable = no
; read only = no
; veto files = /*.{*}/.*/mail/bin/
; NOTE: Only needed if you run samba as a primary domain controller.
; Not needed as this config doesn't cover that matter.
;[netlogon]
;path = /var/lib/samba/netlogon
;admin users = Administrator
;valid users = %U
;read only = no
; NOTE: Again - only needed if you're running a primary domain controller.
;[Profiles]
;path = /var/lib/samba/profiles
;valid users = %U
;create mode = 0600
;directory mode = 0700
;writeable = yes
;browseable = no
; NOTE: Inside this place you may build a printer driver repository for
; Windows - I'll cover this topic in another HOWTO.
[print$]
path = /var/lib/samba/printers
browseable = yes
guest ok = yes
read only = yes
write list = root
create mask = 0664
directory mask = 0775
[printers]
path = /tmp
printable = yes
guest ok = yes
; Uncomment if you need to share your CD-/DVD-ROM Drive
;[DVD-ROM Drive]
;path = /media/cdrom
;browseable = yes
;read only = yes
;guest ok = yes
[Share Name]
path = /shared
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
; force user = yourlogin
; force group = yourlogin
Parts to change
Code:
[global]
; General server settings
netbios name = hostname <- The Hostname of your box
server string = ishare <- A description for your box
workgroup = MSHOME <- The workgroup your computers are on, this is the most common XP
[Share Name] <------------------------- This is what it will be called on the network
path = /shared <- The shared folder you made
browseable = yes
read only = no
guest ok = no
create mask = 0644
directory mask = 0755
; force user = yourlogin <- I have these commented out, if at the end yours doesnt work
; force group = yourlogin <- delete both the ; and put your PuTTY/root login name there
Press to save then yes etc. to exit.
Restart Samba:
Add a pass to your own samba logon details, the pass can be different from Windows or your box:
Code:
sudo smbpasswd -L -a yourlogin
sudo smbpasswd -L -e yourlogin
Add user logons so everyone/all the computers can get access to the share, replace newuser with the username you desire
and the new smb password thats requested with one you want:
Code:
sudo useradd -s /bin/true newuser
sudo smbpasswd -L -a newuser
sudo smbpasswd -L -e newuser
Done this way so that Windows isnt storing my boxes root user details.
Back to XP and in 'My Computer' goto Tools > Map Network Drive
Pick a letter
Click on Connect using a dofferent username. Now in there put in one of the logins you just created under samba, ok it
and then for the folder enter \\boxhostname\Share Name hit finish and it should take you right in. Remember the share
name is the one in [brackets] from earlier.
And thats your shared space.
You actually probably need to give your box a sudo reboot about now, youve essentially just changed what network it is on
etc. The default it is installed with is workgroup and xp go for MSHOME.
Now get the torrent client up and running, for this we need XMing and its
fontsso our windows machine can connect for a quick log on to do some setting up before we put it to bed. Remember the fonts, they are on the 'Files' page.
Basically install them and then launch XMing, leave it running in the background and then its back to PuTTY. This is
where the extra setting up and saving comes in handy from earlier. Close any PuTTY session you have and then restart one.
After your logged on type and up should come an Azureus GUI. This will be the only time you see
this. Get the updates and setup your speeds, also in tools/options setup your folder in transfers so its pointing to your
shared folder and tell it to automatically download (or is it upload)/no confirmation needed, theres only the one anyway.
Goto the plugin installation wizard and download autostopper and azhtmlwebui. Once its installed go to tools > options >
plugins, click on its box and configure your settings. Youll want to put a pass on it since right now anyone can log one
and probably change to https. Once its done and settings are saved its time to close it down and make a daemon for it.
Before we do though lets get our browsers and go to https://yourboxname:6886/ and the Azureus webgui should
appear and you will be able to log on, if not you have to check port settings on your router or anything that maybe
blocking. If you get your external IP then you should be able to access it from anywhere on the planet, youll need a
dynamic ip account at somewhere like dynip, explained later.
I couldnt find a startup feature or anything that worked so I went right ahead to try and rip off, I mean use, someone
elses great one and that never went well at all so I made a basic one and its all you really need. This also uses a
method I couldnt see anywhere so any and all improvements welcome, if someone could show me how to do if statements in
this then that would be a result.
In PuTTY:
Code:
sudo nano /usr/share/java/azureus_daemon
Now in there paste:
Code:
#! /bin/sh
#The user that will run Azureus
AZ_USER=anybody
#Name of the screen-session
NAME=cackles_azureus_daemon
#executable files in the following paths that are perhaps needed by the script
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/share/java
#your path to the azureus directory, where Azureus2.jar is located
DIR=/usr/share/java/
#Description
DESC="Azureus Daemon"
set -e
case "$1" in
start)
echo "Starting $DESC: $NAME"
su $AZ_USER -c "cd $DIR; screen -dmS $NAME java -jar ./Azureus2.jar --ui=console"
su $AZ_USER -c "screen -S $NAME -X start all"
echo "Azureus Daemon Started"
;;
stop)
su $AZ_USER -c "screen -S $NAME -X quit"
echo " Daemon Has Been Stopped"
;;
check)
su $AZ_USER -c "screen -S $NAME -X show torrents all"
;;
daemons)
su $AZ_USER -c "screen -list"
;;
esac
exit 0
Then change anybody to your root logon name, no need for pass or anything.
Control + X to get out and save that and then:
Code:
sudo chmod a+x /usr/share/java/azureus_daemon
Ok so I used the wiki one only made it run on my machine and mines also automatically resumes your torrents
Lets see if it works. I'm pretty sure some of its broken because the code is three years old. but we only need stop and
start. Make sure you are in /usr/share/java/ and type:
Code:
sudo ./azureus_daemon start
That should start the server. Use your browser and goto http://yourboxname:6886 and make sure its working.
Code:
sudo ./azureus_daemon daemons
will let you see your daemon running.
Code:
sudo ./azureus_daemon check
will let you see any torrents that are downloading.
Code:
sudo ./azureus_daemon stop
Stops ... There are no safeties built into this but if you play with and rack up too many daemons theres always reboot
with no harm done
Now we need to get it to run at startup.
Code:
sudo nano /etc/rc.local
And make sure yours is like this:
Code:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sudo /usr/share/java/azureus_daemon start
beep -r 5
exit 0
You should have only needed to add one line for azureus, but we added two so that our headless machine beeps 5 times when
its has started up and loaded everything. Remove the beep line if you dont want it. You can also add log on messages here
with echo "message including the quotes". exit 0 should always be the last thing.
Reboot:
But you want to stream media as well?
Mediatomb time!
Code:
sudo cp /etc/mediatomb/config.xml /etc/mediatomb/config.xml.bak
sudo nano /etc/mediatomb/config.xml
There are only 3 parts of this that need changed to get it to run on the PS3 and basically anything else.
Part 1 change no to yes:
Part 2 in the first yellow blob below that change no to yes:
Code:
<protocolInfo extend="yes"/>
Part 3 remove the <!-- -->:
Code:
<map from="avi" to="video/divx"/>
Now you can go to http://yourboxname:49152. Go to Filesystem. Click on shared. Click the + with the arrows around it.
Select Inotify, Full, Recursive. Set.
But you said I can access this from anywhere! OK. Go to dyndns.com and setup a free account. Make a URL. Activate it.
Update the IP, click on the link for the URL and update using 'my IP'.
Install this Gizmo, selecting dyndns and 'from list along with your dyndns username and pass.
Code:
sudo apt-get install ddclient
Now go into your router settings. Forward ports 80, 49152, 6886.
Cool but you can't download, meh, thats easily solved.
Code:
sudo mkdir /var/www/test
sudo nano /var/www/test/.htaccess
In nano paste this in:
AuthUserFile /etc/apache2/.htpasswd
AuthGroupFile /dev/null
AuthName YouKnowWhere
AuthType Basic
require user test
Code:
sudo htpasswd -c /etc/apache2/.htpasswd test
sudo nano /etc/apache2/sites-available/default
Add this to the file after ServerAdmin webmaster@yourboxname (If you use a virtual, covered later, then you wont need
this):
Code:
<Directory /var/www/test>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
Restart Apache:
Code:
sudo /etc/init.d/apache2 restart
Make a simple webpage:
Code:
sudo nano /var/www/index.html
Remember, this is to test only and show you. Make your page look like this:
Code:
Test 1
<p><A HREF="test/">Test</A>
Time to add shared to it:
Code:
sudo mount -o bind /shared /var/www/test
sudo nano /etc/fstab
Add this line to fstab to make it 'stick':
Code:
/shared /var/www/test auto bind 0 0
You now have a webpage to download files from.
And that should be that!
I will a bit later about hosting multiple websites from the one machine as well as FTP, RAID and mounting another drive.
Bookmarks