How to set up your own home server

Digital freedom
5 mins
An illustration of a desktop computer with a house roof.

This guide requires you to use the command line interface, or CLI, and an SSH client. SSH (Secure Shell) is a popular tool to “remote control” devices securely. In principle, it functions similarly to a VPN, with the exception that you gain access to a computer, rather than the entire internet.

Windows

Windows 10 has a native command line interface, though it might not be installed by default. To install it:

  1. Go to Settings > Apps
  2. Click Manage optional features under Apps & features

If an SSH client is installed on your machine it should appear here. If not, you can add it by clicking “Add a Feature” and then choose “OpenSSH Client.” Don’t install the OpenSSH Server.

To use the SSH client, you need to first open a PowerShell, which can be done by right-clicking the Start Menu or by pressing Windows+X and then selecting the PowerShell.

Once you have launched the PowerShell you enter SSH to be ready.

Mac OS

Open the terminal with Spotlight, the Launch Pad, or Finder.

Linux

Open the command line with Ctrl+Alt+T

Useful tips when using the command line

  • Copy/paste: The standard Ctrl+C and Ctrl+V won’t work in the command line, but you can use Ctrl+Shift+C and Ctrl+Shift+V instead. You can also use your mouse pointer to select text and then copy/paste it by right-clicking the area that you marked. Often you can also paste content by clicking the middle-key or wheel on your mousepad or mouse.
  • Using the up/down arrows in your keyboards will let you browse through recently executed commands, which is very useful if all you need is change a small typo.
  • Use Ctrl+C to abort a command that is stuck. This will also get you out of most menus or programs.
  • The command line is also a bit like a one-dimensional file explorer. Use the ls command to see which files exist in the current folder, or cd to move to a specific directory. cd .. will move one directory down and cd ~/ goes back to the home folder.

A screenshot of the command line.

  • See which drives are currently connected and how much they are used with the df -h option.
  • You can use the Tab button to autocomplete many instances, for example when selecting a folder to move into with cd, copy with cp, move with mv, or delete with rm. Type cd d followed by the Tab button will automatically complete a folder starting with d, if it exists. If there are multiple folders starting with d you can press the Tab button again to see the full list.

A screenshot of the command line.

Get a Virtual Private Server

Any server will do. With little effort, you can even convert an old laptop or use a Mini PC for ~US$100. Even a computer as small as a Raspberry Pi will theoretically suffice.

In our case, we will rent a Virtual Private Server (VPS) from Lunanode. We chose Lunanode because it’s relatively easy to sign up without identification; they accept Bitcoin and are reliable. Another great alternative is Cryptohost (who even take Lightning!). More pricey, but also requiring less personal information for sign up is Njal.la.

Alternatively, you may also opt to choose one of the larger providers such as AWS, Digital Ocean, or Rackspace.

Sign Up

To sign up to Lunanode, you’ll need to verify your email address and phone number, then select your country and choose a password. You can immediately deposit Bitcoin into your account to start paying for your server or enter a credit card to bill you automatically.

Pricing

We recommend the m2 server for US$7 per month. And we’ll add 80GB of storage for an extra $2.7 per month.

Find your SSH key

  • In Windows, use the SSH client (see above).
    1. If this is your first time using the SSH client, type ssh-keygen -o -b 4096 -t rsa on the command line to generate a key.
    2. Once you have generated a key, or if you already have a key, find it at C:\Users\YourUserName\.ssh\id_rsa.pub
    3. Open this file with your notepad and add it to your Lunanode panel
  • In Mac OS, open the terminal with Spotlight, Launch Pad, or Finder
    1. Create an SSH key with the command ssh-keygen -o -b 4096 -t rsa
    2. You can then find your SSH key under ~/.ssh/id_rsa.pub
    3. Open this file with your notepad and add it to your Lunanode panel.
  • In Linux, open a terminal with the command Ctrl+Alt+T
    1. Create an SSH with the command ssh-keygen -o -b 4096 -t rsa
    2. You can then find your SSH key under ~/.ssh/id_rsa.pub
    3. Open this file with your notepad and add it to your Lunanode panel.

Add your SSH key

In your Lunanode dashboard, find the option ‘SSH Keys’ on the left side. Give your SSH key a name and paste the contents of your notepad in its entirety into the public key field, then click ‘Add SSH Keypair.’ It should then appear in the list.

Launch your server

To create your virtual machine, click on ‘Create VM’ on the top left corner of your Lunanode dashboard. Choose a location, plan, and operating system, then decide on a hostname. In our case, that is Toronto, m2 on Ubuntu 18.04 (64bit) and we named it Torontola. You’ll also need to add your keypair so you can securely log in.

Log into your server

Under ‘virtual machine’ you should see your instance now. Click on its name and you should see, among others, its external IP address. You can log into your server by opening up a Terminal window and entering the command:

ssh ubuntu@

for example: ssh ubuntu@192.168.1.1

Since it’s your first login, you will likely be told the authenticity of your host couldn’t be confirmed. Enter yes to add your machine to your list of trusted devices. You’ll be warned again if the key changes.

Configure your server

We’ll set up a simple firewall to protect the server. Ufw (uncomplicated firewall) should be pre-installed on your machine. You can see if it’s installed or enabled by typing sudo ufw status

If you aren’t shown a “Status” message in response you can install it with sudo apt install ufw

Most important, we’ll need to enable SSH so that we can continue to log into our machine remotely. We can only skip this step if we have direct access to the server, meaning we can plug a monitor and keyboard into it. If we can’t, we must enable SSH with sudo ufw allow ssh

Now we can turn the firewall on with sudo ufw enable

Update your server

Make sure that your server is up to date by running the commands sudo apt update and sudo apt upgrade.

Now you’re all set!

Lexie is the blog's resident tech expert and gets excited about empowerment through technology, space travel, and pancakes with blueberries.