-- Leo's gemini proxy

-- Connecting to rochelimit.uk:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-GB

Simple Set Up for a Gemini Server

2021-07-08


Summary


Setting up a simple Gemini server to host your own files on an SBC such as a Raspberry Pi can be very quick, although the set-up has evolved in the last few months and online tutorials are out of date. The process of getting up and running is very short, but has a number of interlocking steps that are easy to get wrong.


Hardware: Raspberry Pi with Ubuntu Server installed


This Ubuntu tutorial explains the process of setting up the OS on the Raspberry Pi, but if you stick to the defaults and use a network cable instead of WiFi, then there is little to do.

install the Raspberry Pi Imager on your PC and follow the instructions. It takes a few minutes to install the OS onto your MicroSD card.

Imager for Ubuntu

Imager for Windows

Imager for MacOS

Connect your Pi to the router with a network cable

log in to your router, and find the DHCP settings. Set a static IP address for your Pi.

connect to the Pi using SSH (PuTTY on Windows). If your Pi user is the default 'ubuntu' then `ssh ubuntu@192.168.1.5` (but using the IP address you set in the last step)


install the Agate Gemini server


A straightforward server is Agate. It doesn't have bells and whistles, but will serve your Capsule happily.

Agate GitHub repo

Agate versions for various architectures

Set up folders on the Pi and download the Agate, check out the GitHub pages and select the correct file from the 'Assets' links, and paste in where the command below has <file link>.

mkdir gemini gemini/bin
cd gemini/bin
wget <file link>
gunzip <downloaded file name>

This puts the executable file into your `bin` folder, but it needs to be marked as executable, so ...

chmod +x <file name>

Create a new file `index.gmi` in the `gemini` folder, with some text contents in it for the later test. This is what is shown in the Gemini browser when you navigate to your capsule to view it. If your terminal is still in the `bin` folder, then

cd ..
nano index.gmi

Enter your text, then save and exit. Nano is a text editor, and the controls are summarised at the bottom of the terminal window.



Service and certificates


Gemini can use self-signed certificates, but instead of generating your own, Agate will sort them out itself on first run, and store them in a .certificates folder (a hidden folder on Linux - to see it type `ls -a` in the terminal.) Leaving as much to Agate's defaults simplifies the setting up of the Systemd service that ensures that Agate will restart after a reboot.


To make the Systemd service file, `sudo nano /etc/systemd/system/agate.service' and enter the following text, before saving and exiting the editor. (Make sure you change the file name in the `ExecStart` line to match your own Agate executable file, along with your own domain name and language reference as necessary.)


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

[Service]
User=ubuntu
ExecStart=/home/ubuntu/gemini/bin/agate.aarch64-unknown-linux-gnu --content /home/ubuntu/gemini/ --hostname rochelimit.uk --lang en-GB

[Install]
WantedBy=multi-user.target

Domains and A records


You will need to own a domain that you can point to your network's external IP address, which you can find from your router settings or with a web search for `whatsmyip`. A single `A record` with the host of `@` and the IP address for your home network will be sufficient for most cases. If your IP address is dynamic, then it may periodically be changed by your ISP — if you can't tolerate an occasional visit to your domain name registry to fix the A record, then you can set up an IP updater to regularly check and correct the A record, but that is out of bounds for this article.


Don't forget to go to the port forwarding page on your router to forward inbound port 1965 to port 1965 at the internal IP of your Pi. (Gemini 3, the actual spacecraft, took the first astronauts of the Gemini project to orbit in 1965.)


Start the service


All that remains is to start the service and test the Capsule.


sudo systemctl restart agate
sudo sustemctl enable agate

Check the service is running with

systemctl --type=service

If not, go back and edit the `agate.service` file and restart until it starts properly.


Test the whole set up by either launching your favourite Gemini browser, or going to a Gemini proxy on the web, and editing the URL to match your domain.

Gemini Portal


If all is well, then you will see your index.gmi page in its full glory! Well done. If not, then check the steps above. If all else fails, contact to ask for help. There are plenty of people who show their contact details on their Gemini capsules.



Credit for initial approaches


gemini://gemini.techrights.org/2021/02/23/gemini-server-with-agate/


Especially useful as this is the first self-hosting project I have tried, so thanks:



Return to home page

-- Response ended

-- Page fetched on Thu May 2 10:14:33 2024