-- Leo's gemini proxy

-- Connecting to gemini.techrights.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini;lang=en-GB

● 02.23.21


●● How to Set Up a Gemini Server of Your Own, Even on a Simple Single-Board Computer


Posted in Free/Libre Software, Servers at 8:33 pm by Dr. Roy Schestowitz


Summary: Using Agate to start one’s own Gemini capsule (self-hosted) is a lot simpler than one might be inclined to believe; this is a detailed HOWTO, hoping to encourage more people to join Gemini space, which is fast-growing and free of garbage


THE one thing that stunned me was how easy it was to set up a Gemini server. A lot simpler than setting up a Web server. The harder part is certificates, but that too is trivial once it’s done a couple of times, potentially with errors at first.


Here’s a quick recipe for setting up one’s own instance and Gemini capsule.


First, create a new user’s account. Gemini ought to have its own account, as it’ll make things a lot simpler (backup, permissions etc.) and for the sake of this example we’ll assume the user account is “gemini” (with home directory /home/gemini)


Then, in the user’s top-level (home) directory:


mkdir gemini bin certs


This will set up directories for the capsule, the programs, and the certificates, respectively.


There’s not so much left to do now.


Go to the directory gemini (e.g. cd ~/gemini/ or equivalent using a graphical file browser)


In that directory, create or place a file called index.gmi


It can be empty or contain something simple like Hello world! (just to make sure that the server is set up and works)


Now let’s get the server software. Go to the bin directory (e.g. cd ~/bin/). For most practical purposes agate (Apache Licence) seems to be OK and it supports quite a few architectures. Unfortunately it’s hosted on GitHub (Microsoft), with latest versions shown at the top of this page. If you are not sure what architecture to choose, run uname -a


↺ this page


The correct binary can be downloaded using a Web browser or a tool like wget/curl. That program is quite small and needs to be placed in bin in order to stay consistent with this manual.


Unpack and set ‘executable’ (x) permission for the file, e.g. using



gunzip [binary_file]

chmod +x [binary_file]


Depending on the name of the binary file in question.


For my ARM SBC it is gunzip agate.armv7-unknown-linux-gnueabihf.gz and chmod +x agate.armv7-unknown-linux-gnueabihf


All the pieces are now in place except the certificate and the service setup.


On a systemd-based operating system create a new file at /etc/systemd/system/agate.service


It should look something like this:



[Unit]

Description=agate

After=network.target


[Service]

User=gemini

Type=simple

ExecStart=[your settings]


[Install]

WantedBy=default.target


Wherein [your settings] ties together the program, the root directory for hosting (capsule), and the certificate.


In the case of Techrights on ARM, it’s something as follows:


/home/gemini/bin/agate.armv7-unknown-linux-gnueabihf -s –content /home/gemini/gemini/ –key /home/gemini/certs/key.pem –cert /home/gemini/certs/cert.pem –hostname your hostname –lang en-GB


In our case, your hostname is gemini.techrights.org (how you set up your hostname may depend on how you manage domains and where). That hostname needs to point to your device’s IP address.


All that’s left now is certificate setup and service initiation.


Go to the certificates directory (e.g. cd ~/certs/) as this will likely involve the command line (unless you have some graphical tools that do the same).


A simple self-signed certificate ought to be sufficient:


openssl req -new -subj “/CN=your hostname” -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 -days 365 -nodes -out cert.pem -keyout key.pem


That’s for 1 year. It can be set to anything.


The command then leaves the two files required by the service/server, namely cert.pem and key.pem. These can be modified and regenerated at any time, so there’s no need to worry if at any point they’re wrongly generated or made for the ‘wrong’ domain.


To get it all started, assuming systemd:



sudo systemctl restart agate

sudo systemctl enable agate


Use a Gemini browser (or Web proxy) to then test access to the hostname over gemini:// (it will attempt to connect over port 1965, so make sure there’s no firewall standing in the way at the level of the device or the network it is in). This is pretty much it, with the exception of variation for non-systemd systems. All that systemd does is, it starts the server using the suitable command and arguments, even after restarts. That command can instead be run manually, or set up for any init system of choice. The hardest part is setting up the domain, generating the key/certificate correctly, and then lowering the filters (if any) to allow access over port 1965.


We don’t typically do HOWTO-type articles, but for this one we make an exception. If you get stuck, ask us in IRC for help. Gemini needs to grow and for faster growth we need to help one another.


Agate is quite small and simple. As of the time of writing, it does not support server-side CGI scripts (for something like in-capsule search), but Gemini ought to be kept light and simple anyway; we’re not trying to just replicate the bloated Web. █


↺ it does not support server-side CGI scripts


Credit: Chris Were, for some initial notes and suggestions. gemini://chriswere.uk/


Share in other sites/networks: These icons link to social bookmarking sites where readers can share and discover new web pages.


Permalink  Send this to a friend


Permalink

↺ Send this to a friend



----------

Techrights

➮ Sharing is caring. Content is available under CC-BY-SA.

-- Response ended

-- Page fetched on Fri May 17 05:40:52 2024