Home Server Part 4 – Things Get Interesting
If you’ve made it this far, congratulations! We’re about to turn that giant virtual machine file or that computer case into something useful. The first step is going to be to install an operating system. Then, I’ll give you a little crash course in Linux if you haven’t used it before. In the next post, I’ll show you a quick way to get files shared between your regular computer and your server, and from then on, we’ll begin adding software and features.
Bringing It To Life
Choosing an Operating System
The title of this section is a bit of a misnomer, since we won’t really be comparing different options here, but don’t think you’re stuck with the option I’m going to document. There are a ton of options for a home server. I prefer Linux because it’s free and open source. And, among all the flavors of Linux available, I prefer Ubuntu server. For one thing, it’s the one I’m most familiar with, having chosen it for my own home server. For another, it’s about as simple as you can get for this sort of thing.
To get a copy of Ubuntu server, head over to the website and download the disc image. You’ll want to select Option 2:
Once downloaded, either boot up your virtual machine with the virtual disc, or burn it to a DVD and put it in your machine. Either way, you’re ready to install. I recommend having your machine connected to the internet by the time you get here.
If everything goes according to plan, you should be looking at something like this:
Just pick your language for the installation and hit enter. Everything from here on out is keyboard driven, so use enter and arrow keys. On the next screen, choose to install, and you’re on your way. The installation will take a few minutes, but eventually you’ll get some additional setup:
You know the drill. Just continue through the options, choosing defaults, until you get here. Unless you’ve got a particularly interesting setup, there should be just a single network option. In my case, ethernet (eth0), so I continue.
Continue using default options. Since your machine is built specifically for this OS, you can also choose the default (Use an entire disk) here. Just navigate to [Done] at the bottom:
You finally have some options to care about. Put your name in for your new server (I just use my first name), a name for your computer itself (the name that appears on the network), and choose a user name (again, I just use my first name). You’ll want a good password for this, too.
I installed OpenSSH on my machine. You can hook up a monitor and keyboard to your server, or you could disconnect both once your OS is set up and use SSH to log in, as I’ll show a little later.
On the last page, you’ll want to select docker for installation. Most of the services we’ll see in future tutorials use Docker. Grab the latest stable release:
When you hit [Done] again, your part is done. Let the installer take care of the rest! When it’s done, you’ll be able to “Reboot Now”.
Linux for Normal People
Making a Connection
As I alluded to earlier when I mentioned you should install OpenSSH, you don’t need to have a monitor and keyboard hooked up to your server. If your server is connected to your network and you installed OpenSSH, grab the free shell tool called “Putty”.
Once installed, you’ll just type in your server’s local IP address (check your router’s connected devices to see this), and you’ll be prompted to log in:
If, when you hit enter, you see the following, you’re good! If not, let me know in the comments. You’ll enter the username you chose earlier and the password, and you’re off.
The Shortest Linux Crash Course
You aren’t just using Linux; you’re jumping straight into the Linux shell. We will go into more commands and useful things to know in a future tutorial, but I want to give you the absolute basics so you can feel a little more comfortable poking around on your newly crafted and still somewhat mysterious device.
If you are familiar with Windows or MacOS, you already know about folder structures, and the same thing exists here in Linux. The difference is the way the folders are laid out. In Windows, for example, you’re probably familiar with paths that look like this:
You have your “C” drive, and a folder under it called “Windows”. The path is C:\Windows. In Linux, the folder structure is a separate concept from the hard drives in your computer. Instead of multiple drive letters, there’s just a single, top-level directory called “root”, and it’s just a slash (e.g. / ).
Everything is contained in this folder; even direct references to hardware, like hard drives. This is true even though your root directory is contained on a hard drive itself. If you aren’t confused, you probably don’t need this little tutorial. The basic things to remember are: everything is in your root ( / ) directory.
This includes, by the way, your user directory. Though it’s stored underneath your root through a full path, there’s a shortcut to your current user: the tilde key (~). This directory is also called your “home” directory.
With all that said, here are a few basic commands you can use to get around.
First, man. This command, followed by the name of any other command or installed program will bring up the manual for it. Very useful stuff, but sometimes hard to parse. Hit q to quit the manual once inside.
Second, ls. This is “list directory contents” command, and you can use it to view all the contents of the director you’re currently in. For example, my home directory has three folders in it: Docker, Documents, and snap. Folders appear in blue when you run ls.
Third, cd. This changes your current directory, just like in Windows, Dos, etc. You can also change directory to the next level up by typing cd ..
If you want to go to your home directory, type cd ~
Fourth, mkdir. If you type mkdir DirectoryName, a new directory will be made called DirectoryName. Simple enough, right?
Fifth, rm, is a bit like the opposite of mkdir. It removes the directory name or file name you type. It needs to be empty, though, unless you specify the -rf flag, as in rm -rf DirectoryName. Be careful using the flag, as you can easily remove stuff you don’t want to remove.
Lastly, cat. This command, followed by a file (e.g. cat FileName), produces the concatenated text of that file for you to read. You can’t edit it through cat (choosing a text editor will be in a later tutorial), but it’s useful to view files.
That should at least let you move around and see the contents of your new server. Next, we’ll work on getting some file sharing going, which will be very useful when we start adding services.