Hello, my name is Daniel, and I make things! Join me in this exciting journey exploring the world of computers and electronics


DIY: Home UBUNTU NAS Server

Back in 2003, I used to connect my computer on the my old 32′ TV, those huge and heavy TVs, to watch stuff from the internet, at that time, eMule was ruling the p2p community (can’t talk about USENET right? :} ). Then in 2008 I decided to build a better HTPC (Home Theater PC), a full dedicated computer connected to my TV, with good MotherBoard/VGA/SoundBoard, well, a good computer, with gaming capacities. It was good while it lasted, but you know, it was huge black box below my TV, bit noisy, but it did the job.

Early this year, I got a 2TB Lacie Network Space 2, which is a simple NAS Server, and a WD Plus Live. The WD PLUS LIVE is nothing more than a small computer with an operating system to playback videos and music. He has no storage, so it should you have to plug a thumb-drive, external hard drive on it or connect to the network, which will give access to shared files over the network, in my case, files are stored at the Network Space 2 connected to the router. When I bought the WD, I was impressed with the image quality, and how he can play heavy files without any choke. I watched the Band of Brothers show recently co-directed by Tom Hanks and Steven Spielberg in FULL HD 1920×1080 , where files were like 7GB for episode of 50-60 minutes. I played all over the network, and it worked perfectly.

Anyway, my Lacie NAS stopped working, some problem with the file system, but the HD was still working great. There is a way to re-format the Lacie’s file system, but it’s a pain in the as*. So that’s when I decided to build a real NAS Server, running UBUNTU and using that Network Space’s hard drive and another 1TB driving that was laying around. I based my NAS on the DIY 200U$ PC from Paul Stamatiou, I don’t even know if he still has his own NAS, but I’m really enjoin mine.

Hardware

For the hardware, I ended up with a fanless MiniITX motherboard Intel D510MO, which has an Atom processor, Gigabit ethernet (all my home network is Gigabit, so it does make a difference). I am also using a 2GB 800Mhz Kingston RAM memory, and both two SATA connectors. The MOBO has up to seven 2.0 USB and one mini PCI Express, in case I want to add more SATA drives in the future.

As I told before, I am using a 2TB HD from my old NAS, and also a 1TB HD that I had, so ≈ 3TB, good enough for now… for now!

Power supply, well, just got a regular one, but another good solution would be a tiny power supply, for example the picoPSU.

Building the case

As the MOBO is fanless, I don’t think it would be a good idea to let it locked in a box somewhere in my apartment, so I decided to build a acrylic case and leave the sides open for air circulation.
You just need to get a drill, make some holes and you are done.

Software

O/S

There is nothing better then Linux for any kind of server, and my distro of choice is UBUNTU, quick to install, easy to configure get it running smooth.

For installing it, you could use an USB stick with ubuntu on it, and set to install from the stick, and you are good to go.

When UBUNTU was installed, internet started working right away and there was no extra driver needed, just what I like about this distro.

You may want to update the packs from your server. I like using the Terminal, you can do it simply by typing:

sudo apt-get update
sudo apt-get upgrade

Torrenting

For downloading stuff from the internet, such as my Linux distribution, I like using torrent, the best p2p protocol ever!
I like leaving torrent open 24/7, and my choice for this task is Transmission-daemon, it runs on the background, I can access it using any Browser, iPhone using an app called iControlBits or even using a super cool and multiplatform GUI called Transmission-Gui.

You can check HERE for a detailed tutorial on how to set the daemon + Gui.

Backups

For backups, I am using Super Flexible File Synchronizer, and backing up my files via SFTP.

For backup I use SSH and RSYNC via terminal. It’s simple, light weight and funcional, you don’t need to use ShareWare software for this, and the way I’m doing it, you can even backup to your server through the internet.

I am not using any RAID to clone my disks because one is 1TB and the other is 2TB, the second reason is that I don’t really need to backup all data on that disks. My main concern is Documents and Pictures, especially pictures! So these are the files I save on both drives. What i’ve done is, I always sync my files to one folder on the NAS via SFTP, then with RSYNC and Cron, everyday at 3AM, it checks if files are the same, otherwise they sync both HDs. Maybe not the best ou easiest way, but it works.

Next month I will move to Italy for one semester, and I know I will take many Gigs of pics. University’s internet connection will probably be fast, so I will backup everything from there to my NAS Server. So if something goes wrong with my files there, I will still be able to access them from home.

So, for backing up my photos via SSH to the NAS, I always want to make an exact copy of the files on my Macbook, so the code below does the job.
You can remove the -e ‘ssh -p 224’ part if your SSH uses the default port 22. And my server IP is 192.168.1.104, you should change to your IP.

rsync -av --update --delete -e 'ssh -p 224' /home/path/to/folders [email protected]:/home/path/on/SERVER/

Webmin

Webmin is a great application to help you manage your server. I use it to create FTP users, manage crons and much more.

“Webmin is a web-based interface for system administration for Unix. Using any modern web browser, you can setup user accounts, Apache, DNS, file sharing and much more. Webmin removes the need to manually edit Unix configuration files like /etc/passwd, and lets you manage a system from the console or remotely.” Text from Webmin’s website. There you can find all information on how to install/configure it.

You should take a look!

Apache/Mysql/PHP/PHPMyAdmin

I like building websites, I usually run websites on my own computer before launching it to the world. But I am enjoying more creating websites and accessing them from my NAS Servers.

To install all this, just time on terminal:

sudo apt-get install apache2 mysql-server-5.1 php5 php5-mysql php5-cli

