What is Gemini?
Gemini is a new internet protocol which is different from the web. It's neither Gopher. It's much cleaner.
Why use gemini protocol?
- Gemini capsules (webpages of gemini) are lightweight, minimal, and don't use many resources to operate.
- It can run along with your websites. Gemini capsules use port 1965 by default. Your webserver can run at port 80 or 443 along with gemini server at port 1965.
- By exploring an alternative protocol, you can check different ways to serve data and blogs.
To access any gemini urls i.e. gemini://landchad.net, you can use any gemini client such as amfora, lagrange, elpher, etc.
Instructions
To create and serve a gemini capsule, we need three basic steps:
- Content
- TLS certificate
- Gemini server
We can create three different directories to simplify the process:
mkdir -p gemini/{content,certificate,server}
Content
Gemini uses text/gemini markup. It heavily borrows from Markdown. Similar to .html or .md, gemini uses .gmi as its extension.
To create one gemini file, go inside the content directory and create one index.gmi file.
touch gemini/content/index.gmi
Update the file content of index.gmi
# This is Sample Gemini page
## With header 1 and header 2
And a short paragraph like this.
=> /index.gmi Link to the same page
TLS certificate
Go to the certificate directory which we have created earlier. Generate the TLS certificate using OpenSSL. Change YOURDOMAIN.COM to the domain of your gemini capsule.
openssl req -new -subj "/CN=YOURDOMAIN.COM" -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 3650 -nodes -out cert.pem -keyout key.pem
Gemini server
There are many gemini servers available. You can check the list of servers here.
We will use agate server for now. This is a simple gemini server written in Rust. Go to server directory and download agate server.
wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz
Unzip the gz
gunzip agate.x86_64-unknown-linux-gnu.gz
Rename and make it executable
mv agate.x86_64-unknown-linux-gnu agate-server
chmod +x agate-server
Now we need to create a systemd service
sudo touch /etc/systemd/system/agate.service
Copy the below file and paste in agate.service.
[Unit]
Description=agate
After=network.target
[Service]
User=USER
Type=simple
ExecStart=/home/USER/gemini/agate-server --content /home/USER/gemini/content --certs /home/USER/gemini/certificate/ --hostname YOURDOMAIN.COM --lang en-US
[Install]
WantedBy=default.target
- Change
/home/USER/geminito your gemini directory path. - Change
YOURDOMAIN.COMto your domain without http/https. - Change
en-USto your country language. en-IN for India, en-GB for UK, etc.
Now we are ready to run server. Enable and run agate server.
sudo systemctl enable agate
sudo systemctl start agate
Finalization
Now your server should be running. If everything went okay, you can access your gemini via any gemini client with this url
gemini://YOURDOMAIN.COM
Sample gemini site for reference:
gemini://gemini.circumlunar.space
Enjoy your first gemini capsule.
Written by nihar.page