💾 Archived View for 0x735.com › gemini_capsule_setup.gmi captured on 2021-11-30 at 14:23:00. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Setting up a gemini capsule on DigitalOcean

Create a droplet

To create a digitalocean droplet you can follow the instructions here:

https://docs.digitalocean.com/products/droplets/how-to/create/

For this I will be using a low-end droplet with Ubuntu 20.04 that I already have configured for running long-term data gathering tasks.

Setup a domain

Once you have setup a droplet you can go to the domains section of your digitaocean panel and set up your domain. You will want to make sure it is pointing to the droplet you just created.

For more details about adding domains to digitalocean droplets, see here:

https://docs.digitalocean.com/products/networking/dns/how-to/add-domains/

Setup user and capsule directory

Once everything is setup we can log into our new droplet. In my case thats:

ssh root@memex

We will add a user account to the droplet to manage our gemini capsule:

adduser gemini

And give it sudo access:

usermod -aG sudo gemini

Then log into the new account:

su - gemini

We can make a directory in our gemini users home directory, and then add a hello-world page so we can test that it's working.

mkdir capsule
echo "Hello World" >> index.gmi

Downloading everything

To get the capsule up and running we first need to download the agate server. This is an easy to use server that will allow others to access the content in our capsule directory.

Agate

To download agate, you need to select the latest release from the github here:

https://github.com/mbrubeck/agate/releases/

The current release is v3.10, so we can download as follows:

cd ~/bin
wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz
gunzip agate.x86_64-unknown-linux-gnu.gz
sudo chmod +x agate.x86_64-unknown-linux-gnu
mv agate.x86_64-unknown-linux-gnu.gz /usr/local/bin/agate

Once that's done, we can set up the systemd file to run the server:

sudo nano /etc/systemd/system/gemini.service

And copy in the following config, being sure to change <your-hostname> to whatever domain you have pointed to your droplet:

[Unit]
Description=agate
After=network.target

[Service]
User=gemini
Type=simple
ExecStart=/usr/local/bin/agate --content /home/gemini/capsule --hostname <your-hostname> --lang en-US --certs /home/gemini/.certificates

[Install]
WantedBy=default.target

To exit nano, use ctrl-x and follow the prompts.

Setting up TLS

In earlier versions of agate it was necessary to generate and setup keys manually. But now agate will do all of that automatically for us. So we don't have to do anything here :)

Start the server

The server can be started from the command line with the following:

sudo systemctl start gemini.service
sudo systemctl enable gemini.service

The enable command ensures that the server starts when the system is booted.

Go and visit your new page.

I'm using elpher (a gemini broswer for emacs), so I just navigate to gemini://0x735.com, and the index page is there.