3.8 KiB
I2Pd RC script for OpenBSD
Instructions on how to compile I2Pd on OpenBSD, together with a makefile and an RC script to make it a system service, allowing it to be started at boot and so on.
Description
I2Pd is packaged in OpenBSD's official repositories, but the provided versions are old, and older versions don't always run reliably when interacting with newer versions on the I2P network.
Fortunately, compiling the latest version from source on OpenBSD is painless. LibreSSL is supported, the official instructions work out of the box, and only a small manual intervention is required to make the daemon start at system boot.
This repository contains instructions on how to compile I2Pd on OpenBSD together
with a makefile and an RC script to make it a system service, which allows it
to be started at boot, restarted if it crashes, managed by rcctl
, and more.
Compiling and installing
This part is taken from the official instructions for compiling and installing I2Pd on a generic Unix system. If the instructions listed here differ from the official instructions, prioritize the official instructions, unless a detail specific to OpenBSD is stated here.
First, install a few dependencies. Git is not in their list, but is needed as it does not come with OpenBSD's base system:
$ doas pkg_add boost cmake git lzlib
Next, clone their git repository:
$ cd /a/folder/of/your/choice/where/to/clone/the/repo
$ git clone https://github.com/PurpleI2P/i2pd.git
Then, generate the makefile and compile the source. You can pass options to cmake to customize your makefile:
$ cd i2pd/build
$ cmake .
$ make
Next, install the binaries you just compiled:
$ doas make install
Finally, the base config files and certificates must be copied in the
appropriate folders. This step is not clearly listed in the official
installation instructions. It is only mentionned
on this page.
These base files are in the contrib
folder at the root of the git reposotory.
$ cd ../contrib
$ doas mkdir -p /etc/i2pd /var/lib/i2pd
$ doas cp -R i2pd.conf tunnels.* /etc/i2pd
$ doas cp -R certificates /var/lib/i2pd
Making I2Pd start at boot
At this point, you can start I2Pd manually, but it won't start automatically when the system boots. This section describes how to achieve this.
The first thing to do is to create a new login class to increase the number of files I2Pd will be able to open simultaneously. By default, OpenBSD restricts this number to a value that is too low for I2Pd to work properly. Symptoms of a number that is too small include difficulties connecting to eepsites and high CPU usage.
To create a login class, simply add the following lines at the end of
/etc/login.conf
:
i2pd:\
:openfiles-cur=102400:\
:openfiles-max=102400:\
:tc=daemon:
This login class will be used by the user _i2pd
created in the following
steps. Next, clone this git repository:
$ cd /a/folder/of/your/choice/where/to/clone/the/repo
$ git clone TODO
Then, simply run the makefile. This step creates a dedicated _i2pd
user and a
group of the same name if they don't already exist, makes the binaries
previously compiled belong to them, and copies the init script in /etc/rc.d
.
$ cd i2pd-rc-openbsd
$ doas make install
The final step is to enable the service to make it start at boot time and manually start it:
$ doas rcctl enable i2pd
$ doas rcctl start i2pd