NetBSD pkgin search does not show any result related to a Gemini server binary package. Sources in /usr/pkgsrc/www neither gave a response (or, at least, I was unable to find or identify a valid source). Thus, I decided to compile and install gmid.
Installation in NetBSD was straightforward following the source package instructions and adding an extra step:
1.- Make sure you have installed the dependencies libevent2, libreSSL or openSSL, and yacc or GNU bison.
2.- Download gmid.
3.- Configure, make and make install gmid.
$ ./configure
$ make
$ sudo make install
4.- You can use a simple configuration proposed by the package (read the documentation for more examples). Adapt the server name and the certificate paths in accordance to your case.
# /etc/gmid.conf
server "example.com" {
listen on * port 1965
cert "/path/to/cert.pem"
key "/path/to/key.pem"
root "/var/gemini/example.com"
}
5.- The extra step: check if openssl.conf is in etc/openssl. If not, copy openssl configuration.
# cp /usr/share/examples/openssl/openssl.cnf \
/etc/openssl/openssl.cnf
6.- Generate the keys. I installed them in a newly created /etc/ssl directory. Tailor the script with your server name and the key days validity.
# openssl req -x509 -newkey rsa:4096 -nodes \
-keyout /etc/ssl/example.com.key \
-out /etc/ssl/example.com.pem \
-days 365 -subj "/CN=example.com"
7.- Run.
# gmid -c /etc/gmid.conf
8.- If you want to install it as a netbsd service during the boot process, create /etc/rc.d/gmid. You can then use ‘service gmid start’, ‘service gmid stop’, ‘service gmid status’ and ‘service gmid restart’ to manage the server.
#!/bin/sh
#
#
# PROVIDE: gmid
# REQUIRE: NETWORKING
$_rc_subr_loaded . /etc/rc.subr
name="gmid"
rcvar=$name
start_cmd="gmid_start"
command="/usr/local/bin/${name}"
configuration_file="/etc/${name}.conf"
pidfile="/var/run/${name}.pid"
required_files="/etc/${name}.conf"
gmid_start()
{
${command} -c ${configuration_file} -P ${pidfile}
}
load_rc_config $name
run_rc_command "$1"
(For any comments or feedback, you may use Mastodon: https://mastodon.social/@jdelacueva)