You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DoTheEvo b7b7dd1991 update 2 weeks ago
..
readme.md update 2 weeks ago

readme.md

Beginners Speedrun to Selfhosting

guide-by-example

You want to selfhost stuff.
You know little and want to start somewhere, FAST!

Requirements

  • A spare PC that will be the server, can be a virtualmachine.
  • Google and chatGPT.
    If the guide says do X and the steps seem insufficient, you google that shit and add the word youtube, or you ask chatGPT few questions.

Common terminology

  • repository - a place on the internet from which linux distro installs stuff.
  • root - a name for an administrator account in linux.
  • sudo - executes command as root with all privilages.

Install a Linux

debian_logo

  • Download linux iso. I picked Debian(650MB)
    • Why that linux and not xxx linux?
    • Fuck you, thats why. I am not writing a novel here.
  • Make a bootable usb from the iso, ventoy is recommend. ChatGPT.
    • Download ventoy; extract; run Ventoy2Disk.exe; select a usb; click install; exit;
    • Copy the Debian iso on to the usb as you would any file.
  • Boot from the usb, maybe on newer machines need to disable secure boot in bios
  • Click through the installation
    • During first time install, would recommend actually reading whats written on screen each step.
      Theres also plenty of youtube videos, which go in to details.
    • Leave root password empty, so that sudo is installed automatically
      • this will disable root account, if you would want it, just set password for root
        sudo passwd root
    • For username lets say noob with password aaa
    • During software selection uncheck everything except:
      • SSH server
      • standard system utilities

This linux will have no graphical interface, just command line.

SSH

ssh_pic

SSH - a tiny application that allows you to execute commands from your comfy windows PC on the damn server. ChatGPT.

During Debian install you should have had SSH server checked, so it would be installed automatically. If you missed it, install it with - sudo apt install ssh

extra info: to check status of ssh - systemctl status sshd

Now to find IP address of the machine so we can remotely connect to it.

  • Log in noob / aaa and be in terminal.
  • ip r - shows at the end the IP of the machine
    lets say you got 192.168.1.8
    Nope I am not explaining IP addresses.

Beware, an IP address can change if the server is shutdown for a while. Lookup static IP or IP reservation.

Remote connect to the server

mobasterm_logo

Now you should be able to execute commands on the server from your main PC.

Install docker

docker_logo

Docker - a thing that makes hosting easier. People prepared recipes, you copy paste them, edit a bit, run them. Bam a container is running and answering at some IP. ChatGPT.

  • install docker - sudo wget -qO- https://get.docker.com | bash
    The above method is called Install using the convenience script, cuz oldman Debian cant be bothered to keep docker up to date in its repos.
  • add your user to docker group so you dont need to sudo all the time
    sudo gpasswd -a noob docker
  • log out - exit, log back in so the group change takes effect
  • install ctop to get some basic monitoring and management.
    Unfortunately ctop is also not in Debians repositories, so uglier two commands to install it:
    • sudo wget https://github.com/bcicen/ctop/releases/download/v0.7.7/ctop-0.7.7-linux-amd64 -O /usr/local/bin/ctop
    • sudo chmod +x /usr/local/bin/ctop

First docker compose

nging_welcome

Well, its time to learn how to create and edit files and copy paste shit in to them, IN LINUX!

Honestly could be annoying, but mobaXterm should make it easier with that left directory pane that lets you move around, and the right/middle mouse click for paste.
But here are general linux commands to move around and to edit files using nano editor.

extra info: arrow-up key in terminal will cycle through old commands in history

  • Be in your home directory, the command cd will always get you there. ChatGPT.
  • Create directory mkdir docker
  • Go in to it cd docker
  • Create directory mkdir nginx
  • Go in to it cd nginx
  • Oh look at you being all hacker in terminal, following simple directions
  • Create empty docker-compose.yml file nano docker-compose.yml
  • Paste in to it this recipe, spacing matters
    services:
    
      nginx:
        image: nginx:latest
        container_name: nginx
        hostname: nginx
        ports:
        - "80:80"
    
  • Save using ctrl+s; exit ctrl+x
  • Run command sudo docker compose up -d
    This is what it should look like
  • You can run ctop to see container status, resource use, logs, details, or to exec in to the container. Like so.
  • on your windows machine go to your browser
    in address bar put the ip of your server 192.168.1.8 bam
    You should see the pic above - Welcome to nginx!

