Parent:: [[@Networks|Networks]], [[@Computer Set Up|Computer Setup]]
---
^Top
 
```button
name Save
type command
action Save current file
id Save
```
^button-SelfHSave
 
# Self-hosting
 
```ad-abstract
title: Summary
collapse: open
This note explores self-hosting through its infrastructure and associated services.
```
 
```toc
style: number
```
 
---
 
### Infrastructure
[[#^Top|TOP]]
 
This section sums up required infrastructure for self-hosting online services.
 
#### Hardware
An option is to look at a **Virtual Private Server** (VPS) service. This also solves the issue of the access to the Internet, that is more and more advised to not come from a home connection.
```ad-tip
title: Tip
A good aggregator for low-cost VPS [here](https://lowendbox.com)
```
Otherwise, **physical hardware** include:
| Product | Type | Price range
|--------|-------|-----------
|<pstyle="color:green">**Synology (DS218/220+)**</p> | NAS | £250/300
|<pstyle="color:cyan">**Dell Poweredge Tower Server T30**</p> | Server | £300/400
**Linux** is the most common OS for servers. **Ubuntu**, **Debian** or **CentOS** the most common distributions.
**MacOS** would require a Virtual Machine to run properly.
 
#### Internet connection
More and more literature point that a home Internet connection may not be the most appropriate way for a server to connect to the Internet. ISPs limit traffic to manage bandwidth and comply to legislations.
Domain management is important for several reasons: email and email routine can only be defined once per domain. As such, email services (self-hosting, email aliasing) need to be run on separate domains.
For self-hosting, the folllowing domain will be used: **mfxm.fr**
```ad-warning
title: Warning
Sub-domains to be defined with **webhost**.
```
 
#### Security
Security is paramount at the points of connection to the server. SSH protocols are secured but csn be intercepted. Two different ways of protection can be implemented:
Backups are managed through the **tar** command and dispatched over the network with **rclone**. Instructions can be found [[VPS Console Dialogue#Backing up a server|here]].
 
#### Server Monitoring
[[#^Top|TOP]]
```ad-info
title: Documentation
[Monit](https://mmonit.com/)
[Performance Co-Pilot](https://pcp.io/)
[Nagios](https://nagios.org)
```
Monitoring is implemented through a free and open-source tool called [[Configuring Monit|monit]].
| <pstyle="color:cyan">**Compartimentalise services into containers**</p> | **[[Configuring Docker\|docker]]** | Creates containers that can be run independently
A list of FOSS services can be found [here](https://github.com/awesome-selfhosted/awesome-selfhosted)
| Service | OS | Technical reqs | Description
|--------|----|----------------|--
<pstyle="color:orange">**Email service**</p> | Linux | 2GB RAM recommended | self-host an [[#Email service]]
<pstyle="color:green">**Email aliases**</p> | Linux | 2GB RAM; ports: 22, 25, 80, 443 | an [[#Email alias service\|alias service]] like [SimpleLogin](https://simplelogin.io)
**[[Nextcloud]]** | Linux | 500M RAM; MySQL & SQL Lite; PHP 8.0; Apache 2.4 with PHP or nginx with PHP | [[#Personal cloud syncing]] instance
<pstyle="color:purple">**Instant Message**</p> | Linux | 2/4GB RAM; ports & other extensions | [[Element]] instance for [[#Instant Messenging]]
<pstyle="color:violet">**VPN**</p> | Linux | 500MB RAM | Host a private [[#VPN]]
 
#### Email service
[[#^Top|TOP]]
Email service can be fully built but has many components to it: server, database, imap, caldav, carddav, DNS specificities, spam whitelisting as well as security (server access & spam filtering). It can therefore be tideous to build an email service from scratch. Pre-packaged solitions exist to manage all components:
1. [IRedMail](https://www.iredmail.org/)
2. [Mail-in-a-Box](https://mailinabox.email/)
3. [Docker-mailserver](https://hub.docker.com/r/tvial/docker-mailserver/) which is command-line-only and to be built more extensively than the two other alternatives
<pstyle="color:orange">Online identity</p> | **authentik**<br>**authelia** | [Welcome \| authentik](https://goauthentik.io/)<br>[GitHub - authelia/authelia: The Single Sign-On Multi-Factor portal for web apps](https://github.com/authelia/authelia) | identity