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.

155 lines
6.3 KiB
Markdown

1 year ago
# Beginners Speedrun to Selfhosting
###### guide-by-example
You want to selfhost stuff.<br>
1 year ago
You know little and want to start somewhere, FAST!
1 year ago
1 year ago
# Requirements
1 year ago
11 months ago
* A **spare PC** that will be the server. Can be a **virtualmachine**.
1 year ago
* **Google**.<br>
If the guide says do X, and steps seem insuficient,
you google that shit and add the word **youtube**.
1 year ago
1 year ago
# Install a linux on the server
1 year ago
1 year ago
![endeavouros_logo](https://i.imgur.com/DSMmaj8.png)
[Some video.](https://www.youtube.com/watch?v=SyBuNZxzy_Y)
1 year ago
* **download linux iso**. For noobs I picked [EndeavourOS \(2GB\)](https://github.com/endeavouros-team/ISO/releases/download/1-EndeavourOS-ISO-releases-archive/EndeavourOS_Cassini_Nova-03-2023_R1.iso)
10 months ago
* *why that linux and not xxx linux?*
* Under the hood its Arch Linux.
* *why arch then?*
* fuck you, thats why, I am not writing a novel here.
1 year ago
* **make bootable usb** from the iso, recommend use [ventoy](https://www.ventoy.net/en/doc_start.html)
1 year ago
* download; run; select usb; click install; exit; copy iso on to it
1 year ago
* **boot from the usb**, maybe on newer machines need to disable secure boot in bios
* **click through the installation**
* pick online installer when offered
* during install, there can be step called `Desktop` - pick `No Desktop`<br>
or whatever, does not really matter
* when picking disk layout choose wipe everything
* username lets say you pick `noob`
* done
1 year ago
# Basic setup of the linux server
![ssh](https://i.imgur.com/ElFrBog.png)
1 year ago
1 year ago
**SSH** - a tiny application that allows you to execute commands
1 year ago
from your comfy windows PC on the damn server
* log in to the server and be in terminal
* ssh is installed by default, but disabled
* to check status - `systemctl status sshd`
* to **enable it** `sudo systemctl enable --now sshd`
* `ip a` or `ip r` - show [somewhere in there](https://www.cyberciti.biz/faq/linux-ip-command-examples-usage-syntax/#3)
what IP address the server got assigned<br>
lets say you got `192.168.1.8`,
nope I am not explaining IP addresses
* done
*arrow up key in terminal will cycle through old comamnds in history*
1 year ago
# Remote connect to the server
![mobasterm_logo](https://i.imgur.com/aBL85Tr.png)
1 year ago
* **install** [mobaXterm](https://mobaxterm.mobatek.net/) on your windows machine
* use it to **connect** to the server using its ip address and username
* [have a pic](https://i.imgur.com/lhRGt1p.png)<br>
* done
1 year ago
# Install docker
![docker_logo](https://i.imgur.com/6SS5lFj.png)
1 year ago
1 year ago
**Docker** - a thing that makes hosting super easy, people prepared *recipies*,
1 year ago
you copy paste them, maybe edit a bit, run them
11 months ago
* **install docker-compose and ctop** - `sudo pacman -S docker-compose ctop`
1 year ago
* **enable docker service** - `sudo systemctl enable --now docker`
* add your user to docker group so you dont need to sudo all the time<br>
`sudo gpasswd -a noob docker`
* log out, log back in
* done
1 year ago
# Using docker
1 year ago
Well, its time to learn how to create and edit files and copy paste shit
in to them, IN LINUX!<br>
1 year ago
Honestly could be annoying as fuck at first, but mobaXterm should make it easier
10 months ago
with that left directory pane and right/middle mouse click for paste.<br>
11 months ago
Nano text editor is relatively simple and everywhere so that will be used.
1 year ago
* be in your home directory, the command `cd` will always get you there
* 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`
1 year ago
* paste in to it this *recipe*, spacing matters
1 year ago
```
services:
nginx:
image: nginx:latest
container_name: nginx
hostname: nginx
ports:
- "80:80"
```
* save using `ctrl+s`; exit `ctrl+x`
1 year ago
* run command `sudo docker compose up -d`<br>
will say the container started
11 months ago
* you can now run command `ctop`<br> a small [utility](https://github.com/bcicen/ctop)
for managing containers<br>
see their status, see their resource use, see their logs (arrow left),
see detailed info(arrow right)
1 year ago
* on your windows machine go to your browser<br>
1 year ago
in address bar put the ip of your server `192.168.1.8` bam<br>
1 year ago
![nging_welcome](https://i.imgur.com/Iv0B6bN.png)
10 months ago
# understanding what you just did
1 year ago
10 months ago
* on a linux server a docker container is running, its a webserver and it is
accessible for others on your network.<br>
1 year ago
Most of selfhosted stuff is just 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(minecraft server) is just one `docker-compose.yml` away.
* you could almost abandon terminal at this point, just start googling portainer
10 months ago
and you can be doing this shit through a webpage. I dont use it,
but I heard it got good, though bit bothersome since its pushing subscriptions.
1 year ago
10 months ago
# understanding what you did not get done
1 year ago
* 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.
1 year ago
She tells you that the dumb fuck you are, you do not have public IP and ports
1 year ago
forwarded.<br>
To get that working is bit challenging, probably deserves own page,
10 months ago
not really speedrun, but thorough steps as shit gets sideways fast and people
1 year ago
can dick around for hours trying wrong shit.
* everything here is just basic setup that breaks easily,
1 year ago
server got dynamic IP, turn it off for a weekend and it might get a different ip
assigned next time it starts. Container is not set to start on boot,...
1 year ago
* you dont understand how this shit works, fixing not working stuff be hard,
but now you can start to consume all the guides and tutorials on
docker compose and try stuff...
1 year ago
## where to go from here
Can check out [this repo](https://github.com/DoTheEvo/selfhosted-apps-docker)
10 months ago
It has tiny section for noobs, with few links to docker tutorials.<br>
You should get some understanding of docker networks going,
making sure you create custom named one and use that in your compose files.
Then its time to start trying stuff like bookstack or jellyfin or minecraft.