-- Leo's gemini proxy

-- Connecting to nuooooo.online:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

How I Host a Gemini Capsule on Raspberrypi


2023-01-03



Hardware used


Raspberry Pi Zero 2 W with Raspbian Version 11



The process


1. Acquiring & setting up a domain name


The first step is to acquire a domain name, I used Namecheap but there are other free alternatives, such as:


https://www.freenom.com/en/index.html Freenom


/!\ Make sure that you have set up an A record so that your domain can be associated with an IP address. In Namecheap, this can be done by going to domain list > *your domain* [Manage] > advanced DNS > Host Records > + Add new record.


You also need to make sure that your domain name redirects to the IP address of your Raspberry Pi. If you're using Namecheap, you can do so by routinely accessing a certain url from your Raspberry Pi. I'll explain further down how to routinely access it with ddclient, but here is how it works if you decide to use another service:

https://dynamicdns.park-your-domain.com/update?host=@&domain=[domain_name]&password=[ddns_password]

domain_name = your domain, in my case, nuooooo.online

ddns_password = this can be found in Domain List > *your domain* [Manage] > Advanced DNS > Dynamic DNS. If it is not enabled, enable it to check the password.


Further details can be found here:


How to dynamically update the host's IP with an HTTP request?


If you'd like to use ddclient to routinely update the IP address, you can install it with:


sudo apt-get install ddclient -y

After ddclient has finished installing, the configuration wizard will start up. If you used Namecheap for your domain address, you may fill it in with random values as Namecheap's configuration is different from that shown in the wizard.


The next step is to access the configuration file with the following command:

sudo nano /etc/ddclient.conf

Change the following configurations as follows:

protocol=namecheap
use=web, web=dynamicdns.park-your-domain.com/getip
server=dynamicdns.park-your-domain.com
# Change the following to your own Namecheap domain
login= [domain_name]
# Change the following with the Dynamic DNS Password located in your Namecheap dashboard
password= [ddns_password]

Then restart ddclient to enable it to work with the new configurations:

sudo systemctl restart ddclient.service


2. Port-forwarding


Agate server uses port 1965. Therefore you need to make sure that it is open on your router and pointing to your Raspberry Pi. Here is how to do it if you have a Fritz!Box router:


Port-forwarding on Fritz!Box



3. Installing the server


I chose Agate to host my Gemini capsule as it works out of the box. There are several ways to install Agate, which can be found on their official Github page:


Agate


I decided to I use the Rust toolch the following command to install Agate:


cargo install agate

After the installation is complete, set up the content directory and create an index for your capsule:


mkdir content
cd content
sudo nano index.gmi

In index.gmi, I wrote this:

# Hello World

This capsule is hosted on a Raspberry Pi.

=> gemini://nuooooo.online/


4. Launching the server


To test that everything works, run the server with the following command :


agate --hostname nuooooo.online

/!\ You'll have to add `--content /directory/with/your/content` if you didn't name the root directory of your capsule 'content' in the previous step.


If everything went well, you should be able to access your capsule from a browser which supports Gemini. I personally use Lagrange:


Lagrange Official Website



5. Optional: Create a separate session on which to run the server.


If you're using SSH to connect to your Raspberry Pi, you'll need to create a separate session on which to run the server so it doesn't disconnect when your SSH session ends.


Tmux is a convenient tool for this. Install it with:


sudo apt-get install tmux

Then, create a session with:


tmux new -s sessionName

Run the agate server there, then to go back to the main session, type [ctrl + b] followed by [d]


If you need to go back to the agate session at any time, you can do so with:


tmux attach -t sessionName


← Home

-- Response ended

-- Page fetched on Mon May 13 05:26:17 2024