As I’ve mentioned before, my brother, The Quiet Learner, has set up his own gemlog and gemini server. I’ve been tinkering with the idea of creating a script or program that reads my WordPress blog and automatically builds a gemlog from that. That way what little technology knowledge I posses is freely available to view by others, even those who dislike the world wide web.

I started out by installing and setting up a gemini server. A quick search online lead me to a write up about it on Techrights.org, but there were a few hiccups along the way, so I’ll post my setup and thoughts.

It started out plain enough, after opening port 1965 in the firewall, I created a new user, called gemini.

root@alaskalinuxuser-PowerEdge-R520:/home/alaskalinuxuser# adduser gemini
Adding user `gemini' ...
Adding new group `gemini' (1002) ...
Adding new user `gemini' (1002) with group `gemini' ...
Creating home directory `/home/gemini' ...
Copying files from `/etc/skel' ...
New password: 
Retype new password: 
passwd: password updated successfully
Changing the user information for gemini
Enter the new value, or press ENTER for the default
	Full Name []: 
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y

Then, after switching to the gemini user, I created some folders, and a bare-bones gemini page:

gemini@alaskalinuxuser-PowerEdge-R520:~$ mkdir bin
gemini@alaskalinuxuser-PowerEdge-R520:~$ mkdir gemini
gemini@alaskalinuxuser-PowerEdge-R520:~$ mkdir certs
gemini@alaskalinuxuser-PowerEdge-R520:~$ cd gemini
gemini@alaskalinuxuser-PowerEdge-R520:~/gemini$ ls
gemini@alaskalinuxuser-PowerEdge-R520:~/gemini$ touch index.gmi
gemini@alaskalinuxuser-PowerEdge-R520:~/gemini$ echo "Gemini server setup in progress..." >> index.gmi 
gemini@alaskalinuxuser-PowerEdge-R520:~/gemini$ cat index.gmi 
Gemini server setup in progress...

I changed directories to my newly created bin folder and downloaded agate for an x86_64 system. Then I gunzipped it and made it executable:

gemini@alaskalinuxuser-PowerEdge-R520:~$ cd bin
gemini@alaskalinuxuser-PowerEdge-R520:~/bin$ wget https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz
--2021-07-20 07:24:44--  https://github.com/mbrubeck/agate/releases/download/v3.1.0/agate.x86_64-unknown-linux-gnu.gz
Resolving github.com (github.com)... 192.30.255.112
Connecting to github.com (github.com)|192.30.255.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-releases.githubusercontent.com/264589205/6644d980-c827-11eb-92c4-4b17b81de038?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210720%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210720T152424Z&X-Amz-Expires=300&X-Amz-Signature=3f950f7ff5ce3abe4ffabaeefa74e5b50080dcd54f7936be3cb634238a92bf9f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=264589205&response-content-disposition=attachment%3B%20filename%3Dagate.x86_64-unknown-linux-gnu.gz&response-content-type=application%2Foctet-stream [following]
--2021-07-20 07:24:44--  https://github-releases.githubusercontent.com/264589205/6644d980-c827-11eb-92c4-4b17b81de038?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210720%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210720T152424Z&X-Amz-Expires=300&X-Amz-Signature=3f950f7ff5ce3abe4ffabaeefa74e5b50080dcd54f7936be3cb634238a92bf9f&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=264589205&response-content-disposition=attachment%3B%20filename%3Dagate.x86_64-unknown-linux-gnu.gz&response-content-type=application%2Foctet-stream
Resolving github-releases.githubusercontent.com (github-releases.githubusercontent.com)... 185.199.111.154, 185.199.110.154, 185.199.109.154, ...
Connecting to github-releases.githubusercontent.com (github-releases.githubusercontent.com)|185.199.111.154|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1036251 (1012K) [application/octet-stream]
Saving to: ‘agate.x86_64-unknown-linux-gnu.gz’

agate.x86_64-unknow 100%[===================>]   1012K  2.86MB/s    in 0.3s    

2021-07-20 07:24:45 (2.86 MB/s) - ‘agate.x86_64-unknown-linux-gnu.gz’ saved [1036251/1036251]

gemini@alaskalinuxuser-PowerEdge-R520:~/bin$ ls
agate.x86_64-unknown-linux-gnu.gz
gemini@alaskalinuxuser-PowerEdge-R520:~/bin$ gunzip ./agate.x86_64-unknown-linux-gnu.gz 
gemini@alaskalinuxuser-PowerEdge-R520:~/bin$ chmod a+x ./agate.x86_64-unknown-linux-gnu 

As the root user I edited /etc/systemd/system/agate.service with nano:

[Unit]
Description=agate
After=network.target

[Service]
User=gemini
Type=simple
ExecStart=/home/gemini/bin/agate.x86_64-unknown-linux-gnu -s --content /home/gemini/gemini/ --key /home/gemini/certs/key.pem --cert /home/gemini/certs/cert.pem --hostname alaskalinuxuser.ddns.net --lang en-GB

[Install]
WantedBy=default.target

But it didn’t work very well. Actually it didn’t work at all when I started the service:

● agate.service - agate
     Loaded: loaded (/etc/systemd/system/agate.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Tue 2021-07-20 07:42:57 AKDT; 11min ago
    Process: 34151 ExecStart=/home/gemini/bin/agate.x86_64-unknown-linux-gnu -s --content /home/gemini/gemini/ --key /h>
   Main PID: 34151 (code=exited, status=1/FAILURE)

Jul 20 07:42:57 alaskalinuxuser-PowerEdge-R520 systemd[1]: Started agate.
Jul 20 07:42:57 alaskalinuxuser-PowerEdge-R520 agate.x86_64-unknown-linux-gnu[34151]: Unrecognized option: 's'
Jul 20 07:42:57 alaskalinuxuser-PowerEdge-R520 systemd[1]: agate.service: Main process exited, code=exited, status=1/FA>
Jul 20 07:42:57 alaskalinuxuser-PowerEdge-R520 systemd[1]: agate.service: Failed with result 'exit-code'.

Turns out I needed to edit the ExecStart command a little, I finally came up with this after reading the agate help:

ExecStart=/home/gemini/bin/agate.x86_64-unknown-linux-gnu --content /home/gemini/gemini/ --certs /home/gemini/certs/ --hostname alaskalinuxuser.ddns.net --lang en-GB

And from the logs, I could see it was working. By the way, it makes it’s own certificates, and didn’t use the ones I had previously made. I recommend doing it this way unless you need to use your own pre-made certs.

[2021-07-20T16:25:27Z INFO  agate] No certificate or key found for "alaskalinuxuser.ddns.net", generating them.
[2021-07-20T16:25:27Z INFO  agate] Listening on [[::]:1965, 0.0.0.0:1965]...
[2021-07-20T16:25:33Z INFO  agate] [::ffff:192.168.5.251]:1965 - "gemini://alaskalinuxuser.ddns.net" 20 "text/gemini;lang=en-GB"

And that was it. Now I have a functioning gemini server with a short gemlog. You can check it out if you’d like, but you’ll need a gemini browser, like Castor.

gemini://alaskalinuxuser.ddns.net

So far it doesn’t say much, though!

Linux – keep it simple.

Leave a Reply

Your email address will not be published.