DEV Community

Cover image for Getting Started with Self-Hosting: Your First Home Server
Sarthak Goyal
Sarthak Goyal

Posted on

Getting Started with Self-Hosting: Your First Home Server

Self-hosting opens up a world of possibilities, giving you the freedom to build and run almost anything in your homelab. The only real limit is the capacity of your hardware.

Beyond the flexibility it offers, self-hosting is an excellent way to explore new technologies and enhance your technical skills through hands-on experience. It allows you to host your own projects without depending on third-party services, often at little to no cost. While some setups may require a modest investment, students can take advantage of the GitHub Student Developer Pack to get started for free.

You can also repurpose old hardware — such as an unused laptop or desktop — that might otherwise end up discarded, giving it a new life in your home server setup.

How to Get Started

Getting started with your first home server is straightforward. The only essential equipment you need is:

  • A device to serve as your server (an old laptop, desktop, or any spare computer)
  • An Ethernet cable (recommended for a stable connection)

Step 1: Install an Operating System

The first step is to install an operating system (OS) on your server that will run your services. For beginners, I recommend using Linux, specifically Ubuntu Server, due to its ease of use and strong community support. Here is a tutorial to help you install Ubuntu server.

Note: Familiarity with the command line (terminal) is helpful but not mandatory. A good beginner tutorial for Linux terminal basics can be found here.

If your device already has Windows installed and you prefer not to replace it, you can skip the OS installation step and proceed, but using Linux generally provides a more flexible environment for server applications.

Step 2: Connect Your Server to the Internet

You have two main options to connect your server to the internet:

  • Ethernet cable: Preferred for a stable and reliable connection.
  • Wi-Fi: Possible, but reliability can vary depending on signal strength.

After connecting your server to the network, find its IP address by running the following command in the terminal:

ip a
Enter fullscreen mode Exit fullscreen mode

Look for the local (private) IP address associated with your network interface (often something like 192.168.x.x or 10.x.x.x). The loopback address (127.0.0.1) is not the one you need.

Output of ip a

Step 3: Connect to Your Server Using SSH

Moving forward we will use SSH to connect to our server to manage it and deploy services on it. SSH (Secure Shell) allows you to manage your server remotely from another computer on the same network.

On your host machine, open a terminal and run:

ssh username@ipaddress
Enter fullscreen mode Exit fullscreen mode

Replace username with your server's user account name and ipaddress with the IP address you found in the previous step.
The first time you connect, you will be prompted to verify the server's host key:

The authenticity of host '192.168.1.10 (192.168.1.10)' can't be established.
ECDSA key fingerprint is SHA256:Zf45K8eT0Q9nsPz4lYgG+ZxCwFJ7X9A3lRM9z+EtO1k.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.1.10' (ECDSA) to the list of known hosts.
username@192.168.1.10's password:
Enter fullscreen mode Exit fullscreen mode

Type yes and enter your password when prompted (note: password input will be hidden).

Step 4: Update Your Server

Once logged in, update your package lists and upgrade installed software to the latest versions:

sudo apt update && sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

Now the real fun begins. We will now start deploying services on our server using docker.

Step 5: Deploy Your First Service with Docker

Docker is a containerization platform that packages applications and their dependencies into portable containers. Containers ensure that applications run consistently across different environments.

For beginners, Docker simplifies deploying and managing services on your server. To learn more about docker here is a simple tutorial to help you with the basics of the docker.

Installing Docker on Ubuntu Server

Follow the official Docker installation guide here: Docker Engine Installation on Ubuntu.

Step 6: Install Portainer for Container Management

Portainer is a lightweight management UI for Docker that makes container management accessible via a web interface.

Run these commands to set up Portainer:

sudo docker volume create portainer_data
sudo docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:lts
Enter fullscreen mode Exit fullscreen mode

You can now access Portainer by navigating to:

https://<your-server-ip>:9443
Enter fullscreen mode Exit fullscreen mode

For example, if your IP is 192.168.1.10, open:

https://192.168.1.10:9443
Enter fullscreen mode Exit fullscreen mode

And there you have it, your very first service running in your own server. In the upcoming blogs we will explore more services that can deployed on your server. I will be posting every Monday so you should look forward to it.

If you found this guide helpful, consider subscribing or following for more tutorials. Also leave a like if you want more such content.
You can also share your thought in the comment section.

Cheers,
Sarthak

Top comments (0)