From c2460482e0cf79e2ecde463a13700c73deed9e0f Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Thu, 1 Jul 2021 13:34:49 -0400 Subject: gemini tweaks --- gemini.html | 75 ++++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 45 insertions(+), 30 deletions(-) (limited to 'gemini.html') diff --git a/gemini.html b/gemini.html index 2962d09..aa6d83e 100644 --- a/gemini.html +++ b/gemini.html @@ -13,72 +13,87 @@

What is Gemini?

-

Gemini is a new internet protocol which is different from the HTTP and Gopher. It's much cleaner.

+

Gemini is a new internet protocol which is different from the HTTP and Gopher. It's much cleaner and has a growing community and audience of hackers.

Why use gemini protocol?

-

To access any gemini urls i.e. gemini://landchad.net, you can use any gemini client such as amfora, lagrange, elpher, etc. +

To access any gemini urls i.e. gemini://example.org, you can use any gemini client such as amfora, lagrange, elpher, etc.

Instructions

+

Create a gemini user

+

+ It is most secure and clean to have a separate gemini user, so let's create one: +

+
useradd -m -s /bin/bash gemini
+

Now log in as gemini with the following command:

+
su -l gemini

To create and serve a gemini capsule, we need three basic steps:

    -
  1. Content
  2. -
  3. TLS certificate
  4. -
  5. Gemini server
  6. +
  7. Content – the webpages in our capsule
  8. +
  9. TLS certificate – Gemini requires encrypted connection.
  10. +
  11. Gemini server – the program that makes our capsule available (similar to Nginx for HTTP)
-

We can create three different directories to simplify the process:

-
mkdir -p gemini/{content,certificate,server}
+

As the gemini user, 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.

+

This will be the directory where you capsule files will be contained. Gemini uses text/gemini markup (in place of HTTP's equivalent HTML). 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

+
nano gemini/content/index.gmi
+

We can add the content we want in our Gemini capsule here:

# 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
+

Go to the certificate directory which we created earlier and generate a TLS certificate using OpenSSL.

+
cd ~/gemini/certificate/
+openssl req -new -subj "/CN=example.org" -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
+        

Download and prepare the server

+

There are many gemini server software choices available. + We will use agate server for now. This is a simple gemini server written in Rust.

+

It's a good idea to always get the most recent version, which you can see on the agate releases page. At the time of this writing, that is agate v3.1.0 which we will now download. We will download it to the server directory we made.

+
cd ~/gemini/server
+wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz
+

Unzip the gz, then rename and make it executable:

+
gunzip agate.x86_64-unknown-linux-gnu.gz
+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.

+

Create a system service

+

Now we need to create a systemd service to autostart and manage agate. + The gemini user does not have permission to do this, so press ctrl-d to log out of the gemini user and return to root. + As root, create the file below by opening it in your text editor (nano, vim, etc.):

+
nano /etc/systemd/system/agate.service
+

Add the following content to the file customizing highlighted text to your use.

[Unit]
 Description=agate
 After=network.target
 
 [Service]
-User=USER
+User=gemini
 Type=simple
-ExecStart=/home/USER/gemini/agate-server --content /home/USER/gemini/content --certs /home/USER/gemini/certificate/ --hostname YOURDOMAIN.COM --lang en-US
+ExecStart=/home/gemini/gemini/server/agate-server --content /home/gemini/gemini/content --certs /home/gemini/gemini/certificate/ --hostname example.org --lang en-US
 
 [Install]
 WantedBy=default.target
-
    -
  • Change /home/USER/gemini to your gemini directory path.
  • -
  • Change YOURDOMAIN.COM to your domain without http/https.
  • -
  • Change en-US to your country language. en-IN for India, en-GB for UK, etc.
  • -

Now we are ready to run server. Enable and run agate server.

systemctl enable agate
 systemctl start agate
+

Firewall

+

Lastly, if you have a firewall running, remember to open port 1965, which is the port number used by gemini:

+
ufw allow 1965

Finalization

-

Now your server should be running. If everything went okay, you can access your gemini via any gemini client with this url

+

Now your server should be running. If everything went okay, you can access your gemini capsule via any gemini client with a url like this:

gemini://example.org

Sample gemini site for reference:

gemini://gemini.circumlunar.space

Enjoy your first gemini capsule.

+

+ For information about how to write in "gemtext" the markup language in Gemini, see this site: https://gemini.circumlunar.space/docs/gemtext.gmi. + As you might guess it also has an analogous gemini capsule here: gemini://gemini.circumlunar.space/docs/gemtext.gmi +


Written by nihar.page

-- cgit v1.2.3