Written by Bjørn Erling Fløtten, Trondheim, Norway. Updated 23 Nov 2026.

License: CC BY 4.0. Handcrafted, no AI.

Upgrading my personal Ubuntu server

How I upgraded my personal server from Ubuntu 20.04 to Ubuntu 26.04 and at the same time streamlined the setup.


TL;DR

Setting up Ubuntu 26.04 with Apache (serving .Net apps), Postfix, Dovecot, OpenDKIM, git, Prosody and coturn.

The setup was forced through because I was unable to run Prosody on my old server.

The process was pretty straighforward with no big surprises. The installed software consumed very little disk space (less than 1 GB). This speaks volumes about the (relative) efficiency of modern open source solutions.

Note that this article is very short on details. Only if everything goes smoothly will the text be found sufficient. See also my June 2021 article for more detailed information about DNS, firewalls, port numbers and running an email server.


Background

My personal cloud server was last updated in 2021. It ran flawlessly Apache (web server serving .Net apps), Postfix (email MTA), Dovecot (email MDA), OpenDKIM (email signing) and git (version control). It still used Ubuntu 20.04 however and that version is now out of support.

This mattered when I tried to install Prosody (a modern XMPP communication server). Using sudo apt install prosody resulted in a many years old version. I only noticed because of a very obscure TLS problem related to connecting from Conversations (a Jabber/XMPP client for Android). Since Prosody no longer supported my Ubuntu version I had to upgrade.

Initially I tried to upgrade Ubuntu in-place with do-release-upgrade. But it insisted on Please install all available updates for your release before upgrading which was not possible. Even upgrading to Ubuntu Pro (free of charge) in order to get extended access to upgrades did not help. In short, I ended up with Unable to correct problems, you have held broken packages / packages have unmet dependencies. I guess this was related to having installed packages from other repositories than those from Ubuntu. Anyway, I decided not to bother and simply switch to a brand new server instead.

I decided to stick with Hetzner since they had provided me with a steady service without any surprises. But I also decided to reduce the cost a little bit.

The old server was a CCX22 instance with 16 GB of RAM and 160 GB disk. It was somewhat expensive for a personal server (at almost 40 EUR / month) and also an overkill technically. I decided to try a CX23 (4 GB RAM, 40 GB disk, around 6 EUR / month) for the new server. With my ambition of streamlining the setup I could always switch to a more capable server later.


Part 1: Initial setup, non-root user and git

Note: In this document host means either the IP address of my server or the domain, user means a user name on that server and repo means the name of some git repo on that server. Some examples are git clone ssh://user@host/~/git/repo and https://host.

After buying the server from Hetzner and first login I did sudo apt update && sudo apt upgrade -y and restarted with sudo reboot. For 5 packages I got Not upgrading yet due to phasing which I considered normal (phased updates in Ubuntu is a rollout strategy where software updates are delivered to users in gradual stages rather than all at once.

df -h gave 34 GB free of 38 GB total disk and free -h gave 3.1 GB free of 3.7 GB total RAM. I am used to disk space being marketed in decimals units (therefore 40 GB disk suddenly becoming 38 GB was no surprise) but was disappointed to see Hetzner use the same trick for RAM (4 GB became 3.7 GB).

I setup a non-root user with sudo adduser user, installed git with sudo apt install git, logged in with my non-root user and initiated my personal git repo with:

mkdir git
cd git
mkdir repo
cd repo
git init
git checkout -b dummy

The last command is necessary in order to avoid errors regarding pushing from my local computer to the current branch on the server. From my local computer I could now clone this repo with git clone ssh://user@host/~/git/repo. I was now ready to copy files from my old repo to the new repo (with exception of the .git folder of course).

Note that I did not intend to keep my git history. For my personal repo a snapshot is sufficient, I mostly use git for synchronization among multiple workstations. Getting rid of the history effectively halved the disk usage of my repo (remember I only had 34 GB of disk space left).


Part 2: Web server

Apache has served me well and I saw no need for change. But it was also the part of my setup in most need of automation. New virtual hosts had been added somewhat haphazardly throughout the years, with little automation. This time I decided to structure all the setup in git beforehand.

I installed Apache with sudo apt install apache2 (it is apache2, not apache, due to some old history. In general the project is called 'Apache httpd'. Internally when configuring Apache you will encounter only 'httpd'). The 'Apache2 Default Page' immediately became available on http://host.

Next step was copying the static elements of my 'home page' with scp -r html user@host:/var/www (for .Net applications see below).

So far I had only been using an IP address for host. But now I had to point a domain to my server in order for certbot to be able to get a TLS certificate from Lets's Encrypt. This in order to enable HTTPS on my web server. host as used below now refers to that domain.

sudo snap install --classic certbot
sudo certbot --apache -d host

Note that the option -d host is necessary because I did not yet specify a ServerName in /etc/apache2/sites-enabled/000-default.conf. And Certbot actually needs to know for which domain to request a certificate.

A look at the config files can be useful in order to understand what has now been changed:

cat /etc/apache2/sites-enabled/000-default.conf
cat /etc/apache2/sites-enabled/000-default-le-ssl.conf

In the first file (the original file) something like the following was added to the end:

RewriteEngine on
RewriteCond %{SERVER_NAME} =host
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]

