💾 Archived View for snowcode.ovh › tech › gemini2.gmi captured on 2023-01-29 at 15:50:18. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2022-01-08)

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

How to make a Gemini capsule (glog)

Today, I was bored, so I finally decided to make my first Gemini capsule.

Step 0: Browsing Gemini

First, I installed Amfora for that, it's a terminal gemini client and it's pretty easy to use.

Amfora project page

$ cd /usr/bin
$ sudo wget https://github.com/makeworld-the-better-one/amfora/releases/download/v1.8.0/amfora_1.8.0_linux_64-bit
$ sudo mv amfora* amfora
$ sudo chmod +x amfora

Step 1: Creating the server

Then, I searched for a Gemini server software. I found one called "titan2"

List of software by the Gemini Project

Official page of the titan2

Those are the commands I used to install it:

$ git clone https://gitlab.com/lostleonardo/titan2.git
$ cd titan2
$ go install
$ sudo ln -s ~/go/bin/titan2 /usr/bin/titan2 

Gemini, unlike Gopher, require openssl certificates. You can generate one using those commands:

$ mkdir certs/
$ openssl ecparam -name secp384r1 -genkey -noout -out key.pem
$ openssl req -new -x509 -key key.pem -out crt.pem -subj "/CN=<YOUR DOMAIN NAME>" -days 365
$ cd ..
Note: Under the wise recommendations of @Nex (who doesn't have a Gemini capsule... yet). I changed the certificate from RSA to Elliptic Curve for security reasons.

Now you also need a directory to put all the future content in.

$ mkdir gemini/
$ echo "Hello World" > gemini/index.gmi

And now, we can launch the titan2 command...

$ titan2 -hostname <YOUR HOSTNAME>

It's just as easy!

Step 2: Creating content

Now having "hello world" is great, but let's do more than that. Let's create a new file, for instance "first.gmi":

$ nano first.gmi

Then, we can write our content inside... This is how the syntax look like:

# title
## subtitle
### etc

A paragraph is written as one single line, just like this. The paragraph will be chopped into lines by the client. 

=> https://youtube.com YouTube webpage
=> gemini://snowcode.ovh My blog
=> first.gmi My first post. 

To write code, use the ``` balise at the beginning and at the end of your code.

Step 3: Making a pretty index file

The index file is the first thing people will find. So let's make it pretty. To do so I first used pyfiglet with the font "computer" to generate by banner

pyfiglet -f computer "SnowCode"

Once you made this, don't forget to add the links to your other articles.

=> first.gmi 01/07/2021 My first post!

Step 4: Making a RSS file

Some clients support subscriptions using RSS files. To do so, simply copy (and customize) the following content:

<?xml version="1.0" encoding="iso-8859-1"?><rss version="2.0"><channel>
<title>SnowCode's Glog</title>
<link>gemini://snowcode.ovh</link>
<description>SnowCode's Glog</description>

<item>
<title>How to create a gemini capsule (glog)</title>
<link>gemini://snowcode.ovh/gemini.gmi</link>
<pubdate>01/07/2021</pubdate>
</item>

</channel></rss>

Step 5: Uploading all the changes to the server

I simply created an alias for the following command, so I don't have to type it every single time.

$ rsync -r ./* <username>@<IP address>:/home/<username>/gemini/

Conclusion

Now, you know how to make your own Gemini capsule. When you want to make a new post, you will have to do this:

1. Create a new file like "first.gmi" (see step 2)

2. Link that file into the index.gmi file (see step 3)

3. Add a new item in the RSS feed (see step 4)

4. Push all those changes to your server (see step 5)

Have fun with your Gemini adventure!

For my part, I'm gonna try the 100 day challenge (just writing at least one post every day for 100 days).

Good night everyone!