Home Server

Why you would even want one?

Setting up a home server is easier than you might imagine. We often think of servers as those things that let us use the internet, and this is true. In even simpler terms we can use it to host files (eg. music and movies) and then access those from any computer on your LAN. In fact we could access them from any computer anywhere with an internet connection, but for now we'll keep things simple because accessing from across the internet requires some extra security considerations. In no time you'll be streaming music wireless across your house, no more syncing gigabytes across multiple devices.

Getting Started

First things first I am going to focus on doing this in Linux. Everything I describe is possible in Windows, but I choose to do this in Linux primarily because you'll get the most bang for your buck out of older and dated equipment. Use whatever distribution you feel comfortable with, a window manager is not required, but can make the setup a lot easier. Which brings me to my next point, you need to choose what will be your server computer. You can go out and buy something like the Raspberry PI, you can use the computer your using right this moment, or you can round up and old and unused computer, repurpose it, and give it new life.

Various Methods of File Transfer

There are a number of different ways you can access files on the server computer. One of the easiest ways and optimal ways for streaming content is to use SAMBA shares. You may already be using SAMBA shares or something similar. When you go into your file browser and right click on a file you'll see an option to "share this folder". When you select it you can choose to password protect it. Well this pretty much the gist of what we're going to do. Say you are doing this all from the command line, well then you're going to need to edit the SAMBA configuration file (mine is at /etc/samba/smb.conf. This really isn't too hard, simply append a line that is something like this:

[INSERT_SHARE_NAME_BETWEEN_BRACKETS]
comment = Ubuntu Server
path = /PATH/TO/FOLDER/YOU/WANT/TO/SHARE
browsable = yes
guest ok = yes
read only = no
create mask = 0755

And then you will need to restart SAMBA, for Ubuntu: service smbd restart
service nmbd restart

Once you've created a network share, go into another computer on your network and click on the link to "Browse Network". You sometimes will then have to click the "Workgroup" icon and then you'll see an icon with your hostname and then that will take you to all the files you are sharing.

Network shares are cool and pretty handy, but they have their limitations. What you can do is install an SSH server onto the server. Now you'll be able to do two things. First you'll be able to log on and remotely administer it (so BASH isn't your thing yet, no problem, just install a VNC remote desktop server) and secondly you can use sftp as a file transfer hybrid of both SSH and FTP. If you don't know what this means; you can securely access and modify the directories on your server.

Now SFTP is totally different than using SAMBA, it is optimized for transferring files, especially ones that you don't want to be publicly available. Whereas SAMBA is perfect for making files open for anyone everyone to access and to stream media content. These two things aren't exclusive in the least, you'd do best to use them both depending on your circumstances.

Apache

So you want to actually put web files onto your computer and access them like a website? Well for this you need to install Apache. Once you have Apache running you will have a folder called www and this will have a file called index.html. This is the homepage of your server. The default index page says something along the lines of "It's working!", you can replace this with your own page. And other computers on your LAN can access this by typing your local IP address into their web browser.

Now everything I've mentioned so far has been on the LAN. In order to use any of these services over the internet you will need to configure some settings in your router, this is called port forwarding. Your router acts as a firewall between your computer and the rest of the internet. Unless your running a server there are only a few services that really need access to the outside world and so the rest are blocked to keep you safe from intruders.

Since we want these services available we have to tell the router to forward a the specific ports of these services to our server. For example http uses port 80, if you forward port 80 to your server then you and anyone can access that index.html file by using your global IP address. From there you can assign a domain to that IP and you'll officially be hosting your own real live website.

Note: This is obviously not a comprehensive guide. Rather a quickstart and overview of the various services and software you'll want or need for your server. When it comes to things such as port forwarding make sure you have done the necessary research and followed proper precautions because you will be opening your machine to the rest of the world.