Why Do I Want a Server in My House?A server, for those that don't know, is just a computer that stores data and "serves" it to other computers on a network, and it can be immensely useful in your house. It's a great place to store your backups, store your media for streaming to all your devices, or even act as an always-on, low-powered computer for seeding torrents and downloading other files.
We've shown you how to create your own network attaached storage device with FreeNAS before, but while FreeNAS is perfect for tiny, low-powered machines, and it doesn't come with a lot of customizability. If you want to do anything beyond what's included, you have to go through a lot of complicated steps. Ubuntu, on the other hand, gives you the freedom to install a ton of different apps, which means you can use your server for just about anything. Plus, it's dead simple to set up, even if you've never used Linux before.
Here, we'll show you how to put together an Ubuntu-based server, connect it to the other computers in your home, and then go through a few examples of how you can use it as a backup machine, a media server for your music, movies and TV shows, and as a dedicated BitTorrent box.
What You'll NeedYou can install many different versions of Ubuntu using many different methods, but for today, we're going to go the easiest route possible. All you need is:
- A PC with a minimum of 512MB of RAM and a 700MHz processor to act as your server (1.6GHz if you want to stream videos). You'll probably want to use ethernet instead of Wi-Fi, too, since it's much faster. An old computer will work fine for this, though you can also build a dedicated, cheap system if you don't have an old PC lying around. Note that an old PC will use up more power, and may cost you more in the long run—but it's a good way to test everything out and see if a home server is right for you.
- The Ubuntu live CD, available here.
- Enough storage space to hold whatever files you want on your server. Again, you might be able to get by with whatever old hard drives you have lying around, though if you're storing a lot of media you may need to go buy some new drives with a lot of space. I, for example, have a 2 TB drive dedicated to movies and TV shows, a 1 TB drive dedicated to backups, and a 500GB drive dedicated to music.
- A router with DHCP reservations or static IP addresses (almost every router has this capability). This isn't required, but it's definitely preferred. If you don't have this, managing your server can get pretty annoying, since its IP address will change when you reboot it.
- A spare monitor to set up your server. You'll only need this in the initial building stages to set up your drives and apps. When you're done, you can just stick your computer in a closet without a monitor, but for the setup, just use one of your existing monitors or just hook it up to your TV with a spare VGA cable.
Once you've gathered up all your materials and installed your hard drives, read on to see how to set everything up.
Install Ubuntu and Prepare Your DrivesWe're going to install Ubuntu on one of the hard drives storing our data. It should only take up about 5GB, so it doesn't particularly matter which one—but you'll probably need the drive to be empty before you install Ubuntu. You can copy all your data back afterwards. Grab the Ubuntu live CD here, and either burn it to disc or, if your server-to-be doesn't have a disc drive, burn it to a flash drive instead.
When it's done, insert the CD or flash drive into your server and boot it up. If it isn't set to boot from CD or USB automatically, you may have to go into your BIOS and change yout boot disk priority to include USB drives at the top of the list. You may need to refer to your computer's instructions for how to do this, but you can usually get to the BIOS by holding the Delete key as it starts up, or whatever key is listed on your computer's startup screen.
Once you're booted into Ubuntu, just choose "Install Ubuntu" from the menu, and choose your desired hard drive from the list when prompted. Remember, you want the drive to be empty before you install Ubuntu, so it doesn't overwrite your data. Also, when you create your user, make sure you set Ubuntu to automatically log you in. You don't want to have to type your password every time you reboot your server.
Once Ubuntu is done installing, we'll set up our hard drives. We're going to want to format these drives as ext4 to make Linux compatibility easy, so if they have any data on them right now, you'll want to copy that data somewhere else. We're going to erase them and start from scratch.
Start up your server and open a terminal. Run the following command:
sudo apt-get install gparted pysdmThese are the tools we'll need to work with our drives. Next, click on the Dash (the purple button at the top of Ubuntu's dock), and search for GParted. Click on it to start it up. You should see a list of your drives in the dropdown at the top-right corner of the screen. Choose one of your other drives (not the one that has Ubuntu installed), and then go to Device > Create Partition Table. Click OK, and then select the "unallocated" partition. Press the "New Partition" button in the upper right-hand corner, and format it as ext4. Label it whatever you want (like "Media" or "WindowsBackup"), and click Add. Then, click the green check mark in GParted's toolbar. It will format your drive. Note which drive it is on your system (e.g.,
/dev/sdc) and repeat this process for your other drives.
Share Your Server's Drives with Your NetworkYour new server can do a lot of things, but first and foremost, it's going to "serve" files to your other computers. So, once we have our data on the server, the first thing we'll want to do is share those drives with the rest of our network.
To share a folder or drive, open up a terminal and run the following command:
gksudo nautilusThis will start up Nautilus (Ubuntu's file manager) with root permissions, which we'll need to share our drives. Next, right-click the drive in the left sidebar, and choose Properties. Go to the Share tab, and check the "Share this Folder" box. The first time you do this, Ubuntu will probably prompt you to install the Windows file sharing service. Install anything it asks you to, and then restart your session when prompted. This won't restart your computer, it'll just turn on the sharing feature. Remember to go back and check the "Allow others to create and delete files" and "Guest access" checkboxes after Windows installs these services.
Then, give your share a name (like "Media" or "WindowsBackup") and check the "Allow others to create and delete files in this folder". When prompted, click "Add the permissions automatically" checkbox at the bottom. This will make it easy to access that folder from other computers on your network. Click "Create Share" and say yes when it asks you to automatically add the necessary permissions. Repeat this process for your other drives.
Lastly, you'll need to create a password for all of those shared drives, so you can access them from any computer (and so other people can't). To do this, just open up a terminal and type the following, replacing
whitsongordonwith your own username:
sudo smbpasswd -a whitsongordonThen type and re-type a password of your choice when prompted.
Now, head over to your main computer and check to see if the folder was shared properly. On Windows, open up Windows Explorer and click on "Network" in the left sidebar. Your server should show up in the list, and if you double click on it, you'll be asked for a username and password. Use the ones you just created, and it should give you access to your folder, with all the data inside. If you're on a Mac, just open up Finder and go to Go > Connect to Server and type in
192.168.0.11is the IP address of your server. Remember, you'll make your life a lot easier by setting up DHCP reservations or a static IP for your server. Then you can type in your username and password to connect to your files.
Three Cool Ways You Can Use Your ServerSharing your drives is fine if all you need is a place to store your files, but your server can do so much more. Here are some ideas.
Back Up Data From Your Main Computerset up Crashplan as described here to back up to that network drive. It works on any platform, and only takes a few minutes to set up. It couldn't be simpler. Alternatively, you could use Windows' built in Windows Backup tool, but you'll need to have Windows 7 Professional or higher to back up to a network drives. See our FreeNAS guide for more info on how it works.
Stream Media to All Your DevicesIf you have a sizeable collection of movies and TV shows, your server is a great place to stash them. Not only does it free up space on your other computers, but with a bit of magic, you can stream those videos to your computers and mobile devices with almost no effort, so your media is with you wherever you go. The easiest way to do this is with the Plex media server.
To set it up, just run the following commands in a terminal:
gksudo gedit /etc/apt/sources.list.d/plex.listAdd the following line to the text file:
deb http://www.plexapp.com/repo lucid mainAnd then run the following two commands in a terminal:
sudo apt-get update sudo apt-get install plexmediaserverWhen it's done installing, the media server will start running. You can add or remove media from your library from any computer, which means your work with the server is done. Just head to any computer and type
192.168.0.11is the IP address of your server. To add movies, just click on "Movies" and navigate to the drive or folder on your server where your movies are stored. If they're stored on another drive, you'll find them under
/Media/[Name of Drive].
Once you've added your media, Plex should automatically organize it into a library for you. The easiest way to stream it to your other devices is to go to Preferences > MyPlex and set up an account from the Media Manager interface. Then, download the Plex app for iOS, Android, Google TV, or your other computers and sign in with your MyPlex account there. You should see your whole library, available for streaming wherever you are. And, any time you want to edit your Plex library, you can do so by going back to the Media Manager web interface from any computer—no need to futz with your server.
Plex is our favorite media streaming app, but it isn't your only choice. If you just want to share your media with the computers in your house, you can easily add your server's shared media folders to XBMC on another computer, or set up a music streaming service like Audiogalaxy or Subsonic for a more music-focused experience.
Set Up BitTorrent for Constant File SharingBitTorrent is great, but it's far more useful when it's always on. Maybe you want new movies and TV shows as soon as they're available, or perhaps you're part of a private tracker that requires you to seed all the time. Whatever your needs, you can use your server to run BitTorrent 24/7 and monitor it from any computer in your house.
We're going to use our favorite BitTorrent client, Deluge, to get this done. To install Deluge, just open up a terminal window and run:
sudo apt-get install deluge deluge-web deluged
192.168.0.11is your server's IP address. It'll ask you for a password. The default is
deluge, though it'll prompt you to change it to something new right away, which you should do. From then on, you can add new torrents, monitor existing ones, and change any torrent-related preferences right from this web UI—no need to dig out your server. Just be sure to set Deluge to download torrents to one of your shared folders, so you can access those downloads when they finish.
Lastly, click on the Dash and search for "Startup Applications". Click on it, and press the "Add" button. Name it "Deluge Daemon" and enter
delugedfor the command. Click Add and close the window. This will ensure that Deluge starts up every time you reboot your server.
Don't forget to anonymize that BitTorrent traffic with a proxy service like BTGuard, or a VPN like one of these. You also set up programs to automatically download TV shows and movies, or even install a Usenet client on your server too.
This isn't the only way to set up a home server with Ubuntu, but it's certainly the easiest. These instructions should get you started, but once you're set up, the world is your oyster. If you've already put together a home server before, let us know what you use it for in the comments. Source: http://lifehacker.com