Installing a gemini server on debian

The upcoming release of Debian, Bookworm, will be the first to include a gemini server in the official repository. Molly Brown[1] is the gemini server that landed in the repository. Here i will give some guidelines on how to get it running.

Requirements

Things you'll need to follow this:

Installation

The first and most obvious step is to install Molly Brown. Simply run the following to do so.

apt install molly-brown

Now we want to create a seperate user that runs molly brown:

useradd -M molly

Next we need a certificate for the gemini server. We will use a self signed one for this. In theory you could also use a certificate from Let's Encrypt, but since gemini is doing certificate verification based on "trust on first use(TOFU)", a certificate that is valid for more than 3 month is more practical in this case.

So lets create a folder where the certificate lives and the certificate.

mkdir -p /etc/molly-brown/certs
openssl req -x509 \
    -newkey rsa:4096 \
    -keyout /etc/molly-brown/certs/gemini.key \
    -out /etc/molly-brown/certs/gemini.crt \
    -days 3650 \
    -nodes -subj "/CN=<your-domain>" \
    -addext "subjectAltName = DNS:<your-domain>"

For logs we also want a dedicated folder.

mkdir -p /var/log/molly-brown

We also need a folder where the content of the gemini server will live.

mkdir -p /var/gemini

Configuration

Now its time to configure Molly Brown. Create a config file at /etc/molly-brown/molly.config and fill it with:

Port = 1965
Hostname = "<your-domain>"
DocBase = "/var/gemini/"
CertPath = "/etc/molly-brown/certs/gemini.crt"
KeyPath = "/etc/molly-brown/certs/gemini.key"
AccessLog = "/var/log/molly-brown/access.log"
ErrorLog = "/var/log/molly-brown/error.log"

To ensure that the molly user can access all the just created directories and files we make it the owner of those.

chown -R molly /var/gemini
chown -R molly /etc/molly-brown
chown -R molly /var/log/molly-brown

Create systemd unit at `/etc/systemd/system/molly-brown.service` with content:

[Unit]
Description=Molly Brown gemini server
After=network.target
[Service]
Type=simple
Restart=always
User=molly
ExecStart=molly-brown -c /etc/molly-brown/molly.conf
[Install]
WantedBy=multi-user.target

Get it running

Create a index.gmi at /var/gemini and fill it with some text, or copy your existing gmi files to /var/gemini.

The last step then is to start molly brown. To do so simply run:

systemctl start molly-brown

If you want molly-brown to automatically start when your computer is booted run:

systemctl enable molly-brown

---

[1] Molly Brown repository
Arch wiki on how to setup a gemini server

---

Back to the main page

This page is best viewed on gemini.