Your default home folder will be /var/www

FTP

Right now I am using proftpd to run all my ftp file transfers (but today I usually just transfer files over SSH). You can use WEBMIN to handle the FTP, or you can follow many tutorials found on the internet. For example THIS.

SSH

To install SSH on your server, just use this:

sudo apt-get install openssh-server

A good thing to do is to change your default SSH port, it can help on the security of your server. For that, edit the config file:
[cc lang=”c”]gksu gedit /etc/ssh/sshd_config[/cc] where it says PORT 22, change to something like PORT 224.

Subsonic – Free Music Streamer

OMG, I wish I knew this software before, it AMAZING! Check the description from their website, I’m highlighting what I think amazing:

Subsonic is a free, web-based media streamer, providing ubiquitous access to your music. Use it to share your music with friends, or to listen to your own music while at work. You can stream to multiple players simultaneously, for instance to one player in your kitchen and another in your living room.

Subsonic is designed to handle very large music collections (hundreds of gigabytes). Although optimized for MP3 streaming, it works for any audio or video format that can stream over HTTP, for instance AAC and OGG. By using transcoder plug-ins, Subsonic supports on-the-fly conversion and streaming of virtually any audio format, including WMA, FLAC, APE, Musepack, WavPack and Shorten.

If you have constrained bandwidth, you may set an upper limit for the bitrate of the music streams. Subsonic will then automatically resample the music to a suitable bitrate.

In addition to being a streaming media server, Subsonic works very well as a local jukebox. The intuitive web interface, as well as search and index facilities, are optimized for efficient browsing through large media libraries. Subsonic also comes with an integrated Podcast receiver, with many of the same features as you find in iTunes.

Here is what I am doing, when I am home, I simply use the browser to access all my songs. As it re-sample the music files on-the-fly, I created an user that I use when I’m not home, re-sampling files to 128kbps. And when I accessing via my iPhone’s 3G network, it goes down to 64kbps (slow 3G!!!).

On my phone, I am using an App called iSub, you can configure different bit-rates if you are using Wireless or 3G, and it also caches all songs played. So I don’t need to sync songs with my iphone no more, I just listen to songs on Subsonic and then shuffle them when I on the road. I am impressed, you should check it out!

To have it up and running, there are plenty of information on the website!

Now you have some pictures of the server up and running:

If you enjoy this post, or has something to say,
just leave a commend below.

Thanks for reading 😉


28 responses to “DIY: Home UBUNTU NAS Server



  1. This is awesome. I’m a noob regarding the networking/UNIX stuff but looking forward to learning some of that. I’m going to build something like this in Jan 2012 or so, and am just looking around the web for good PSU/Mobo options. I like the picoPSU and hope to be able to set something up that has 3 to 5 5400rpm drives (quiet, low power) in RAID 5 for some data security.

  2. I have a question about transfer rate. In MB/s what is your transfer rate when writing files to the NAS and reading from the NAS.

    Can you explain a little bit in depth on how are you sharing your files from the Ubuntu server, as far as how did you partition your HDD and are you just using straight SAMBA or something else to do the sharing?

    Thanks.

    Jacky Shroff

    1. Hey Jacky, I’m on a GigaBit network, transfer rate is around 30MB/s.

      For sharing files on UBUNTU, I did it via the graphic interface, you just need to right click on the folder you want to share and there is Sharing there. Sorry, not really in depth there.

      For sharing I use SAMBA, FTP and SFTP.

      I’m not using RAID on anything, but what I did was create a bash script to RSYNC the files and sync the folders I want to have on both discs.

  3. Your acrylic case is really neat, thank you for the idea! I have a Debian file server with 5 disks in a recycled desktop case, with limitations on HDD slots and airflow. A custom case like yours solves these problems with a low money investment.

  4. Thank you for the guide, it was very helpful for me. i think i will use and link to your post as i going to write in my blog (in Hebrew) my own searching for simple and easy to configure and use NAS.

  5. Thanks for this, followed your guide, with a little help from some more specific sites and I now have a great little server running.

    And you’re right, subsonic is a truly awesome bit of software.

  6. Hi Daniel.
    I will try to follow your guide to build my own, problem is that I have very little knowledge with DIY projects, I would be glad if I could get advise on this parts:

    MOBO:
    http://www.ebay.com/itm/Intel-Desktop-Board-D525MW-Mini-ITX-ATOM-D525-BLKD525MW-Bulk-/320878400768?pt=US_Motherboard_CPU_Combos&hash=item4ab5d7d500

    RAM:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16820139220

    PSU:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16817139026

    Thanks man, keep up the good work

  7. I’m trying to help a non-profit literacy center network their 10 computers together. I don’t have any problem building a computer as I have taken them apart and fixed them when needed. However, I don’t know where to start with a server. The 10 computers need to load something like MS Office (or Open Office) and also access the internet. Where do I go to find how to begin; what hardware I need, software, etc. I can use Linux or XP. This has to be a cheap solution.

    Thanks.

  8. OK, so I too set one up some time ago using FreeNAS and considering retasking.. My question is IF you were to add additional drives how would you suggest doing it?

    1. I’m using Ubuntu on my NAS Server.

      For adding new drives, I would simply add a new drive, connect the SATA cable and mount it.

      If you don’t have extra SATA connections, you can buy an sata pci board.

  9. Hi Daniel,

    I am writting a blog post about how to get started with NAS and it could be interesting to know your opinion whether one should buy a NAS out of the box or would it still make sense to build it on your own ?

    Regards Dennis

Leave a Reply

Your email address will not be published. Required fields are marked *