For this new year, I’d like to learn the skills necessary to self host. Specifically, I would like to eventually be able to self host Nextcloud, Jellyfin and possibly my email server too.

I’ve have a basic level understanding of Python and Kotlin. Now I’m in the process of learning Linux through a virtual machine because I know Linux is better suited for self hosting.

Should I stick with Python? Or is JavaScript (or maybe Ruby) better suited for that purpose? I’m more than happy to learn a new language, but I’m unsure on which is better suited.

And if you could start again in your self hosting journey, what would you do differently? :)

EDIT: I wasn’t expecting all these wonderful replies. You’re all very kind people to share so much with me :)

The consensus seems to be that hosting your own email server might be a lot, so I might leave that as future project. But for Nextcloud and Jellyfin I saw a lot of great tips! I forgot to mention that ideally I would like to have Nextcloud available for multiple users (ie. family memebers) so indeed learning some basic networking/firewalling seems the bare minimum.

I also promise that I will carefully read the manuals!

  • terminhell@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    54 minutes ago

    Patience, and knowing when to look for documentation. Keep notes of stuff as you go. Just like in real IT, documentation can go a long way. Forgetting simple things can cause everything to fall apart at some point.

  • Presi300@lemmy.world
    link
    fedilink
    English
    arrow-up
    18
    ·
    3 hours ago

    You don’t need to be a programmer to selfhost.

    The most important “skills” to have if you want to selfhost imo are:

    • Basic Networking knowledge

    • Basic Linux knowledge

    • Basic docker/docker compose knowledge

    But I’d say to not get lost in the papers and just jump right in. Imo, the best way to learn how to selfhost is to just… Do it. Most everything is free and fairly well documented

  • ramenshaman@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 hour ago

    Hey OP, I’m just starting my self-hosting journey as well. I can program a little bit in Python and C++ but I haven’t needed any of that so far. As others have said, some familiarity with Linux would be very helpful. The things I’ve done so far:

    • Wireguard VPN server on my router(no programming or linux commands, just some config of my router which I was able to do in the router’s GUI.
    • Wireguard VPN client on some of my devices. My phone setup was easy, still working on setting that up on my Windows/Ubuntu laptop.
    • Home Assistant on a Raspberry Pi (WIP).

    Eventually I plan to set up a NAS with Immich and some local IP cameras and Plex or something similar.

  • Lesrid@lemm.ee
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 hours ago

    I would caution against self hosting email long term. It’s fine for the educational value but there’s a lot of annoying obstacles you can encounter repeatedly even after everything is established.

  • Possibly linux@lemmy.zip
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    2 hours ago

    Why are you wanting to use python for self hosting? Python is a programming and scripting language.

    There are two big things I would focus on. The first thing is networking, the OSI model and http basics. The other thing I would look into is Linux containers. If you can get both of these you are golden. Learn how to use and write docker compose files and then looking into building your own containers with Dockerfiles. You don’t really need to build your own containers but it is good for learning

  • dontblink@feddit.it
    link
    fedilink
    English
    arrow-up
    4
    ·
    edit-2
    3 hours ago

    Enough focus to read documentation.

    That’s really it. If your purpose is just self hosting learning bash could also be helpful. And yeah Linux would be a great choice.

    But mostly, if you want to self host an instance of Nextcloud correctly and without having to deal with too many unexpected things, you have to read the documentation and do not rush. Most self hosted stuff isn’t “install and use”, because you’ll be your own server manager, and everything requires attention to be managed.

    Docker or not docker you will have to deal with configuration, settings, requirements and updates.

    So understanding how to read the docs/search and open github issues and taking time to read everything would be the most important skill for me.

    Also writing down what you are doing would indeed be helpful too, in order not to lose track of what you’re doing on your server. (Check out Ansible).

    Most apps out there simply need you to know about permissions, systemctl services and package managers.

    Try to always find a specific package for your distro for everything you install (eg. .deb for Debian), and have strategies when this is not possible (aka using a Python venv when installing python programs).

  • Avid Amoeba@lemmy.ca
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    3 hours ago

    If you want to program something, the closest you’re gonna get to programming is Ansible and Bash scripts.

    You might want to get self hosting hardware like Synology or the like if you’re not ready to dig.

    Otherwise here’s some things you need to know:

    • Docker
      • Easy, consistent deployment of services in their own environments. Think a VM but with almost no overhead.
    • Docker Compose
      • Run docker containers with consistent configuration in files.
      • Connect various containers to each other on the same or different networks.
      • Get multiple containers to start together and talk to each other.
    • Systemd
      • Manage any service on Linux. If anything needs to start on boot, restart when crashed, start on timer, you want Systemd.
      • You can manage your docker compose containers lifecycle via Systemd.
    • NGINX/Apache/Caddy
      • A web server for reverse proxy. You’d probably need one at some point, especially if you want HTTPS. Your services get hidden behind it.
    • ZFS
      • Reliable redundant storage. You’ll need storage. Use ZFS with 2-disk redundancy.
      • Supports automatic snapshots for recovering from oopsies. E.g. deleted something or some software shat on your data.
      • Can use recertified disks from serverpartsdeals.
      • Can use USB disks or USB box with multiple disks. If you end up going the USB route, ask me for tested hardware.
    • Backup system
      • Something to do backup. There are many options.
    • Ansible
      • If you want to write code that describes your services and make them happen, you want Ansible. You write code (well YAML) and Ansible installs things, writes config files, sets up Systemd services, restarts things. It can be convenient especially if you have a lot of stuff and you want to be able to see all of your infrastructure in code in one place and be able to version it.
    • Prometheus
      • Monitoring your stuff. Is my backup service running? If not send me an email.

    Oh and use Debian or Ubuntu LTS.

    • Onomatopoeia@lemmy.cafe
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      3 hours ago

      Great summary!

      Why Debian or Ubuntu? (I have my own thoughts, but it would be useful to show even high-level reasons why they’re preferred).

      Re: Backup - Backblaze has a great writeup on backup approach today. I’m a fan of cloud being part of the mix (I use a combo of local replication and cloud, to mitigate different risks). Getting people to include backup from the start will help them long-term, so great you included it!

      • Avid Amoeba@lemmy.ca
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        3 hours ago

        Predictable cadence, stable operation, timely updates, huge community and therefore documentation. You can get up to 5 years from an LTS release of Debian or Ubuntu. With Ubuntu LTS and Ubuntu Pro (free) you could theoretically run a machine without upgrading for 10 years. If you run workloads in containers, it doesn’t matter how old the host OS is. As long as it’s security patches, you can keep on trucking.

    • LiveLM@lemmy.zip
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      4 hours ago

      If you end up going the USB route, ask me for tested hardware.

      Send these my way chief

      • Avid Amoeba@lemmy.ca
        link
        fedilink
        English
        arrow-up
        4
        ·
        edit-2
        3 hours ago

        As briefly as possible:

        • Host side
          • If you use Intel, all is well.
          • If you use AMD…
            • Prior to AM5
              • Use an ASMedia PCIe USB card (StatTech, Sonnet)
              • X570 is especially bad, though I’ve had some success with B350, when using the chipset ports. The CPU ports are all bad. Small form factor PCs often only expose CPU USB ports. They work with single disk per port but if you peg a port with a multi-disk box, they crap out regularly.
            • Post AM5
              • Have only tested USB4 on X870 and it’s solid.
        • Client side
          • WD Elements / MyBook
            • If you get disconnects under load and you’re not on a shit AMD USB host, the USB-SATA controller is overheating. Open them and ahere a heatsink on it. Drill a hole in the case above it for better ventilation. Disconnections will stop. If you don’t want to deal with any of that buy the item below.
          • OWC Mercury Elite Pro Quad
            • Well built, solid controllers, no issues over a year of testing. I have 2, hosting an 8-disk RAIDz2 and 2 hosting a 5-disk RAIDz2.
          • Terramaster
            • A friend bought a 6-bay and tore it down for me. It has the same controllers as the OWC in a similar topology. If it’s cheaper it might be OK. I can vouch for the OWC though.
          • Cables
            • Get name brand cables, ideally higher spec than what you’d need! They aren’t important for a single USB disk but running a 4-disk box can max out the port bandwidth. If the cable can’t handle it… errors.
        • LiveLM@lemmy.zip
          link
          fedilink
          English
          arrow-up
          1
          ·
          edit-2
          2 minutes ago

          Much appreciated 🙏
          Gnarly stuff with the WD’s huh? Unfortunately I think that’s what I’ll end up having to put up with since I can’t really find the other options for a decent price around here.
          Funny enough I was half-considering just using a bunch of WD Elements. You think the MyBooks might fare any better?

  • sylver_dragon@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 hours ago

    Along with the things others have said (Backups, Linux, Docker, Networking) I’d also recommend getting comfortable with server and network security. A lot of this is wrapped up in the simple mantra “install your goddamn updates!” But, there is more to it than that. For example, if you go with Nextcloud, read through their hardening guide and seriously consider implementing all of the recommendation. Also think through how you intend to manage both the server and instance. If this is all local, then it is easier as you can keep SSH access to the server firewalled off from the internet. If you host part of your stuff “in the cloud”, you’ll want to start looking at limiting down access and using keys to login (which is good practice for all situations). Also, never use default credentials. You may also want to familiarize yourself with the logs provided by the applications and maybe setup some monitoring around them. I personally run Nextcloud and I feed all my logs into Splunk (you can run a free instance in a docker container). I have a number of dashboards I look at every morning to keep an eye on things. E.g. Failed/successful logins, traffic sources, URI requests, file access, etc. If your server is attached to the internet it will be under attack constantly. Fail2Ban on my wireguard container banned 112 IP addresses over the last 24 hours, for 3 failed attempts to login via SSH. Less commonly, attackers try to log in to my Nextcloud instance. And my WordPress site is under constant attack. If you choose to run Wordpress, be very careful about the plugins you choose to install, and then keep them up to date. Wordpress itself is reasonably secure, the plugins are a shit-show and worse when they aren’t kept up to date.

  • Onomatopoeia@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    2
    ·
    3 hours ago

    Documentation has been mentioned already, what I’d add to that is planning.

    Start with a list of high-level objectives, as in “Need a way to save notes, ideas, documents, between multiple systems, including mobile devices”.

    Then break that down to high-level requirements such as “Implement Joplin, and a sync solution”.

    Those high-level requirements then spawn system requirements, such as Joplin needs X disk space, user accounts, etc.

    Each of those branches out to technical requirements, which are single-line, single-task descriptions (you can skip this, it’s a nice-to-have):

    “Create folder Joplin on server A”

    “Set folder permissions XYZ on Joplin folder”

    Think of it all as a tree, starting from your objectives. If you document it like this first, you won’t go doing something as you build that you won’t remember why you’re doing it, or make decisions on the fly that conflict with other objectives.

  • slazer2au@lemmy.world
    link
    fedilink
    English
    arrow-up
    27
    arrow-down
    1
    ·
    6 hours ago

    Docker really. If something goes bad, trash the container and start again without loosing your actual data.

    • RxBrad@infosec.pub
      link
      fedilink
      English
      arrow-up
      5
      ·
      5 hours ago

      Mostly Docker.

      Portainer and plugging Docker Compose XML into Portainer stacks makes Docker stupid-simple. (personally speaking as a stupid person that does this)

      Cloudflare tunnels for stuff people other than you might want to access.

      Tailscale if it’s only you.

      Reverse proxy & port forwarding for sharing media over Jellyfin without violating the Cloudflare Tunnel ToS.

    • Deckweiss@lemmy.world
      link
      fedilink
      English
      arrow-up
      3
      ·
      edit-2
      5 hours ago

      Dokploy is a pretty easy web gui and is itself a docker container.

      Makes it dead simple to manage multiple containers and domains. (Not for power users that need kubernetes level flexibility)

    • Passerby6497@lemmy.world
      link
      fedilink
      English
      arrow-up
      7
      ·
      6 hours ago

      And regularly check them. I just found out the hard way this last week that my backups haven’t been running for a few weeks …

      • Onomatopoeia@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 hours ago

        Yep.

        I have friends in the SMB space, one thing they do is a regular backup verification (quarterly). At that frequency, restoring even a few files (especially to a new VM), is very indicative, especially if it’s a large dataset (e.g. Quickbooks).

        In Enterprise, we do all sorts of validation, depending on the system. Some is performed as part of Data Center operations, some is by IT (those are separate things), some by Business Unit management and their IT counterparts.

        • Passerby6497@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 hours ago

          Unfortunately, that wouldn’t have done anything. Because I did that in December and they stopped running like 2 weeks after my verification. I would have caught it on my next scheduled validation, but that doesn’t help me now 😕

  • Martin@discuss.tchncs.de
    link
    fedilink
    English
    arrow-up
    3
    arrow-down
    2
    ·
    edit-2
    3 hours ago

    If you have a VM, there is no need for docker. Start by installing ssh. Enable public key auth. Disable password authentication. Set up fail2ban with ssh. Set up ufw. Set up nextcloud. Avoid hosting your own mail, that’s another level of complexity. If you really need it, try mailcow.

    If you have all that and didn’t touch a GUI on your way, you’re good to go.

  • AMillionMonkeys@lemmy.world
    link
    fedilink
    English
    arrow-up
    5
    ·
    4 hours ago

    As others have said, you don’t need to know how to code, but you do need to be comfortable editing structured documents, so knowing a little programming does help.
    Unfortunately, Nextcloud and email are two of the most difficult things to self-host. This is by reputation, I haven’t tried myself. Email is supposed to be particularly difficult and the usual advice is to not bother.
    Jellyfin is pretty straight-forward as long as you don’t have a weird hardware decoding setup and as long as you don’t want remote access. If you do want remote access you need to use third party tools to do it securely. If it’s just for your own use then Tailscale makes it really easy. If you want to share with non-technical users it gets messy.

    • Kaldo@fedia.io
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      I remember reading that tailscale can’t be used for sharing media, was that wrong?

      • Onomatopoeia@lemmy.cafe
        link
        fedilink
        English
        arrow-up
        1
        ·
        3 hours ago

        Performance may be an issue. It’s not specifically designed for streaming performance, and being a software VPN, it will depend a great deal on the devices used at each end.

  • sugar_in_your_tea@sh.itjust.works
    link
    fedilink
    English
    arrow-up
    11
    ·
    edit-2
    6 hours ago

    Persistence and reading comprehension.

    There’s no need to learn Python or any programming language to self host stuff, you just need to be able to follow blog posts and run some Docker commands.

    I’m a software dev and haven’t touched a single line of code on my NAS. Everything is docker compose and other config files.

  • habitualTartare@lemmy.world
    link
    fedilink
    English
    arrow-up
    9
    ·
    6 hours ago

    Learning Linux is a great start.

    Learning any coding language will help you understand a bit more about the programs will work, however there isn’t much need to actually learn a specific language unless you plan to add custom programs or scripts.

    The general advice for email is don’t. It’s very risky to host and it’s a big target for spam. Plus there’s challenges getting the big companies to trust your domain.

    However hosting things behind a VPN (or locally on your home network) can let you learn a lot about networking and firewalls without exposing yourself to much risk.

    I have no direct experience with next cloud but I understand it can be hosted on Linux, you can buy a Synology NAS and run it in that, or use something like TrueNAS.

    Personally my setup is on one physical server so I use Proxmox which lets me run 2 different Linux servers and trueNAS on one single computer through virtual machines. I like it because it lets me tinker with different stuff like home assistant and it won’t affect say my adblocker/VPN/reverse proxy. I also use Docker to run multiple services on one virtual machine without compatibility issues. If I started again, I’d probably have gotten bigger drives or invested in SSDs. My NAS is hard drives because of cost but it’s definitely hitting a limit when I need to pull a bunch of files. Super happy with wireguard-easy for VPN. I started with a proprietary version of openVPN on Oracle Linux and that was a mistake.

    • mspencer712@programming.dev
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      3 hours ago

      I feel like objecting to the “General advice about email is don’t” thing but I don’t know if I understand the objections well enough to refute them. I self host email for mspencer.net (meaning all requests including DNS are served from hardware in my living space) and I have literally zero spam and can’t remember the last time I had to intervene on my mail server.

      On one hand: My emails are received without issue by major providers (outlook, gmail, etc) and I get nearly zero spam. (Two spam senders were using legitimate email services, I reported them, and got human-seeming replies from administrators saying they would take care of it.) And I get amusing pflogsumm (summarizes postfix logs) emails daily showing like 5 emails delivered, 45 rejected, with all of the things that were tried but didn’t work.

      On the other: most of the spam prevention comes from greylist, making all new senders retry after a few minutes (because generally a legit MTA will retry while a spammer will not) and that delays most emails by a few minutes. And it was a bear to set up. I used a like 18 step walkthrough on linuxbabe dot com I think, but added some difficulty by storing some use and alias databases on OpenLDAP / slapd instead of in flat files.

      But hey, unlimited mail aliases, and I’m thinking of configuring things so emails bounce if they seem to contain just a notification that terms and conditions are updated somewhere. I don’t know, cause some chaos I guess.

      And I have no idea if my situation is persuasive for anyone because I don’t know what the general advice means. And I worry it’ll have the unfortunate side effect of making self hosting type nerds like me start forgetting how to run their own email, causing control of email to become more centralized. And I strongly dislike that.

    • Flax@feddit.uk
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      5 hours ago

      Is there a good way to not self host email yet maintain good control? Like storing it on a local device. I know that addresses are portable with a domain, but still.