Partie III. Réglages de base
Précédent ACCUEIL Suivant

III. RÉGLAGES DE BASE

3.1 - Paramétrer le système

Figure 1 - Fichier /etc/hosts

Fichier hosts
# vi /etc/sysctl.d/disable-ipv6.conf
  net.ipv6.conf.all.disable_ipv6 = 1
  net.ipv6.conf.default.disable_ipv6 = 1
# sysctl -p
# vi /etc/netconfig
  # udp6 tpi_clts v inet6 udp - - (Ligne à commenter)
  # tcp6 tpi_cots_org v inet6 tcp - - (Ligne à commenter)
# vi /etc/hosts
  # ::1 (Ligne à commenter)
# vi /etc/ssh/sshd_config
  AddressFamily inet
# vi /etc/sysconfig/chronyd
  OPTIONS="-4"
# yum update
# reboot
# yum install vim net-tools bash-completion wget curl lsof bind-utils mailx git \
  redhat-lsb zip unzip
# vi /usr/local/bin/numlock
  #!/bin/bash
  INITTY=/dev/tty[1-6]
  for tty in $INITTY; do
  setleds -D +num < $tty
  done
# chmod +x /usr/local/bin/numlock
# chmod +x /etc/rc.d/rc.local
# echo "/usr/local/bin/numlock" >> /etc/rc.d/rc.local
# systemctl start rc-local
# systemctl status rc-local
# yum install gcc gcc-c++ autoconf automake libxml2-devel kernel-devel \
  kernel-headers-`uname -r`

3.2 - Paramétrer SNMP

SNMP signifie Simple Network Management Protocol. Il s'agit d'un protocole réseau qui permet de gérer les équipements d'un réseau et de diagnostiquer les problèmes du réseau.

# vi /etc/snmpd/snmpd.conf
  agentAddress udp:161
  rocommunity public
  com2sec notConfigUser default public
  syslocation SMNet
  syscontact centreon@smnet.fr
# vi /etc/sysconfig/snmpd
  OPTIONS="-LS4d"
# systemctl daemon-reload
# systemctl restart snmpd

3.3 - Paramétrer MariaDB

Le paramétrage présenté ici est facultatif à l'exception des variables 'sql_mode' et 'open_files_limit'.

# vi /etc/my.cnf.d/client

Figure 1 - /etc/my.cnf.d/client.cnf

client.cnf
# vi /etc/my.cnf.d/mysql-clients.cnf

Figure 2 - /etc/my.cnf.d/mysql-clients.cnf

mysql-clients.cnf
# vi /etc/my.cnf.d/server.cnf

Figure 3 - /etc/my.cnf.d/server.cnf

server.cnf
# mkdir /var/log/mariadb
# chown mysql:mysql /var/log/mariadb
# systemctl daemon-reload
# systemctl restart mariadb
# mysql -u root -p mysql
  [mysql]> select user,host,password,plugin from user;
  [mysql]> SET PASSWORD FOR 'root'@'localhost'=PASSWORD('votre mot de passe');
  [mysql]> SET PASSWORD FOR 'root'@'centreon'=PASSWORD('votre mot de passe');
  [mysql]> SET PASSWORD FOR 'root'@'127.0.0.1'=PASSWORD('votre mot de passe');
  [mysql]> delete from user where password="";
  [mysql]> flush privileges;
  [mysql]> drop database test;
  [mysql]> show variables like 'sql_mode';

Figure 4 - 'sql_mode'

sql_mode
  [mysql]> show global variables like 'open_files_limit';

Figure 5 - 'open_files_limit'

open_files_limit
  [mysql]> quit

3.4 - Paramétrer Php 7.2 et Httpd 2.4

# scl enable rh-php72 bash
# scl enable httpd24 bash
# which php
# vi /etc/profile.d/rh-php72.sh

Figure 6 - rh-php72

rh-php72
# which httpd
# vi /etc/profile.d/httpd24.sh

Figure 7 - httpd24

httpd24
# ln -s /opt/rh/httpd24/root/etc/httpd/ /etc/
# ln -s /opt/rh/httpd24/root/var/www/ /var/
# ln -s /etc/opt/rh/rh-php72/php.ini /etc/
# ln -s /etc/opt/rh/rh-php72/php-fpm.conf /etc/
# ln -s /etc/opt/rh/rh-php72/pear.conf /etc/
# ln -s /opt/rh/rh-php72/root/usr/bin/php /bin/
# ln -s /opt/rh/httpd24/root/usr/sbin/httpd /sbin/
# vi /etc/httpd/conf/httpd.conf
  Ligne n° 86 : ServerAdmin centreon@smnet.fr
  Ligne n° 95 : ServerName centreon.smnet.fr
  Ligne n° 349 : ServerTokens Prod
  Ligne n° 350 : KeepAlive on
  Ligne n° 351 : RequestHeader unset Proxy early
# systemctl restart httpd24-httpd
# vi /etc/opt/rh/rh-php72/php.ini
  Ligne n° 197 : short_opoen_tag = On
  Ligne n° 374 : expose_php = Off
  Ligne n° 404 : memory_limit = 128M
  Ligne n° 672 : post_max_size = 128M
  Ligne n° 691 : default_charset = "UTF-8"
  Ligne n° 825 : upload_max_filesize = 20M
  Ligne n° 902 : date.timezone = Europe/Paris
# cp /etc/opt/rh/rh-php72/php.ini \
  /opt/rh/rh-php72/register.content/etc/opt/rh/rh-php72/php.ini
# systemctl restart httpd24-httpd

3.5 - Paramétrer Postfix

Si vous possédez un hébergement mutualisé chez OVH, vous pouvez utiliser un serveur de messagerie local et paramétrer OVH en "relayhost" pour envoyer des mails.

# yum install postfix cyrus-sasl cyrus-sasl-plain mailx
# vi /etc/hosts
  127.0.1.1 smnet.fr
# mv /etc/postfix/main.cf /etc/postfix/main.cf.origin
# cd /etc/postfix
# grep -h -v '^[[:space:]]*\#' main.cf.origin | grep -v '^[[:space:]]*$' > main.cf
# vi /etc/postfix/main.cf

Figure 8 - main.cf

main.cf
# vi /etc/postfix/sasl_passwd
  [ssl0.ovh.net]:587 centreon@smnet.fr:<mot de passe>
# vi /etc/postfix/canonical
  root@smnet.fr centreon@smnet.fr
  utilisateur@smnet.fr centreon@smnet.fr
# postmap /etc/postfix/sasl_passwd
# postmap /etc/postfix/canonical
# vi /etc/aliases
  root : centreon@smnet.fr
# newaliases
# systemctl start postfix
# systemctl enable postfix
# echo "Test mail" | mail -s "Test Postfix sur Centreon" centreon@smnet.fr
# cat /var/log/maillog
# postsuper -d ALL

Auteurs : Eddy et Stéphane Maas / 2013-2023
Précédent ACCUEIL Suivant