Build a Gemini Server on Linux and Join the Web That Could Have Been

Gopher is an internet protocol that existed in the early 1990s but was eventually lost to HTML and the World Wide Web. It still exists today, and Gemini is its spiritual successor, with improved security and thousands of independent servers (called capsules) running on low-cost hardware.

The numbers pale in comparison to the web we know and love, but with a little effort, you can swell the capsule ranks by one. Read on to learn how to set up your own Gemini server.


How Gemini is different from Gopher

Gopher failed because its technology was proprietary, unlike the technology behind the World Wide Web. Gemini doesn’t make the same mistake, and the server software is free and open source, so anyone can use, adapt, and distribute it however they want.

In common with many retro-computing projects, Gopher and Gemini make excessive use of puns. Gopher was so called because if users requested a resource, it would “go for” them. Gopher sites were called Gopher Holes.

Gemini is themed around space exploration and its name refers to the Gemini space program. Gemini sites are called capsules and the port used is 1965, commemorating the first crewed Gemini spaceflight in 1965.

Gemini also puts more emphasis on security than Gopher, requiring self-signed certificates for each capsule.

Setting up a Gemini capsule is cheap

Virtually any computer produced in the past 30 years can host a Gemini capsule, as long as it’s capable of running a Linux distribution. Raspberry Pis are particularly popular due to their low cost and low power consumption. Because the resources used by Gemini are so tiny, a high-end Pi such as the Raspberry Pi 4B is overkill and is best used in more demanding projects. A Raspberry Pi Zero W will work just fine.

You will also need a spare domain name or subdomain. If you don’t already have one, read our guide on how to choose and buy a domain name.

Hosting a Gemini pod on your Pi Zero is simple

First, visit your domain name registrar and create a new DNS record for your domain name. Set type to A, the host as @ and the value as your home’s public IP address. We’ve covered how to find your public IP address from a Linux system if you need help. Set the TTL value as low as possible.

Now go to the administration page of your router. You can access it by pointing a browser to 192.168.1.1. If that doesn’t work for you, check your router’s manual.

Find a section named Port Forwarding, Port Mapping, or Port Management, and create a new entry for Gemini. The local IP address should be your Pi’s local IP address, the protocol is TCP, and the local and public ports should be 1965.

If you have already installed a distribution on your Raspberry Pi, you must connect in SSH to the machine:

ssh user@xxx.xxx.x.xx

…where user is your username and xxx.xxx.x.xx is the local IP address of your Raspberry Pi.

Update and upgrade the list of repositories and packages on the system by entering:

sudo apt update
sudo apt upgrade

Now create a new directory for Gemini:

mkdir gemini

The Gemini directory will contain the contents of your Gemini capsule, the most important part of which is index.gmi. Go ahead and make one with:

nano gemini/index.gmi

Gemini uses the Markdown language. If you’re not comfortable with this yet, read our beginner’s guide to getting started with Markdown.

The index page should contain an introduction to your Gemini capsule and other useful information.

Save and exit the file with CTRL+O then CTRL+X.

Create a new directory called trash can in the gemini directory and cd in it:

mkdir gemini/bin
cd gemini/bin

In your browser, visit Agate on GitHub and under the “Assets” section, identify the correct package for your hardware. A 64-bit Raspberry Pi 4B would require agate.aarch64-unknown-linux-gnu.gzwhereas a 32-bit Pi Zero W would require agate.armv7-unknown-linux-gnueabihf.gz.

Right-click on the appropriate package name to get the link address, then paste it after the wget command to download the package to your current directory.

wget https:

Extract the package with:

gunzip agate.aarch64-unknown-linux-gnu.gz

Remember that the name of the package will be slightly different depending on the architecture it was downloaded for. Rename the extracted file:

mv agate.aarch64-unknown-linux-gnu.gz agate

Make it executable with:

sudo chmod +x agate

CD go back to your home directory and create a shell script using nano:

nano gemini.sh

In the file, paste the following, making sure to replace “example.com” with your domain name:

#!/bin/bash
/home/pi/gemini/bin/agate

Save and close with CTRL+X then CTRL+O and make the script executable:

sudo chmod +x gemini.sh

Start your Gemini capsule with:

./gemini.sh

Access your Gemini capsule from anywhere

Gemini is not the web and you cannot use a normal web browser to access it. There are, however, a number of browsers that can visit both Gopher Holes and Gemini Capsules. We recommend Kristall, which is available for Windows, macOS, and Linux. Download and install on your usual computer.

You can access your Gemini pod by typing gemini://example.com in the address bar, where example.com is your domain name!

Expand your Gemini capsule with more pages

You can now create and run a Gemini capsule on your Raspberry Pi. One page is enough for a very simple informational site, and you can create more by adding .gmi files in your content folder. Think about what interests you and what content visitors would want to read. Similarly, you can also create and access Gopher holes in Linux.


Comments are closed.