# IcingaDB supported on FreeBSD (Ports, Packages)?

**URL:** <https://community.icinga.com/t/icingadb-supported-on-freebsd-ports-packages/10351>\
**Category:** Icinga DB\
**Tags:** freebsd, icingadb\
**Created:** [August 10, 2022, 11:33am UTC](https://community.icinga.com/t/icingadb-supported-on-freebsd-ports-packages/10351 "2022-08-10T11:33:53Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![Matlib](https://community.icinga.com/user_avatar/community.icinga.com/matlib/32/4164_2.png) [@Matlib](https://community.icinga.com/u/Matlib)\
**Post date:** [January 23, 2023, 9:45pm UTC](https://community.icinga.com/t/icingadb-supported-on-freebsd-ports-packages/10351/4 "2023-01-23T21:45:37Z")

</div>

**Installing IcingaWeb/DB on FreeBSD**

Prereq:

- installed and running Icinga server
- remove the _icingaweb2_ package as it is totally outdated

# 1. Redis

```shell
pkg install redis

```

Create file **/usr/local/etc/icinga2/redis.conf** with the following content:

```plaintext
bind 127.0.0.1
protected-mode yes
port 6380
tcp-backlog 5
unixsocket /var/run/icinga2/redis.sock
unixsocketperm 660
timeout 0
tcp-keepalive 300
daemonize yes
supervised no
pidfile /var/run/icinga2/redis.pid
loglevel notice
logfile /var/log/icinga2/redis.log
databases 16
always-show-logo no
set-proc-title no
save ""
tracking-table-max-keys 1000
user default on allcommands allkeys allchannels >redis-password
maxclients 100
maxmemory 128MB
maxmemory-policy noeviction
shutdown-timeout 1

```

Launch redis:

```shell
daemon -u icinga redis-server /usr/local/icinga2/redis.conf

```

Check the log file **/var/log/icinga2/redis.log** if we’re happy.

Edit file **/usr/local/etc/icinga2/features-available/icingadb.conf** and enter these values:

```plaintext
object IcingaDB "icingadb" {
  host = "127.0.0.1"
  port = 6380
  password = "redis-password"
}

```

Enable Redis module in Icinga server:

```shell
ln -s /usr/local/etc/icinga2/features-available/icingadb.conf /usr/local/etc/icinga2/features-enabled/
pkill -HUP icinga2

```

Verify if all gears turn.

# 2. IcingaDB daemon

Compilation has to be done on machine/credentials connected to the Internet, as the build process downloads a lot of files.

```shell
pkg install go

```

Download a fresh version of [IcingaDB](https://github.com/Icinga/icingadb/releases). The following steps are done with an unpriviledged user:

```auto
tar -xf v*.tar.gz
cd icingadb-*/cmd/icingadb
go build

```

This should produce the binary called **icingadb** that needs be copied to the production machine (_/usr/local/bin_ being the usual location).

Set up the [database](https://github.com/Icinga/icingadb/blob/master/doc/02-Installation.md#setting-up-the-database). Then create the configuration file **/usr/local/etc/icinga2/icingadb.yml** :

```plaintext
database:
  type: pgsql
  host: 127.0.0.1
  port: 5432
  database: icingadb
  user: icinga
  password: postgres-password

redis:
  host: 127.0.0.1
  port: 6380
  password: redis-password

logging:
  level: info
  output: console
  interval: 20s

```

Launch icingadb daemon:

```shell
daemon -f -o /var/log/icinga2/icingadb.log -p /var/run/icinga2/icingadb.pid -u icinga icingadb -c /usr/local/etc/icinga2/icingadb.yml

```

Check the log **/var/log/icinga2/icingadb.log** if we’re rolling.

# 3. Deploying PHP app

The following instructions assume the location of shared components is _/usr/local/share/icinga-php_, so you need to change the default path by setting the ICINGAWEB\_LIBDIR environment variable. For Apache that’s `SetEnv ICINGAWEB_LIBDIR "/usr/local/share/icinga-php"`.

Install PHP 8.1:

```shell
pkg install php81 php81-bcmath php81-ctype php81-curl php81-dom \
  php81-filter php81-gd php81-gettext php81-iconv php81-intl php81-ldap \
  php81-mbstring php81-mysqli php81-opcache php81-pdo \
  php81-pdo_mysql php81-pdo_pgsql php81-pdo_sqlite php81-pecl-bitset \
  php81-pecl-mcrypt php81-pecl-memcache php81-pecl-memcached \
  php81-pgsql php81-phar php81-posix php81-session php81-simplexml \
  php81-soap php81-sockets php81-sqlite3 php81-xml php81-zlib \
  php81-pear-Services_JSON
mkdir -p /usr/local/share/icinga-php/ipl /usr/local/share/icinga-php/vendor

```

Get the lastest versions of the [IPL](https://github.com/Icinga/icinga-php-library/releases), [thirdparty modules](https://github.com/Icinga/icinga-php-thirdparty/releases), [IcingaWeb](https://github.com/Icinga/icingaweb2/releases), and [icingadb-web](https://github.com/Icinga/icingadb-web/releases), and copy their content:

```shell
cp -r icinga-php-library-x.xx.x/* /usr/local/share/icinga-php/ipl/
cp -r icinga-php-thirdparty-x.xx.x/* /usr/local/share/icinga-php/vendor/
cp -r icingaweb2-x.xx.x/* /usr/local/www/icingaweb2/
mkdir /usr/local/www/icingaweb2/modules/icingadb
cp -r icingadb-web-x.x.x/* /usr/local/www/icingaweb2/modules/icingadb/

```

And now the module can be enabled and configured from IcingaWeb GUI.

---

_[View the full topic](https://community.icinga.com/t/icingadb-supported-on-freebsd-ports-packages/10351)._
