How to Configure an $80 File Server in 45 Minutes
I use a modded Xbox and Xbox Media Center for playing media files across the network on my television and sound system. I also download large files, such as Linux ISOs, via BitTorrent. However, leaving my primary computer on all the time seemed like a waste of energy. I wanted a cheap, small headless machine that I could use as a Samba server and BitTorrent client so I could leave my workstation off when I wasn't using it.
I was in luck; HCDI Trading had a great "Fall Extravaganza" deal - a Dell OptiPlex GX150 Desktop for $47.91 (around $30 s/h). The specs:
- Desktop Form Factor (it fits on a shelf in a media center)
- Intel Celeron 700 MHz
- 128MB RAM
- 10GB HD
- CD-Rom
Not cutting edge, but perfect for what I needed and priced very reasonably. Instead of using X11 and remote clients, I felt that web interfaces would be optimal out of simplicity. If I configured the server as a LAMP (Linux, Apache, MySQL, and PHP), then I could use web GUIs for configuration, administration, and file transfers.
Out of the popular Linux distributions, I'm most familiar with Gentoo and Ubuntu. Gentoo didn't seem appropriate; it would take hours and hours to get everything set up, configured and updated (even from a Stage 3 install), and any performance gain from the optimization would be negligible. Ubuntu has a history of reliability and ease of set up, so I used the Edgy Eft release as the basis my server.
The Applications
- Remote Console - OpenSSH
- The free version of the SSH connectivity tools. Use it for secure access to the console.
- Web Server - Apache
- It's free, fast, well supported and documented
- Network Fileshare - Samba
- Creates file shares that can be easily accessed from Windows. Notoriously obnoxious to configure by hand, the Samba Web Administration Tool (SWAT) simplifies the process immensely.
- Database - MySQL
- The popular free database server. While I can use a command line to administrate MySQL, I prefer using phpMyAdmin.
- P2P Client - BitTorrent
- TorrentFlux is a decent web interface for BitTornado. Useful for downloading Linux ISOs or media from places like LegalTorrents.com.
Directions
- Download and burn the Ubuntu Server 6.10 i386 install CD.
- Install Ubuntu Server
- When asked about Software Installation, choose LAMP.
- When the installation is finished, take out the CD (I flip it over and leave it in the drive for the next time I need it) and reboot.
- Logon as the regular user that you created during setup.
- Give root a password.
sudo passwd root
- We're going to modify the file sources list to allow us access to all the required files. Uncomment the edgy universe, edgy-security main restricted, edgy-security universe, edgy multiverse, edgy-backports main restricted universe multiverse, and edgy-commercial main. In addition, Ubuntu leaves the install CD as one of the file sources after installation, so you'll need to remove the CD from the source list. Comment out the CD from the list and save.
sudo nano -w /etc/apt/sources.list
- Update apt-get to use the new sources.
sudo apt-get update
- Install OpenSSH server
sudo apt-get install openssh-server
- Turn off the computer.
sudo shutdown -h now
- Disconnect the monitor, keyboard, and set the computer wherever it's going to lurk for the next couple years.
- Turn on the computer and wait about a minute for it to boot.
- Using your preferred SSH client, connect to the machine. I prefer PuTTY for Windows.
- Install Samba and SWAT.
sudo apt-get install samba smbfs swat xinetd
- Create a Samba user.
sudo smbpasswd -a username
- Add SWAT to the xinet configuration and save.
sudo nano -w /etc/xinetd.d/swat
# description: SAMBA SWAT
service swat
{
disable = no
socket_type = stream
protocol = tcp
#should use a more limited user here
user = root
wait = no
server = /usr/sbin/swat
} - Reload Xinetd with the new configuration.
sudo dpkg-reconfigure xinetd
- Verify that SWAT is up and running. If you don't get any response, start Googling.
sudo netstat -tap | grep swat
- Make the shared directory for TorrentFlux.
sudo mkdir /share
sudo mkdir /share/incoming
sudo chmod 777 /share/incoming/ - Create the Samba share. Using a web browser, go to http://hostname:901/shares
- path /share/incoming
- valid users - username
- read only - no
- Commit Changes
- Install phpMyAdmin
sudo apt-get install phpmyadmin
- Connect to phpMyadmin using a web browser - http://hostname/phpmyadmin
- Secure MySQL / phpMyAdmin
- login: root (no pass)
- Privileges
- Add a password to both root accounts
- Create a database for TorrentFlux
- Databases - Create New - torrentflux
- Install TorrentFlux
sudo apt-get install torrentflux
- Ignore the libphp-adodb message.
- Configure database for torrentflux with dbconfig-common? - yes
- Password - blank (generates random)
- Restart Apache? - Yes
- Configure TorrentFlux using a web browser - http://hostname/torrentflux/
- Username / Password - root / root
- Configuration
- Path - /share/incoming/
- Save
- Click My Profile
- Update your password
- Create a user account
- Admin - New User
- Remove the Apache default documents from web root.
sudo rm -Rf /var/www/apache2-default/
- Create a basic web launchpad for easy access your services.
sudo nano -w /var/www/index.php
Post Mortem
Overall, the installation and configuration took me about 45 minutes to go from zero to a fully functional system. The Xbox can see the share, and I've got a new playground for web development. I would suggest cleaning up and securing that home page a bit; research .htaccess files to lock it down.
I put my file server in my media center underneath my router, and it takes up about the same space as a VCR. For $80, I feel that I've made an excellent investment.