#!/linuxSucks/Install and Setup a Gemini Server

Apr 09, 2021

If you are visiting Gemini Capsules in all the space, Why not you setup your own capsule and have all the articles, manuals, microlog what ever you want to write and have you own space with this simple protocol. The best part is that the capsules are just plain text, if you are here is because you like to read without distractions, right?

What you need

In order to setup the server, you need a live server and a domain. I recommend this sites are very cheap.

If you don’t like those sites, find another one that you know are better.

To setup a Gemini server isn’t complex at all. This is what you need to setup the server:

  1. TLS Certificates
  2. A Gemini Server
  3. Systemd Service

I chose to use Agate server because is very simple to setup. Let’s jump to the fun part:

Generate the TLS Certificate

First let’s create the TLS certificates that we need for our capsule, create a new directory in the user root directory (.cert) then switch to it

cd .certs

Now run this command

openssl req -new -subj "/CN=yourdomain.xxx" -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 1825 -nodes -out cert.pem -keyout key.pem

Change yourdamain.xxx for your domain. The certificates that were created will last 5 year, if that is way to much for just change the days you want

Install Agate Server

There are several server out there for a Gemini server, I choose Agate for its simplicity and lightweight

Download the binary file from

wget https://github.com/mbrubeck/agate/releases/download/v2.3.0/agate.x86_64-unknown-linux-gnu.gz

Unpack the file with

gzip -d agate.x86_64-unknown-linux-gnu.gz

For an easy way to work with that file rename it just to agate

mv agate.x86_64-unknown-linux-gnu agate

Create a new directory in any place as you like and move the binary file to its directory and make the binary executable

mv agate .agate/
sudo chmod +x .agate/agate

Setup a Systemd Service

Now to work with Agate we need to create a systemd service, since I’m usegin a Debian server systemd is present in the system.

sudo vim /etc/systemd/system/agate.service

Copy and past this code in the new file

[Unit]
Description=Agate Gemini Server
After=network.target

[Service]
User=USER
Type=simple
ExecStart=/home/USER/.agate/agate -s --content /home/USER/gemini.capsule/ --key /home/USER/.certs/

[Install]
WantedBy=default.target

Change USER for your user name or the server user

## Start and Enable the Systemd Service

To start and enabled the new server just run

sudo systemctl start agate
sudo systemctl enable agate

That’s it! Now you need to craft your capsule.

Home  Linux  Notes  Blog Spot