You are not logged in.

#1 2023-02-19 18:34:10

heidegger
Member
Registered: 2013-04-24
Posts: 88

Next step, build a functional PKGBUILD for proper install, OpenNMS

Note that I am referencing the following instructions:
https://github.com/OpenNMS/opennms/blob … arted.adoc
https://github.com/OpenNMS/opennms/blob … ource.adoc
https://github.com/OpenNMS/jicmp
https://github.com/OpenNMS/jicmp6

I wanted to experiment with a program and found to my amazement, that an AUR package didn't exist, yet.
It may be that only a madman would want to run this software on a rolling release distro, and I thought: "I am that madman!"

So far I have made it to the end of section 2.2 of https://wiki.archlinux.org/title/Creating_packages and it seems to be working properly.

Now I'd like to put all the steps into a PKGBUILD so it can be installed in the correct directory, run as a systemd unit, and handled properly by pacman.
I've never made a PKGBUILD and was hoping for some pointers.

Here's a basic rundown of the process.
You need to have base-devel and git, both of which I already had.
You need jdk11-openjdk (maybe newer works but that's what was indicated as a prerequisite).
You need postgresql installed, started, and enabled per https://wiki.archlinux.org/title/PostgreSQL with some modifications per https://github.com/OpenNMS/opennms/blob … resql.adoc.

I don't know if the above postgresql setup could or should be included in the PKGBUILD.
Also, I used the default postgresql database location of /var/lib/postgres/data but am thinking it may be better to use a unique location for machines that have multiple databases. (Maybe, I don't know.)

You also need JICMP and JICMP6.
These are hard dependencies and also provided by the openNMS team.
I expect they will need their own PKGBUILDs but they are (a little) more straightforward.
They need git and base-devel. However, they use deprecated code and must be built against jdk8-openjdk.
The install for each goes as follows:

$ git clone https://github.com/OpenNMS/jicmp.git
$ cd jicmp
$ git submodule update --init --recursive
$ autoreconf -fvi
$ ./configure
$ make
$ sudo make install

and

$ git clone https://github.com/OpenNMS/jicmp6.git
$ cd jicmp6
$ git submodule update --init --recursive
$ autoreconf -fvi
$ ./configure
$ make
$ sudo make install

Now back to openNMS:

$ git clone https://github.com/OpenNMS/opennms.git ~/dev/opennms
$ cd ~/dev/opennms

At this point I had errors when trying the coming commands and my solution was to edit /etc/security/limits.conf adding the following.

my_username           soft    nofile          12288
my_username           hard    nofile          12288

My machines default was at 1024 and insufficient, even 8192 was insufficient. I expect the limit needs to be around 12288.
I don't know how this would be added to a PKGBUILD or if you would want to, but it was necessary to execute the following:

$ ./compile.pl -DskipTests
$ ./assemble.pl -p dir -DskipTests

I believe the following commands only need to be run once:

$ export ONMS_RELEASE=$(./.circleci/scripts/pom2version.sh pom.xml)
$ echo "RUNAS=$(id -u -n)" > "target/opennms-${ONMS_RELEASE}/etc/opennms.conf"
$ ./target/opennms-"${ONMS_RELEASE}"/bin/runjava -s
$ ./target/opennms-"${ONMS_RELEASE}"/bin/install -dis

Now it's installed, just run with:

./target/opennms-"${ONMS_RELEASE}"/bin/opennms -vt start

Ideally the above should be translated into a systemd unit.
I'm a bit over my head, so I am here for professional advice.

Thank you!
H

Offline

Board footer

Powered by FluxBB