I’ve been following this community for some time in order to learn about self-hosting and, while I have learnt about a bunch of cool web services to host, I’m still lost on where/how to start. Does anyone have, like, a very beginner guide that is not just “install this distro and click these buttons”? I have an old laptop that runs Arch (btw), but I’m not familiar with networking at all. So anything starting from “you can check your IP address using ip a” would be appreciated.

More specifically, I have a domain that I want to point to an old laptop of mine (I intend to switch to a VPS if/when I feel like the laptop is starting to lose it). How do I expose my laptop to the internet for this to work (ideally without touching my router, because I’ll be traveling quite a bit with my laptop and don’t mind the occasional downtime). I assume that once I’m able to type my domain name on my mobile and see it open anything from my laptop, I can then setup all the services I want via nginx, but that’s step 2. I tried to follow a few online guides but, like I mentioned, they’re either too simplistic (no I don’t want to move to Ubuntu Server just for this) or too complex (no I don’t know how DHCP works).

Thanks in advance

  • Jaffa@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    I second containers. I use Unraid and have found it pretty simple to get started. At one point I was using a vm on unraid as my gaming machine, although I have moved away from that and now have a low power Unraid server for hosting.

    • maxprime@lemmy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      I agree. Unraid is great because it is user friendly and easily scalable. I started using it a few years ago just to set up a NAS with two HDDs and a Plex library and now have over 50 containers and 8 drives. That’s the beauty of it. You want more drives, just add one. I feel like TrueNAS is probably technically better but this feature was really important to me because I had a feeling that scaling up would be in my future.

      The community is very supportive and SpaceInvader One is an amazing resource, as well as Trash (SIO is not trash, Trash is the name of another resource lol)

  • Shdwdrgn@mander.xyz
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    It sounds like maybe you’re looking for a primer on how networking works across the internet? If so, here’s a few concepts to get you started (yeah unfortunately this huge post is JUST an overview), and note that every one of these services can also be self-hosted if you really want to learn the nuts & bolts…

    DNS is the backbone of everything, it is the service that converts names like “lemmy.world” into an actual IP address. Think of it like the phone book of the internet, so like if you wanted to call your favorite pizza place you would find their name, and that would give you their phone number. Normally any domain that you try to reach has a fixed (or static) IP address which never (or rarely) changes, and when you register your domain you will point it to a DNS server that you have given authoritative access to provide the IP where your server can be found.

    But what if you’re running a small setup at home and you don’t actually have a static IP for your server? Then you look to DDNS (Dynamic DNS) and point your domain’s DNS to them. There are several free ones available online you can use. The idea is you run a script on your server that they provide, and every time your IP from your ISP changes, the script notifies the DDNS service, they update their local DNS records so the next person looking for your domain receives the updated IP. There can be a little delay (up to a few minutes but usually only seconds) in finding the new address when your IP changes, but otherwise it will work very smoothly.

    You mentioned DHCP, so here’s a quick summary of that. Basically you are going to have a small network at your home. Think of your internet router as the front-end, and everything behind it like you computers or mobile devices are going to be on their own little private network. You will typically find they all get an IP address starting with 192.168.* which is one or the reserved spaces which cannot be reached from the internet except by the rules your router allows. This is where DHCP comes in… when you connect a device it sends out a broadcast asking for a local network IP address that it is allowed to use. The DHCP server keeps track of the addresses already in use, and tells your device one that is free. It will also provide a few other local details, like what DNS server to use (so if you run your own you can tell the DHCP service to use your local server instead of talking to your ISP). So like the phone book analogy, your DHCP service tells all of your local devices what phone number they are allowed to use. other Now to put all of this together, you probably have a router from your ISP. That router has been pre-programmed with the DHCP service and what DNS servers to use (which your ISP runs). The router also acts like the phone company switchboard… if it sees traffic between your local devices like a computer trying to reach your web server, it routes those calls accordingly. If you are trying to get to google then the route sends your call to the ISP, whose routers then send your connection to other routers, until it finally reaches google’s servers. Basically each router becomes a stepping stone between your IP address and someone else’s IP address, bringing traffic in both directions.

    OK so now you want to run a web server for your domain. This means that besides getting the DNS routing in place, you also need to tell your router that incoming web traffic needs to be directed to your web server. Now you need to learn port numbers. Web pages traffic on port 80, and SSL pages use port 443. Every type of service has its own port number, so DNS is port 53, ftp is port 21, and so on. Your router will have a feature called port-forwarding. This is used when you always want to send a specific port to a specific device, so you tell it that any incoming traffic on port 80 needs to be sent to the IP address of your web server (don’t worry, this won’t interfere with your own attempts to reach outside websites, it only affects connections that are trying to reach you).

    Now if you’ve followed along you might have realized that even on your local network, DHCP means that your server’s own IP address can change, so how can you port-forward port 80 traffic to your web server all the time? Well you need to set a local static IP on your server. How that is done will be specific to each linux distribution but you can easily find that info online. However you need to know what addresses are safe to use. Log in to your router, and find the DHCP settings. In there you will also see a usable range (such as 192.168.0.100 to 192.168.0.199). You are limited to only changing the last number in that set, and the router itself probably uses something like 192.168.0.1. Each part of an address is a number between 0-255 (but 0 and 255 are reserved, so except in special cases you only want to use the numbers 1-254), so with my example of the address range being used by DHCP, this means that you would be free to use any address ending in 200-254. You could set the static IP of your web server to 192.168.0.200, and then point the port-forwarding to that address.

    Now remember, your local IP address (the 192.168 numbers) are not the same as your external internet address. If you pay your provider for a static internet address, then your router would be programmed with that number, but your web server would still have its local address. Otherwise if you’re using DDNS then you would tell that service the outside IP address that your router was given by your ISP (who coincidentally is running a DHCP that gave your router that address).

    Let me see if I can diagram this… OK so imagine your router has the internet address of 1.2.3.4, your web server has the local address of 192.168.0.200, and someone from the internet who has address 100.1.1.1 is trying to reach you. The path would be something like this:

    100.1.1.1 -> (more routers along the way) -> your ISP -> 1.2.3.4 (router) -> 192.168.0.200 (server)

    They send a request to get a web page from your server, and your server send the page back along the same path.

    Yes there’s a lot to it, but if you break it down one step at a time you can think of each step as an individual router that looks to see if the traffic going to something on the outside or going to something on the inside. Which direction do I need to send this along? And eventually the traffic gets to a local network that says “hey I recognize this address and it needs to go over to this device here.” And the key to all of this routing is DNS which provides hints on where to forward the information to the next router in the path. I can break things down further for you if something isn’t clear but hopefully that gives you a broad overview on how things move around on the internet.

    • Mars2k21@kbin.social
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      Honestly one of the most well written posts I’ve read. Thanks a lot, helped me understand all of this networking stuff involved with self-hosting since I literally just bought a PC to function as my home server like 2 days ago.

  • Alami@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    There is this mostly French community (second language English) called yunohost (read y u no host) that provides a selfhosting solution accessible for beginners. They even offer one free domain to familiarise yourself hands on (+letsencrypt certificate). I have been using this for two years and it works well, I ran into issues but learned a lot in the process, community and devs are nice and helpful. Based on debian. https://yunohost.org/#/index_en They package most of the popular applications you’d expect for selfhosting (nextcloud, owncloud, WordPress, drupal and easily a hundred other apps)

  • Johannes Jacobs@lemmy.jhjacobs.nl
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    It depends on what you want, but here is where i started:

    I watched a lot of youtube videos about opensource software. Then i got a nice second hand server that was quiet and didnt use too much power. I installed ProxMox on it instead of VMware (opensource) and then i slowly started to build VM’s for whatever i wanted to selfhost.

    A very important aspect that a lot of users ignore is security. You need to keep everything up to date. Follow sites with regards to your software (you can aelfhost freshrss. So thats a nice start) and keep “up” with cybersecurity.

    These days i have a small server with Alpine installed on it. Since most my selfhosted things now come in docker. If you go that way, learn yourself everything anout docker and docker compose. Compose is a really powerful tool once you work with docker!

  • Durotar@lemmy.ml
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    1 year ago

    You’d probably need to configure your router if you want to access your laptop when you’re outside of your home network (e.g. from a mobile phone). If there’s an incoming connection to port 443 (https), your router doesn’t even know which device in the network could handle it. Port forwarding should be easy to set up on any modern router using their web interface. Same applies to some VPS providers like AWS Lightsail, they might have firewalls.

    Like with every big task, take it step by step. You can’t learn everything overnight, start with something small. Set up a web server (e.g. nginx) what will act as a reverse proxy. Make it accessible from the internet. Then try to set up one of the services from your list and focus on it.

    Learn one thing at a time, don’t rush and avoid context switching.

  • Mugmoor@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    To point your domain to your machine you can use Cloudflare tunnels. If you don’t want it publicly available, you can use a VPN.

    • powerofm@lemmy.ca
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I was also going to suggest tunnels (Cloudflare, ngrok, etc) as a great way to test out your setup without worrying about the networking side. They’re not a great long-term solution, but a great step before diving into vpn configuration or messing with a new router.

  • bartolomeo@suppo.fi
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 year ago

    Buy a Raspberry Pi or other SBC, firewall it from the open internet (so it’s only accessible from your home LAN) and start installing stuff like nextcloud and jellyfin on it. See if you can access the files from your other devices. That might be a good start.

    • Goddard Guryon@sopuli.xyzOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      1 year ago

      Going for a RasPi might be a bigger hassle for me due to the market, but I suppose I can try the rest on my laptop as easily. Thanks!

      • bartolomeo@suppo.fi
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Np :) are Rpis still in short supply? There are other good SBCs, notably odroid. Rpi has excellent community and support but if you are after hardware power you’ll be better off with other brands.

        In terms of electricity- laptop is about 65W and SBC is about 4W. If you have a server that you never shut down, the difference will add up.

        Gl, hf!