How do I get the apt command to install icingaweb2 to install PHP 8.0 packages instead of PHP 8.1 packages?

Hi there,

I am in the process of a fresh install of icinga2 and icingaweb2 on an ubuntu 20.04 server.

Here are the directions I am following:

There are compatibility issues with PHP-8.1. How do I get this apt command for installing icingaweb2 to install PHP 8.0 packages instead of PHP 8.1 packages?

Below I have the following:

  1. The command output that I am attempting to change.
  2. The system information

---- snip —

# sudo apt install icingaweb2 icingacli libapache2-mod-php8.0

Reading package lists… Done
Building dependency tree
Reading state information… Done
libapache2-mod-php8.0 is already the newest version (8.0.15-1+ubuntu20.04.1+deb.sury.org+1).
The following additional packages will be installed:
icinga-php-library icinga-php-thirdparty icingaweb2-common icingaweb2-module-doc icingaweb2-module-monitoring php-json php8.1-cli php8.1-common php8.1-opcache php8.1-phpdbg php8.1-readline
Suggested packages:
php-pear
The following NEW packages will be installed:
icinga-php-library icinga-php-thirdparty icingacli icingaweb2 icingaweb2-common icingaweb2-module-doc icingaweb2-module-monitoring php-json php8.1-cli php8.1-common php8.1-opcache
php8.1-phpdbg php8.1-readline
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 14.1 MB/15.2 MB of archives.
After this operation, 58.6 MB of additional disk space will be used.
Do you want to continue? [Y/n]

---- snip ----

— system details ----

icinga2 --version

icinga2 - The Icinga 2 network monitoring daemon (version: r2.13.2-1)

Copyright (c) 2012-2022 Icinga GmbH

License GPLv2+: GNU GPL version 2 or later

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

System information:

Platform: Ubuntu

Platform version: 20.04.3 LTS (Focal Fossa)

Kernel: Linux

Kernel version: 5.4.0-99-generic

Architecture: x86_64

Build information:

Compiler: GNU 9.3.0

Build host: runner-hh8q3bz2-project-298-concurrent-0

OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020

Application information:

General paths:

Config directory: /etc/icinga2

Data directory: /var/lib/icinga2

Log directory: /var/log/icinga2

Cache directory: /var/cache/icinga2

Spool directory: /var/spool/icinga2

Run directory: /run/icinga2

Old paths (deprecated):

Installation root: /usr

Sysconf directory: /etc

Run directory (base): /run

Local state directory: /var

Internal paths:

Package data directory: /usr/share/icinga2

State path: /var/lib/icinga2/icinga2.state

Modified attributes path: /var/lib/icinga2/modified-attributes.conf

Objects path: /var/cache/icinga2/icinga2.debug

Vars path: /var/cache/icinga2/icinga2.vars

PID path: /run/icinga2/icinga2.pid

:# php -v

PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:33) (NTS)

Copyright (c) The PHP Group

Zend Engine v4.1.2, Copyright (c) Zend Technologies

with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

:# icinga2 feature list

Disabled features: api command compatlog debuglog elasticsearch gelf graphite icingadb influxdb influxdb2 livestatus opentsdb perfdata statusdata syslog

Enabled features: checker ido-mysql mainlog notification

:# icinga2 daemon -C

[2022-02-13 07:17:26 +0000] information/cli: Icinga application loader (version: r2.13.2-1)

[2022-02-13 07:17:26 +0000] information/cli: Loading configuration file(s).

[2022-02-13 07:17:26 +0000] information/ConfigItem: Committing config item(s).

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 13 Notifications.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 IcingaApplication.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 2 HostGroups.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 2 NotificationCommands.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 Host.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 Downtime.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 FileLogger.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 CheckerComponent.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 IdoMysqlConnection.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 3 Zones.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 Endpoint.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 244 CheckCommands.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 NotificationComponent.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 UserGroup.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 User.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 3 TimePeriods.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 3 ServiceGroups.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 1 ScheduledDowntime.

[2022-02-13 07:17:26 +0000] information/ConfigItem: Instantiated 12 Services.

[2022-02-13 07:17:26 +0000] information/ScriptGlobal: Dumping variables to file ‘/var/cache/icinga2/icinga2.vars’

[2022-02-13 07:17:26 +0000] information/cli: Finished validating the configuration file(s).

— snip —

I found the answer. This sets the system php to version 8.0.

:# update-alternatives --set php /usr/bin/php8.0
update-alternatives: using /usr/bin/php8.0 to provide /usr/bin/php (php) in manual mode
:# php -v
PHP 8.0.15 (cli) (built: Jan 29 2022 07:24:52) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.15, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.15, Copyright (c), by Zend Technologies