The second file (the new file) showed something like:

ServerName host
SSLCertificateFile /etc/letsencrypt/live/host/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/host/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

So when I now do http://host Apache automatically redirects to https://host


Part 3: Running .Net applications

The static elements of my 'home page' was put into /var/www/html in Part 2 with a corresponding /etc/apache2/sites-enabled/000-default.conf and /etc/apache2/sites-enabled/000-default-le-ssl.conf.

I also had some .Net applications for the new server. I decided to create /var/www/app for these.

First step was installing .Net SDK with sudo apt update && sudo apt install -y dotnet-sdk-10.0.

I also did dotnet dev-certs https --trust just in case I wanted to develop on the server. This was probably unnecessary.

In addition some more configuration of Apache is necessary:

sudo a2enmod headers
sudo a2enmod proxy_http
sudo systemctl restart apache2

If you forget about this you will get errors like:

Invalid command 'RequestHeader', perhaps misspelled or defined by a module not included in the server configuration
Invalid command 'ProxyPreserveHost', perhaps misspelled or defined by a module not included in the server configuration

Here are the corresponding .service and .conf files for my AgoBrowse application, a picturebook for kids. The first file describes how the application shall run locally, the second file how Apache shall serve it to the outside world:

# /etc/systemd/system/AgoBrowse.service

# Relevant shell commands:
# systemctl daemon-reload
# systemctl start AgoBrowse.service
# systemctl status AgoBrowse.service

[Unit]
Description=AgoBrowse

[Service]
WorkingDirectory=/var/www/app/AgoBrowse
# Port number must correspond to port number in /etc/apache2/sites-enabled/AgoBrowse.conf
ExecStart=/usr/bin/dotnet /var/www/app/AgoBrowse/AgoBrowse.dll --urls "http://localhost:5002"
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=AgoBrowse
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production 

[Install]
WantedBy=multi-user.target
# /etc/apache2/sites-enabled/AgoBrowse.conf

# Relevant shell commands:
# apache2ctl configtest
# systemctl restart apache2

<VirtualHost *:*>
    RequestHeader set "X-Forwarded-Proto" expr=%{REQUEST_SCHEME}
</VirtualHost>

<VirtualHost *:80>
    ProxyPreserveHost On
# Port number must correspond to port number in /etc/systemd/system/AgoBrowse.service
    ProxyPass / http://127.0.0.1:5002/
    ProxyPassReverse / http://127.0.0.1:5002/
    ServerName agobrowse.bef.no
    ErrorLog ${APACHE_LOG_DIR}/agobrowse-error.log
    CustomLog ${APACHE_LOG_DIR}/agobrowse-access.log common
</VirtualHost>

For deployment I created a script file with all relevant commands, so I would not have to look up specifics in the future. The commands look something like this:

ssh user@host "mkdir /var/www/app/AgoBrowse"
scp -r bin/Debug/net10.0/* user@host:/var/www/app/AgoBrowse
ssh user@host chown www-data /var/www/app/AgoBrowse/Data/__Database..txt
scp AgoBrowse.service user@host:/etc/systemd/system/AgoBrowse.service
ssh user@host "systemctl daemon-reload"
ssh user@host "systemctl start AgoBrowse.service"
ssh user@host "systemctl restart AgoBrowse.service"
scp AgoBrowse.conf user@host:/etc/apache2/sites-enabled/AgoBrowse.conf
ssh user@host "apache2ctl configtest"
ssh user@host "systemctl restart apache2"

Note that I dispensed with the dotnet publish mechanism since the applications is quite straightfoward. Everything necessary is already in the bin folder created as part of my development process.

As a last step I ran sudo certbot --apache -d agobrowse.bef.no in order to enable HTTPS for the application. As shown in Part 2 this changes the /etc/apache2/sites-enabled/AgoBrowse.conf file and adds a /etc/apache2/sites-enabled/AgoBrowse-le-ssl.conf file.


Part 4: Email with Postfix

I have had zero issues with Postfix and Dovecot (as MTA and MDA respectively) so decided to continue using both for email.

sudo apt update && sudo apt install postfix

Reading email

It is possible to either edit directly in /etc/postfix/main.cf or to use postconf -e. I choose the latter. Use postconf -n to show your settings:

postconf -e 'myhostname = host'
postconf -e 'mydomain = host'
postconf -e 'virtual_alias_maps = hash:/etc/postfix/virtual'
postconf -e 'recipient_delimiter = _'
postfix check
postfix reload

Specifying explicitly mydomain is typically not necessary. In my case however I used v2.bef.no as a temporary myhostname for the new server. This would have led to mydomain being set to bef.no which again would lead the new server to just send messages to my old server instead!

This took some time debugging. Remember that Postfix is meant for high traffic scenarios in which there would typically be a dedicated mail server like mail.bef.no handling domain bef.no. You should also be aware of postconf -h myorigin which is typically /etc/mailname.

The /etc/postfix/virtual file specifies how to redirect incoming email to local users. I keep this locally, and copy it to the server as needed:

scp virtual user@host:/etc/postfix/virtual
ssh user@host "postmap /etc/postfix/virtual"  

I run some email lists for our local shool. They are defined in /etc/aliases:

scp aliases user@host:/etc/aliases  
ssh user@host "postalias /etc/aliases"

For Dovecot I only need POP3: sudo apt update && sudo apt install dovecot-pop3d. This is slightly old fashioned but very simple to relate to. There is also dovecot-imapd.

After adding a sertificate security exception in Thunderbird I could read messages (port 110) but not submit messages (port 587). The following fixed that:

Sending email

Note: Do not forget to ask your server provider (ISP / VPS host) to unblock the SMTP port 25 for outgoing email.

postconf -e 'smtpd_sasl_type = dovecot'
postconf -e 'smtpd_sasl_path = private/auth'
postconf -e 'smtpd_sasl_auth_enable = yes'
postconf -e 'smtpd_sasl_security_options = noanonymous'
postconf -e 'smtpd_sasl_tls_security_options = $smtpd_sasl_security_options'
postfix check
postfix reload

In addition I uncommented in /etc/postfix/master.cf the following:

submission inet n       -       n       -       -       smtpd
  -o syslog_name=postfix/submission  

then uncommented in /etc/dovecot/conf.d/10-master.conf this:

# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
  mode = 0666
}

and at last I did systemctl restart dovecot and systemctl restart postfix.

I could now send email between my new and old server and was ready to switch off the old one and change the DNS to the new one

Configuring SPF and DKIM

OpenDKIM last release is 11 years old(!) However it worked perfectly on my old server, so I decided to continue using it:

sudo apt install opendkim opendkim-tools
sudo -u opendkim opendkim-genkey -D /etc/dkimkeys -d host -s 2026

Note: 2026 indicates that the key is from the year 2026.

I now edited /etc/opendkim.conf as:

Domain   host
Selector 2026
KeyFile  /etc/dkimkeys/2026.private
Socket   inet:8891@localhost

and restarted OpenDKIM with systemctl restart opendkim

From /etc/dkimkeys/2026.txt I extracted v=DKIM1; h=sha256; k=rsa; p=... as a single string, published that as DNS TXT record 2026._domainkey.host and verified with opendkim-testkey -d bef.no -s 2026 -vvv

Finally I instructed Postfix to use OpenDKIM to sign the outgoing email:

postconf -e 'smtpd_milters = inet:localhost:8891'
postconf -e 'non_smtpd_milters = $smtpd_milters'
postfix check
systemctl reload postfix

Configuring PTR and DMARC

I kept my old PTR and DMARC

PTR is a reverse DNS record which maps the IP address of your server to its domain. Check with your server provider (ISP / VPS host) how to setup PTR.

DMARC is a DNS TXT record like _dmarc.host. My record looks like v=DMARC1; p=reject; sp=reject; rua=mailto:rua@host; ruf=mailto:ruf@host; fo=1; pct=100; aspf=s; adkim=s;

Testing with mail-tester.com

I recommend mail-tester.com, a free online service, to 'Test the Spammyness of your Emails'

I got a 9.5 out of 10 score with the only issue being listed by the Barracuda block list. This is an old issue for my IP address (which I have had for many years). Anyway, I tried again at barracudacentral.org/lookups/lookup-reputation to get it unblocked. This time it seemed to work better, some days later mail-tester gave me a perfect score.


Part 5: Prosody

It was now time for setting up Prosody (remember that this was the triggering factor for why I updated to a new server).

After sudo apt update && sudo apt install prosody I edited /etc/prosody/prosody.cfg.lua as follows:

-- I uncommented this line
"mam"; -- Store recent messages to allow multi-device synchronization

-- VirtualHost "localhost"
VirtualHost "host"

Component "conference.host" "muc"
  modules_enabled = { 
    "muc_mam"; 
  }

and did:

sudo prosodyctl check config
sudo prosodyctl check features
sudo systemctl restart prosody

Note that prosodyctl check features gives useful information about possible additional functionality like connecting from web, audio / video calls and file sharing. I intended to do this later. If you delete the file /etc/prosody/conf.d/localhost.cfg.lua then you will get a cleaner output from prosodyctl check features (but check the file contents first, that it only contains VirtualHost "localhost".

I then instructed Prosody to reuse the Let's Encrypts certificates installed in Part 2:

sudo prosodyctl --root cert import /etc/letsencrypt/live
sudo prosodyctl check certs

And to automatically renew them by creating /etc/letsencrypt/renewal-hooks/deploy/prosody.sh as:

#!/bin/sh
/usr/bin/prosodyctl --root cert import /etc/letsencrypt/live

and making the script executable with

sudo chmod +x /etc/letsencrypt/renewal-hooks/deploy/prosody.sh

I could now add my first user with sudo prosodyctl adduser user@host and test messaging through an XMPP client.

I tested with the following clients: Conversations for Android, Monal for iOS and Thunderbird for Ubuntu (for Thunderbird, OMEMO encryption support looked very non-official so I did not bother with implementing it).

Supporting audio and video calls

In order to support audio and video calls a TURN / STUN server is needed. I chose coturn.

After sudo apt update && sudo apt install coturn I edited /etc/turnserver.conf as follows:

listening-port=3478
realm=turn.host
use-auth-secret
static-auth-secret=SomethingSecret

and did systemctl restart coturn. Correspondingly in /etc/prosody/prosody.cfg.lua I edited as follows:

.
-- I uncommented this line
"turn_external"; -- Provide external STUN/TURN service for e.g. audio/video calls

-- and uncommented and changed these:
turn_external_host = "turn.host"
turn_external_secret = "SomethingSecret"

And then did:

sudo prosodyctl check config
sudo prosodyctl check features
prosodyctl check turn
sudo systemctl restart prosody

Note the additional prosodyctl check turn. Now prosodyctl check features confirmed that I also had "Audio/video calls and P2P".

(It might be worth mentioning that initially I forgot to allow also UDP for port 3478. A TCP only firewall rule was not sufficient for TURN).

Supporting TURN with TLS

I did not bother with this as of November 2026.

Conclusion

The process was pretty straighforward with no big surprises. The installed software consumed very little disk space (less than 1 GB). This speaks volumes about the (relative) efficiency of modern open source solutions.