< Grimoire

Installing Ergol

The following are instructions on how to install the Ergol Gemini Server, written by Adele. These are the instructions I use specifically to install the server. Some notes:

You can find more information on Ergol on Adele's Codeberg.

Ergol

Pulling Ergol Down

A simple 'git clone' will pull the code you need into you server.

git clone https://codeberg.org/adele/ergol.git

From here, we we can copy files to where we need them to go.

Server Setup

Let's create a directory for where we want ergol to be.

sudo mkdir /lib/ergol

Then let's copy the files we need into it. These commands will assume that Ergol was cloned into your home directory. Also, note that we are changing the name of 'ergol-sample.json'.

sudo cp ~/ergol/ergol.php /lib/ergol
sudo cp ~/ergol/ergol-sample.json /lib/ergol/ergol.json 

We will be modifying the JSON file in a moment.

Create your SSL Certificate

Next we will need to create a Certificate for our server. This command will use 'eltheria.org' as an example, but replace it with whatever your domain will be.

openssl req -x509 -newkey rsa:4096 \
-subj '/CN=eltheria.org/C=US/ST=StateName/L=CityName/O=OrganizationName/OU=NA' \
-nodes -keyout eltheria.org.pem -out eltheria.org.pem -days 730

This will create your *.pem file. This file should be placed where you usually place your certificates. For me, I create the following directory:

sudo mkdir /etc/ssl/gemini/

And I store the file there.

Update your Configuration

Now we need to update our ergol.json file and make sure it looks good. I will use my own configuration as an example. My folder points to the same folder Apache does, since I use ergol-http.

{
    "interface": "0.0.0.0",
    "port": 1965,
    "capsules": {
       "eltheria.org": {
         "cert": "/etc/ssl/gemini/eltheria.org.pem",
         "folder": "/var/www/html",
         "lang": "en",
         "lang_regex": "/\\.([a-z][a-z])\\./",
         "auto_index_ext": [".gmi"],
         "redirect": false
       }
    }
}

Running the Server

For my own ease of use, I make ergol.php an executable:

sudo chmod +x /lib/ergol/ergol.php

Then I run the server using the PHP file.

sudo /lib/ergol/ergol.php

Once this is done, the server should be running. Make sure you have an 'index.gmi' where your capsule is stored (/var/www/html in my case). After that, you should be able to use your favorite gemini browser and see your server. Or, if you do not have a browser, you can use the SmolNet portal as an "in-browser" gemini browser.

SMOLNET Portal

Allowing Port in Firewall

For some of you, you may have a Firewall installed. Make sure you open up your port specified in your configuration file (1965 by default). In my case, I use UFW:

sudo ufw allow 1965/tcp
sudo ufw reload
^
🦊 gemini://eltheria.org/grimoire/linux/2024_11_24_Installing_Ergol_Gemini_Server.gmi