User Tools

Site Tools


notes:file_server_training:start

Files server

The purpose of this training is to facilitate the setup, management, and maintenance of a self-hosted personal website and related services.
Required equipment

Hardware requirements

Optional services

In my case, I chose to have an authoritative domain name server, but this is not mandatory.
The SNI reverse proxy is only necessary if you want to have several virtual machines (or containers) sharing the same public IPv4 address.

As can be seen in the diagram, IPv6 is easier to configure than when you only have one public IPv4 address.

Installations

I recommend installing a hypervisor (Proxmox) to host the virtual machines or containers for the website and associated services. It is possible to use a hypervisor other than Proxmox, such as virt-manager, VirtualBox, etc.
In any case, it is preferable to configure the network in bridge mode to avoid having to manage NAT redirection.
Proxmox uses bridges by default, which suits our needs.

Proxmox

Yunohost

Yunohost can be installed in two ways in Proxmox: as a virtual machine or as a container. This will depend on your process isolation requirements.

I recommend installing Yunohost as a container, but if you want to install it as a virtual machine, instructions are available here: Yunohost as a virtual machine

Yunohost installation (in container)

Yunohost is installed in an existing container:

Yunohost is based on Debian, so I install a Debian container:

(documentation: https://pve.proxmox.com/wiki/Linux_Container#pct_container_images)

Here are some commands to run as root in the Proxmox terminal to add the container images:

pveam update

(updates the list of available container images)

pveam available --section system | grep debian

(displays the list of Debian containers only)

pveam download local debian-12-standard_12.7-1_amd64.tar.zst

(downloads the latest available Debian image)

  • When the download is complete, you can create a container from this image. 20 GB of disk space should be sufficient.
  • Start the container…
  • Once in the container as root, retrieve the yunohost installation script and execute it:
cd /root
apt update
wget install.yunohost.org -O install.yunohost.sh
chmod +x install.yunohost.sh
/root/install.yunohost.sh

Once the basic installation is complete, simply go to the web browser to continue. Or type ‘yunohost tools postinstall’ in the command line.

Get a domain name

  • either with yunohost
  • or from a registrar

Once the domain name is registered, you just need to generate the certificate on the Yunohost/admin side.

Authoritative domain name server (optional)

if you want to have subdomains and manage them yourself (which will avoid having to go through the registrar for each change).
you must then declare your main domain name as SOA, i.e. set up and declare an authoritative domain name server.
For example, with nsd (which I chose) or knot (which I have not yet tested).

Adding an application

Choose from:

dokuwiki nextcloud calibre galene jirafeau lufi ... etc.

It is possible to have several virtual machines, each with its own Yunohost, rather than having all the applications in the same Yunohost virtual machine.
This will mainly depend on the use, and if you choose to have several machines (virtual or not), you will need to set up a SNI reverse proxy (because you will probably only have one public IPv4 address and will need to share it between the machines; with IPv6, this kind of problem does not arise).

IPv4 only: Opening ports (and NAT redirects)

  • Identify the ports to be opened.
  • Open them on the Internet box side and specify the redirect.
  • If you have set up an SNI proxy server, you will need to redirect ports 80 and 443 to the SNI proxy server.

Keep in mind that NAT issues do not exist in ipv6 (unless you have CGNAT, but in that case I recommend changing your Internet service provider).
In ipv6, the machine is directly connected to the Internet, with all ports exposed on the public IP (which starts with 2).

Backups (very important)


Yunohost is capable of backing up applications, but it does not back up itself. That's why I use Yunohost in a virtual machine (or container) and have Proxmox perform the backup.
However, a backup should not remain on the same hard drive as its source and should be stored in a different geographical location.

In our case, using a second hard drive would already be a good solution.

Read the logs (important)

Problems encountered during self-hosting

  1. Some ISPs do not route properly to the IP ranges of other ISPs.
  2. The public IP may change without notice, in which case you will need to update the DNS entries and regenerate the certificates.
  3. It may also happen that the box does not deliver a public IPv6 address but only a locally unique IPv6 address. In this case, you will need to force a public IPv6 address.
  4. Some ISPs do not give IPv6 addresses to their customers, or only in certain areas.
  5. In general, you only have one public IPv4 address, so if you want to host multiple services that require the same ports, you will need to set up a SNI reverse proxy.
notes/file_server_training/start.txt · Last modified: by err404

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki