RefBan

Referral Banners

Yashi

Tuesday, June 19, 2012

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with Ubuntu

June 19th, 2012Top Story

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with Ubuntu

By Whitson Gordon

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuYou've heard the word "server" thrown around a lot, but usually in the context of web sites or big companies that have a lot of data to store. In reality, a server can be just as useful in your home. In this guide, we'll walk through how to create your own server at home that you can put in the closet and leave on 24/7, ready to do any streaming, downloading, or backup you might need at a moment's notice.

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 Need

You 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.

We're going to just use the regular Desktop version of Ubuntu for this as opposed to the Server version. It's much easier to set up, and should still run fine on any remotely recent computer. We'll also be installing Ubuntu to one of our storage drives, so you'll need to set aside 5GB or so of space for it. If you wanted to, you could install it on a persistent flash drive, but that's only really useful if you're going to swap out drives often, so most people shouldn't have to worry about it.

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 Drives

We'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.

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuOnce 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 pysdm  

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuThese 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/sdb or /dev/sdc) and repeat this process for your other drives.

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuLastly, before you share your drives, you'll want to make sure they mount automatically every time you start up your server—otherwise, if you ever reboot, you won't be able to access them. To do this, open up the dash and search for Storage Device Manager. Start it up and find your drives in the left sidebar. For each one, click on it and choose "OK" when prompted to configure the drive. Give it a name (again, like "Media" or "WindowsBackup") and click Apply. Repeat this process for each drive. They should now automatically mount at startup. Reboot your server to make sure they do what they're supposed to—if they're mounted at startup, you should see little "eject" icons next to them in your file browser as soon as you start it up. If they don't have eject icons without you clicking on them first, go back to the Storage Device Manager and make sure you did everything correctly before continuing.

Share Your Server's Drives with Your Network

Your 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 nautilus  

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuThis 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 whitsongordon with your own username:

  sudo smbpasswd -a whitsongordon  

Then 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 smb:\\192.168.0.11, where 192.168.0.11 is 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.

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuWindows users can also mount these shared folders as network drives on their computer and give them their own drive letters for easy access. To do so, just right-click on the share you want to mount. Then click "Map Network Drive" to give it its own drive letter. It'll sit in the left sidebar of Windows Explorer, perfect for quick and easy access.

Repeat this process for every folder or drive you want to share from your server. In my case, I've shared the two drives I listed above, named "Media" and "Backup". Your drives will obviously vary, but read on for some cool ideas of what you can do with your new server.

Three Cool Ways You Can Use Your Server

Sharing 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 Computer

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuIf you aren't already backing up your main computer, you should. We recommend using a program like Crashplan to back your data up to the cloud, but your server can be a great backup location too—provided you have your really essential files stored somewhere else online, like Dropbox.

You have a number of options for backing data up to your server, but they should all be pretty simple: just share your backup drive as described above, and then set 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 Devices

If 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.list  

Add the following line to the text file:

  deb http://www.plexapp.com/repo lucid main  

And then run the following two commands in a terminal:

  sudo apt-get update  sudo apt-get install plexmediaserver  

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuWhen 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.11:32400/manage, where 192.168.0.11 is 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 Sharing

BitTorrent 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  

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuWhen it's done installing, fire it up by going to the Dash and typing in "Deluge". Once it starts, to to Edit > Preferences > Plugins, and check the WebUI box. The "WebUI" option should show up in the left sidebar; click it and check "Enable Web Interface" and "Enable SSL". You can change the listening port to whatever you want, but we'll leave it at 8112 for this tutorial. This is how we're going to monitor our torrents from other computers.

To access the web UI from another computer, type the following in your browser's address bar:

  https://192.168.0.11:8112/  

Turn an Old Computer into a Networked Backup, Streaming, or Torrenting Machine with UbuntuWhere 192.168.0.11 is 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 deluged for 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.

Number of comments

No comments:

Yashi

Chitika