![Stacks Image 46642](files/stacks-image-7e9ebe3-128x100.png)
Nouveautés depuis la version 20.04, installation d'un nouveau gestionnaire d'événements remplaçant centcore. Celui-ci se nomme Centreon-gorgone. Mais auparavant, installons les prérequis pour Centreon-Web.
16 Prérequis
Tout d'abord, Il faudra créer un groupe système et un utilisateur système centreon
sudo groupadd -g 6000 centreon
sudo useradd -u 6000 -g centreon -m -r -d /var/lib/centreon -c "Centreon Admin" -s /bin/bash centreon
Rajoutez l'utilisateur centreon-broker dans le groupe centreon. Ceci permettra au broker de créer les fichier RRD.
sudo usermod -aG centreon centreon-broker
Nous devons installer php 8.0, suivre les instructions suivantes. Installer les paquets suivants :
sudo apt-get install ca-certificates apt-transport-https software-properties-common -y
Ajoutez le dépôt pour PHP 8.1
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo bash -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
Mettre à jour les paquets
sudo apt upgrade -y
Il faut installer les paquets supplémentaires.
sudo apt install php php8.1-opcache libapache2-mod-php php-mysql php-curl php-json php-gd php-intl php-mbstring php-xml php-zip php-fpm php-readline ntp rrdtool php-sqlite3 php-pear sudo tofrodos bsd-mailx lsb-release mariadb-server libconfig-inifiles-perl libcrypt-des-perl librrds-perl libdigest-hmac-perl libdigest-sha-perl libgd-perl php-ldap php-snmp php-db php-date -y
Modifions les paramètres de php-conf pour augmenter le nombre de fichiers ouverts
sudo mkdir -p /etc/systemd/system/php-fpm.d
sudo tee /etc/systemd/system/php-fpm.d/centreon.conf <<EOF
[Service]
LimitNOFILE=4096
EOF
Activons les modules
sudo a2enmod proxy_fcgi setenvif proxy rewrite
sudo a2enconf php8.1-fpm
sudo a2dismod php8.1
sudo systemctl restart apache2 php8.1-fpm
Il faut obligatoirement configurer le paramètre date.timezone pour le php-fpm. Pour cela, éditez le fichier de configuration pour apache. Attention, bien respectez la casse et ne pas mettre d'espace.
Saisissez la valeur adaptée à votre configuration.
sudo bash -c "echo 'date.timezone = Europe/Paris' >> /etc/php/8.1/fpm/conf.d/50-centreon.ini"
16.1 préparation de MariaDB
La version Centreon 21.10 autorise maintenant le mode strict, il n'est plus nécessaire de paramétrer la variable sql_mode. Par contre, il faut sécuriser la base de données en initialisant le mot de passe root de MariaDB. Lancez la commande mysql_secure_installation et répondre Y aux questions.
sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! In order to log into MariaDB to secure it, we'll need the current password for the root user. If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here. Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password or using the unix_socket ensures that nobody can log into the MariaDB root user without the proper authorisation. You already have your root account protected, so you can safely answer 'n'. Switch to unix_socket authentication [Y/n] Y Enabled successfully! Reloading privilege tables.. ... Success! You already have your root account protected, so you can safely answer 'n'. Change the root password? [Y/n] Y New password: Re-enter new password: Password updated successfully! Reloading privilege tables.. ... Success! By default, a MariaDB installation has an anonymous user, allowing anyone to log into MariaDB without having to have a user account created for them. This is intended only for testing, and to make the installation go a bit smoother. You should remove them before moving into a production environment. Remove anonymous users? [Y/n] Y ... Success! Normally, root should only be allowed to connect from 'localhost'. This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] Y ... Success! By default, MariaDB comes with a database named 'test' that anyone can access. This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] Y - Dropping test database... ... Success! - Removing privileges on test database... ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] Y ... Success! Cleaning up... All done! If you've completed all of the above steps, your MariaDB installation should now be secure. Thanks for using MariaDB!
Afin de pouvoir partitioner certaines tables de la base centreon_storage, modifiez le fichier de configuration systemd de MySQL en ajoutant le fichier suivant.
sudo mkdir /etc/systemd/system/mariadb.service.d
sudo tee /etc/systemd/system/mariadb.service.d/limitnofile.conf <<EOF
[Service]
LimitNOFILE=32000
EOF
Ajouter le fichier suivant pour finir la configuration.
sudo tee /etc/mysql/conf.d/centreon.cnf <<EOF
#
# Custom MySQL/MariaDB server configuration for Centreon
#
[server]
innodb_file_per_table=1
open_files_limit = 32000
key_buffer_size = 256M
sort_buffer_size = 32M
join_buffer_size = 4M
thread_cache_size = 64
read_buffer_size = 512K
read_rnd_buffer_size = 256K
max_allowed_packet = 8M
# For 4 Go Ram
#innodb_additional_mem_pool_size=512M
#innodb_buffer_pool_size=512M
# For 8 Go Ram
#innodb_additional_mem_pool_size=1G
#innodb_buffer_pool_size=1G
EOF
Redémarrez le serveur MySql en prenant compte les modifications.
sudo systemctl daemon-reload && sudo systemctl restart mysql
![Stacks Image 46793](files/stacks-image-2782cd4-40x38.png)
Le broker Centreon s'appuie actuellement sur un fichier socket situé dans /var/lib/mysql/mysql.sock. Hors, MariaDB sous Debian créé le fichier dans /run/mysqld.sock, ce qui provoque un dysfonctionnement avec les messages d'erreur suivants dans /var/log/centreon-broker/central-broker-master.log.
Centreon Broker 20.10.5 log file opened
[1621187250] error: mysql_connection: error while starting connection
[1621187251] error: mysql_connection: error while starting connection
[1621187260] error: storage: Unable to initialize the storage connection to the database
Pour palier ce problème, réalisez ce lien symbolique
sudo ln -s /run/mysqld/mysqld.sock /var/lib/mysql/mysql.sock
17 Installation de Gorgone
Installation d'un nouveau gestionnaire d'événements remplaçant centcore.
17.1 Prérequis pour les librairies
Installer les paquets suivants
sudo apt install git libssh-dev libextutils-makemaker-cpanfile-perl libmodule-build-perl libmodule-install-perl libczmq-dev libtest-fatal-perl libtest-requires-perl libtest-tcp-perl -y
17.2 Installation ZMQ-LibZMQ4
Nous allons récupérer les dépôts GitHub suivants. Ensuite, installons le dépôt libzmq-constants-perl et compilons la librairies perl
cd
git clone https://github.com/centreon-lab/libzmq-constants-perl.git
git clone https://github.com/centreon-lab/zmq-libzmq4-perl
cd libzmq-constants-perl/
sudo dpkg -i libzmq-constants-perl_1.04-1_all.deb
cd ../zmq-libzmq4-perl/
perl Makefile.PL
make && sudo make install
17.3 Installation lib-ssh
cd
git clone https://github.com/garnier-quentin/perl-libssh.git
cd perl-libssh
perl Makefile.PL
make && sudo make install
17.4 Autre prérequis
Installer les paquets suivants
sudo apt install libcryptx-perl libschedule-cron-perl libcrypt-cbc-perl libcpanel-json-xs-perl libjson-pp-perl libyaml-perl libyaml-libyaml-perl libdbd-sqlite3-perl libdbd-mysql-perl libapache-dbi-perl libdata-uuid-perl libhttp-daemon-perl libhttp-message-perl libmime-base64-urlsafe-perl libdigest-md5-file-perl libwww-curl-perl libio-socket-ssl-perl libnetaddr-ip-perl libhash-merge-perl -y
17.5 Installation en ligne de commande
Téléchargez le binaire du 17/02/2022 dans le dossier /usr/local/src et décompressez-le.
cd
wget https://github.com/centreon/centreon-gorgone/archive/refs/tags/21.10.2.tar.gz -O centreon-gorgone-21.10.2.tar.gz
tar xzf centreon-gorgone-21.10.2.tar.gz
cd centreon-gorgone-21.10.2
Lancez la ligne de commande ci-dessous pour débuter l'installation.
sudo ./install.sh -i
Au lancement du script, le programme vérifie certaines informations. Répondre y pour continuer
Script requirements OK Found distribution debian 11 Loading distribution specific input variables install/inputvars.debian.env Loading user specific input variables inputvars.env Installation type central Installation mode install Welcome to Centreon installation script! Should we start? [Y/n] >y
L'installation vérifie les prérequis. Répondre y pour continuer
Centreon installation requirements ---------------------------------------------------------------------------------------------------------------------------------------- Installation requirements OK Gorgone information ---------------------------------------------------------------------------------------------------------------------------------------- Gorgone user (GORGONE_USER) centreon-gorgone Gorgone group (GORGONE_GROUP) centreon-gorgone Gorgone configuration directory (GORGONE_ETC_DIR) /etc/centreon-gorgone Gorgone log directory (GORGONE_LOG_DIR) /var/log/centreon-gorgone Gorgone variable library directory (GORGONE_VARLIB_DIR) /var/lib/centreon-gorgone Gorgone cache directory (GORGONE_CACHE_DIR) /var/cache/centreon-gorgone Centreon user (CENTREON_USER) centreon Centreon home directory (CENTREON_HOME) /var/spool/centreon Centreon configuration directory (CENTREON_ETC_DIR) /etc/centreon Centreon service (CENTREON_SERVICE) centreon Engine user (ENGINE_USER) centreon-engine Engine group (ENGINE_GROUP) centreon-engine Broker user (BROKER_USER) centreon-broker Broker group (BROKER_GROUP) centreon-broker Everything looks good, proceed to installation? [y/N] >y
Le programme s'installe.
Install builded files ---------------------------------------------------------------------------------------------------------------------------------------- Copying files from '/tmp/centreon-setup' to final directory OK Install remaining files ---------------------------------------------------------------------------------------------------------------------------------------- Centreon configuration OK Centreon API configuration OK Sysconfig Gorgoned configuration OK Logrotate Gorgoned configuration OK Update groups memberships ---------------------------------------------------------------------------------------------------------------------------------------- Add user 'centreon-gorgone' to group 'centreon-broker' OK Add user 'centreon-gorgone' to group 'centreon-engine' OK Add user 'centreon-engine' to group 'centreon-gorgone' OK Add user 'centreon-broker' to group 'centreon-gorgone' OK Configure and restart services ---------------------------------------------------------------------------------------------------------------------------------------- Enabling service 'gorgoned' OK Reloading systemctl daemon OK Restarting service 'gorgoned' OK You're done! ---------------------------------------------------------------------------------------------------------------------------------------- Take a look at the documentation https://docs.centreon.com/current. Thanks for using Gorgone! Follow us on https://github.com/centreon/centreon-gorgone!
Continuons avec l'installation de Centreon-Web.