Well, If you’re reading beyond the title of this post, I’m guessing that you’ve already thought about why you’d want to build a home server. If you’ve stumbled onto this post and aren’t really sure as to why you might do something so nerdy, please head over to this post to see if it might be a good fit for you. The “How” to build said server is a discussion for another time, but if you’ve decided you’d like to start down this path, there are a few things you’d do well to prepare for.
Below is a list of things that – after a lot of trial and error- I wish I’d gotten a handle on before I tried building my first server.
Story time: When I was building my first server out of an 8 year old desktop that was no longer needed, I stumbled through multiple articles and blog posts (probably like you’re doing right now) and spent hours pouring over suggestions on how to get a RAID 5 array set up ( I know- they’re out of style now) and to set up a virtual machine to work as a Samba server to share the files over the network. After days and hours of working away, I finally got the whole shebang set up… there was just one problem… I could connect to the Samba Server but the files wouldn’t share. Something to do with permissions I guessed. I was so tired and had worked so hard to get this thing up and running I just needed to see it working. I didn’t know what permissions needed to be changed or where, so I figured I’d just open up the entire system, so I set chmod 777 to the root file system… and everything broke. With a few keystrokes I effectively ruined the hours of work I’d put into the system. I couldn’t even boot properly. I turned my old decrepit computer into an even less valuable paperweight. After another day and several more hours I was able to use a USB bootable drive to get in and recover my system, but the point is that I could’ve avoided that completely if someone had mentioned in all of the blogs and webpages I’d visited to be wary of performing sudo operations you do not understand.
Now I’m not blaming others for my ignorance, but rather using this story to justify this post and (hopefully) save you the hours I’ve spent learning the hard way.
Here goes nothing…
1. Beware of sudo operations you do not understand
… you knew this was coming, right? Okay, but seriously, it bears repeating. There will be a LOT of commands you are putting into the terminal based on what the internet is telling you. Most of the time it won’t be catastrophic even if it doesn’t work. But there are commands that could be. Typically those commands are preceded by the word “sudo” (super user do) and is required to do anything at the admin level within the system.
There are also some very damaged people online that will intentionally tell you to enter awful commands into your terminal when asking for advice. While this is rare, I’ve heard of it happening, so best beware. Though most sites like Stack Exchange do a good job monitoring these kinds of malicious responses, it’s best to check twice, type once.
You can check twice by:
a.) check the man pages (manual pages) of a command by typing “man” followed by the command itself into a terminal, for instance if you wanted to know what df was all about you’d type:
from there, you can keep hitting the spacebar to read through the entire instruction set or hit “q” when you think you’ve “got it”.
b.) Check a site like the Linux/Unix Stack Exchange. It’s a great resource, but there is a bit of a learning curve to searching thoroughly before asking a new question. In addition to the malicious types that lurk in the dark corners of the internet, there are also insufferable know-it-alls that long to talk down to you if you ask a question that’s already been answered somewhere. Most folks are kind and helpful, though, so don’t be afraid to utilize a resource like this.
c.) Try entering the command you’re planning to type into the google search bar first. You’ll likely get a smattering of various sites and posts. From there you can refine the search once you click around and get a sense of what you don’t know.
2. Get a few commands under your belt
Along the same lines as the above, I’d recommend understanding the basics. There is a great set of posts (start here) with 90 commands that linux admins use all of the time. I’d recommend you read all of these posts as it is a great starter kit, so to speak, for an admins toolbox. If you’re in a hurry, though, or if 90 sounds like too many to start with, here are the commands you’ll see most often in this series:
- mount/umount – used to mount and unmount disks and drives onto the system.
- cd – change directory– allows you to navigate the directory structure (like clicking in and out of folders in windows).
- df – disk free – shows how much disk space is available/in use.
- lsblk – list block devices – displays “block” devices like hard drives and usb drives.
- mkdir – make directory – creates a new directory (folder)
- cp – copy – copies a file or a whole directory
- mv – move – moves files around
- rm – remove – deletes a file or folder
- cat – concatenate – allows us to view contents of a file or create a new file
- nano – one of the most basic text editors in linux.
- touch – creates a file… without any content
- ls – list – lists the files in the directory you define (default is the directory you are in when you call the command).
- pwd – present working directory – tells you exactly where you are in the file system.
- chmod – change mode (permissions) – alters the permissions and accessibility of files and directories.
- shutdown – what do you think this is? Yep. You’re right.
- reboot – also pretty self-explanatory
- clear – Yes, it clears the terminal of all of your mistyped and ill-conceived commands (and all the correct ones too).
Note: These definitions are the most basic “wrap your head around the concept” descriptions you’ll find. As you progress through this series you’ll use options and other modifying elements to utilize and better understand what these commands do and, more importantly, how to use them.
3. Familiarize yourself with the directory structure
Having used Windows for the majority of my life, seeing the file system as only text on a command line in linux felt very foreign to me at first. If you’re anything like me I would recommend spending some time familiarizing yourself with where things are. If you plan on following these tutorials, below of are the most commonly referenced and accessed directories.
- /mnt – This is the directory where we will be making new directories to house disks we want to mount (like USB drives or external hard drives, for instance).
- /etc – This directoy has many sub-directories within it. it is also where applications like Samba and autofs will create their configuration files when downloaded.
- /home/[USER-NAME]/ – this is your home directory
- /root – This is where some super-secret stuff should live (ssh keys, credential files, etc.)
Note: the /root directory is only accessible as root, and as such should be treated the same way you’d treat a table saw you’ve never used before; with caution and respect.
If you take the time to follow the above steps, I can safely say that you’ll save yourself hours of heartache as you start out on this long and winding road of technological efficiency and self-sufficiency.
Been playing with linux for a while? Did I leave something out you wish someone told you at the beginning of your journey? Leave a comment in the comments section and save someone else the pain and suffering you experienced!
Thanks for reading and stay tuned for the next post!