extra info: it should actually be192.168.1.8:80, with the port 80 we see in the compose being used in the url too. But since port 80 is the default http port, it is what browsers go for anyway.

understanding what you just did

  • On a linux server a docker container is running, its a webserver and it is accessible for others on your network.
    Most of selfhosted stuff is just a webserver with some database.
  • If this part is done that means that shit like hosting own netflix(jellyfin), or google drive/calendar/photos(nextcloud), or own password manager(vaultwarden) or own minecraft server(crafty) is just one docker-compose.yml away.

understanding what you did not get done

  • this shit is on your own local network, not accessible from the "outside". Cant call grandma and tell her to write 192.168.1.8 in to her browser to see your awesome nginx welcome running. She tells you that the dumb fuck you are, you do not have public IP and ports forwarded.
    To get that working can be a bit challenging - port forwarding guide
  • everything here is just basic setup that breaks easily, server got dynamic IP, turn it off for a weekend and it might get a different ip assigned next time it starts. Nginx container is not set to start on boot,...
  • you dont understand how this shit works, deploying more complicated stuff, fixing not working stuff be hard, but now you can start to consume all the guides and tutorials on docker compose and try stuff...

WebGUI

  • my recommendation is to not abandon the ssh + terminal. Persevere. Use it, make it comfortable, natural, not foreign and bothersome. This is what gets you proficiency and ability to solve problems... but I understand...

Several options to manage docker from a browser.

  • Portainer CE - the most popular, deployed as a container, they started to be bothersome with the paid version so fuck em
  • CasaOS - simple install, seems nice and growing in popularity
  • Dockge - a very new one, but seems nice and simple
  • TrueNAS SCALE - NAS operating systems with docker managment
  • openmediavault - NAS operating systems with docker managment
  • Unraid - paid NAS operating systems with docker and VMs managment

CasaOS

casa_logo

Easy to create public shares, easy to deploy docker containers from their "app store"

Installation

  • docker compose down any containers you run, or remove them in ctop, or do clean Debian install again
  • To install CasaOS execute:
    wget -qO- https://get.casaos.io | sudo bash
  • Afterwards, it tells the ip to visit.
  • First login set credentials

Create a network share

share.webm



Deploy Jellyfin - selfhosted netflix

jellyfin.webm



Deploy Crafty - Minecraft server manager

crafty.webm



Deploy something not in the app store

will add something later



Dockge

dockge_pic

Beginners hate terminal. Dockge comes to the rescue with its web interface.

Same as nginx example was deployed, we deploy dockge using slightly edited compose file from their github page.

  • Create a new directory dockge mkdir ~/docker/dockge
  • Go in to the docker directory cd ~/docker/dockge
  • Create an empty docker-compose.yml file nano docker-compose.yml
  • Paste the recipe, spacing matters
    services:
      dockge:
        image: louislam/dockge:1
        container_name: dockge
        hostname: dockge
        restart: unless-stopped
        ports:
          - "5001:5001"
        volumes:
          - /var/run/docker.sock:/var/run/docker.sock
          - ./data:/app/data
          - /opt/stacks:/opt/stacks
        environment:
          - DOCKGE_STACKS_DIR=/opt/stacks
    
  • Save using ctrl+s; exit ctrl+x
  • Run command sudo docker compose up -d
  • on your windows machine go to your browser
    in address bar put the ip of your server 192.168.1.8:5001 bam

Now you can do stuff from webgui, pasting compose and .env files.

where to go from here

Google and consume docker tutorials and videos and try to spinning up some containers.
Heres some stuff I encountered and liked.

Check of course this github repo you are in right for some stuff to deploy.