Ceci est une ancienne révision du document !
Table des matières
Dernière mise-à-jour : 2020/10/30 16:04
SER302 - Installation de Tomcat 8 et les serveurs associés
Contenu du Module
- SER302 - Installation de Tomcat 8 et les serveurs associés
- Contenu du Module
- Désactiver SELinux
- Tomcat et JDK
- Apache
- Présentation d'Apache
- Installation
- Testez le serveur apache avec telnet
- Coupler Tomcat et Apache
- MariaDB
- Présentation
- Installation
- Configuration
- OpenLDAP
- Présentation
- Installation
Désactiver SELinux
Afin d'éviter à ce que SELinux interfère avec l'installation et la configuration de Tomcat 8, éditez le fichier /etc/selinux/config afin de le désactiver :
[root@centos7 ~]# vi /etc/selinux/config [root@centos7 ~]# cat /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of three two values: # targeted - Targeted processes are protected, # minimum - Modification of targeted policy. Only selected processes are protected. # mls - Multi Level Security protection. SELINUXTYPE=targeted
Redémarrez ensuite le système :
[root@centos7 ~]# shutdown -r now
Tomcat et JDK
Pour installer Tomcat 8 sous CentOS 7, il convient de saisir les commandes suivantes :
[root@centos7 ~]# wget https://archive.apache.org/dist/tomcat/tomcat-8/v8.0.36/bin/apache-tomcat-8.0.36.tar.gz
ou
[root@centos7 ~]# wget https://www.dropbox.com/s/gho4ipq1k2ix58m/apache-tomcat-8.0.36.tar.gz
Puis :
[root@centos7 ~]# tar xvf apache-tomcat-8.0.36.tar.gz [root@centos7 ~]# mv apache-tomcat-8.0.36 /usr/tomcat8
Installez maintenant le JDK :
[root@centos7 ~]# yum install java-1.8.0-openjdk-devel
Vérifiez la présence du jre-1.8.0-openjdk dans le répertoire /usr/lib/jvm :
[root@centos7 ~]# ls -l /usr/lib/jvm/jre-1.8.0-openjdk* lrwxrwxrwx. 1 root root 35 Oct 28 18:23 /usr/lib/jvm/jre-1.8.0-openjdk -> /etc/alternatives/jre_1.8.0_openjdk lrwxrwxrwx. 1 root root 51 Oct 28 18:03 /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 -> java-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/jre
Ajoutez les trois lignes suivantes au fichier /etc/profile :
... PATH=$PATH:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 export PATH JAVA_HOME
Important : Vérifiez que la version du jre-1.8.0-openjdk dans le fichier /etc/profile est la même que dans le répertoire /usr/lib/jvm.
Rechargez le fichier /etc/profile et vérifiez les valeurs des deux variables précédemment déclarées :
[root@centos7 ~]# source /etc/profile [root@centos7 ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin [root@centos7 ~]# echo $JAVA_HOME /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64
Vérifiez ensuite la version de java :
[root@centos7 ~]# java -version openjdk version "1.8.0_232" OpenJDK Runtime Environment (build 1.8.0_232-b09) OpenJDK 64-Bit Server VM (build 25.232-b09, mixed mode)
Définissez maintenant la variable CATALINA_HOME dans le fichier /etc/profile :
... # Tomcat CATALINA_HOME="/usr/tomcat8" export CATALINA_HOME PATH=$PATH:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin JAVA_HOME=/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 export PATH JAVA_HOME
Rechargez /etc/profile :
[root@centos7 ~]# source /etc/profile [root@centos7 ~]# echo $CATALINA_HOME /usr/tomcat8
Démarrez maintenant Tomcat 8 :
[root@centos7 ~]# cd /usr/tomcat8/bin [root@centos7 bin]# ./startup.sh Using CATALINA_BASE: /usr/tomcat8 Using CATALINA_HOME: /usr/tomcat8 Using CATALINA_TMPDIR: /usr/tomcat8/temp Using JRE_HOME: /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 Using CLASSPATH: /usr/tomcat8/bin/bootstrap.jar:/usr/tomcat8/bin/tomcat-juli.jar Tomcat started.
Utilisez le navigateur de texte lynx pour tester Tomcat 8 :
[root@centos7 bin]# yum install lynx ... [root@centos7 bin]# lynx --dump http://localhost:8080 [1]Home [2]Documentation [3]Configuration [4]Examples [5]Wiki [6]Mailing Lists [7]Find Help Apache Tomcat/8.0.36 If you're seeing this, you've successfully installed Tomcat. Congratulations! [tomcat logo] Recommended Reading: ...
Apache
Présentation d'Apache
Un serveur web est une machine doté d'un logiciel serveur qui attend des requêtes de la part de machines clientes afin de leur livrer de documents de types différents.
En 1994 le développement du serveur web le plus connue à l'époque, le démon HTTP, a été arrêté suite au départ de la NCSA de son principal développeur, Rob McCool.
Au début de l'année 1995, un groupe de webmestres indépendants s'est mis en place sous la direction de Brian Behlendorf et Cliff Skolnick pour reprendre le travail sur ce démon. Ce projet a pris le nom Apache. En même temps la NCSA a repris son propre travail de développement sur son démon HTTP. L'arrivée dans le groupe Apache de deux personnes de la NCSA en tant que membres honoraires, Brandon Long et Beth Frank a permis la mise en commun des connaissances des deux groupes.
Le projet Apache est un projet de développement d'un serveur web libre pour les plateformes Unix et Windows™. La première version officielle, la 0.6.2 est sortie en avril 1995.
La Fondation Apache, créée en 1999 par l'équipe Apache, gère aujourd'hui non seulement le projet Apache mais aussi un grand nombre d'autres projets. La liste des projets de la Fondation peut être trouvée ici.
Apache est modulaire. Certains modules fondamentaux conditionnent comment Apache traite la question du multitraitement. Les modules multitraitements - MPM - Multi-Processing Modules - sont différents selon le système d'exploitation utilisé et la charge attendue.
- mpm-winnt - module propre à Windows™ qui utilise son support réseau natif,
- prefork - module propre à Unix et Linux qui implémente un serveur mono-tâche à duplication,
- perchild - module propre à Unix et Linux qui implémente un serveur autorisant des démons servant les requêtes à être assigner à plusieurs id utilisateurs,
- worker - module propre à Unix et Linux qui implémente un serveur hybride multi-tâche et multitraitement.
Ces modules sont compilés statiquement au binaire Apache et sont mutuellement exclusifs.
Installation
Sous CentOS 7, Apache n'est pas installé par défaut :
[root@centos7 bin]# cd ~ [root@centos7 ~]# rpm -qa | grep httpd [root@centos7 ~]# [root@centos7 ~]# yum install httpd
Le service n'est pas configuré pour démarrer automatiquement :
[root@centos7 ~]# systemctl status httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8)
Saisissez donc les commandes suivantes et vérifiez le résultat :
[root@centos7 ~]# systemctl enable httpd.service Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service. [root@centos7 ~]# systemctl start httpd.service [root@centos7 ~]# systemctl status httpd.service ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2019-10-28 19:02:22 CET; 5s ago Docs: man:httpd(8) man:apachectl(8) Main PID: 7427 (httpd) Status: "Processing requests..." CGroup: /system.slice/httpd.service ├─7427 /usr/sbin/httpd -DFOREGROUND ├─7455 /usr/sbin/httpd -DFOREGROUND ├─7456 /usr/sbin/httpd -DFOREGROUND ├─7457 /usr/sbin/httpd -DFOREGROUND ├─7458 /usr/sbin/httpd -DFOREGROUND └─7459 /usr/sbin/httpd -DFOREGROUND Oct 28 19:02:19 centos7.fenestros.loc systemd[1]: Starting The Apache HTTP Server... Oct 28 19:02:22 centos7.fenestros.loc systemd[1]: Started The Apache HTTP Server.
Testez le serveur apache avec telnet
Telnet n'est pas installé par défaut sous CentOS 7 :
[root@centos7 ~]# which telnet /usr/bin/which: no telnet in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin)
Installez donc telnet :
[root@centos7 ~]# yum install telnet
Testez maintenant le service Apache :
[root@centos7 ~]# telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'.
Tapez ensuite GET / :
GET / <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Apache HTTP Server Test Page powered by CentOS</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Bootstrap --> <link href="/noindex/css/bootstrap.min.css" rel="stylesheet"> <link rel="stylesheet" href="noindex/css/open-sans.css" type="text/css" /> <style type="text/css"><!-- body { font-family: "Open Sans", Helvetica, sans-serif; font-weight: 100; color: #ccc; background: rgba(10, 24, 55, 1); font-size: 16px; } h2, h3, h4 { ...
Pour voir la version d'Apache installée, utilisez la commande suivante :
[root@centos7 ~]# httpd -v Server version: Apache/2.4.6 (CentOS) Server built: Aug 8 2019 11:41:18
Coupler Tomcat et Apache
Le schéma suivant indique le couplage Tomcat/Apache :
Téléchargez le connecteur mod-jk pour Apache :
[root@centos7 ~]# wget http://apache.mirrors.ovh.net/ftp.apache.org/dist/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.46-src.tar.gz [root@centos7 ~]# tar xvf tomcat-connectors-1.2.46-src.tar.gz [root@centos7 ~]# cd tomcat-connectors-1.2.46-src/
Installez le binaire apxs inclut dans le paquet httpd-devel. Le binaire apxs est utilisé pour construire les modules d'Apache :
[root@centos7 tomcat-connectors-1.2.46-src]# yum install httpd-devel
Placez-vous dans le sous-répertoire native et lancez les commandes pour effectuer la compilation :
[root@centos7 tomcat-connectors-1.2.46-src]# cd native/ [root@centos7 native]# which apxs /bin/apxs [root@centos7 native]# ./configure --with-apxs=/bin/apxs ... [root@centos7 native]# make ... [root@centos7 native]# make install Making install in common make[1]: Entering directory `/root/tomcat-connectors-1.2.46-src/native/common' make[1]: Nothing to be done for `install'. make[1]: Leaving directory `/root/tomcat-connectors-1.2.46-src/native/common' Making install in apache-2.0 make[1]: Entering directory `/root/tomcat-connectors-1.2.46-src/native/apache-2.0' Installing files to Apache Modules Directory... /bin/apxs -i mod_jk.la /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_jk.la /usr/lib64/httpd/modules /usr/lib64/apr-1/build/libtool --mode=install install mod_jk.la /usr/lib64/httpd/modules/ libtool: install: install .libs/mod_jk.so /usr/lib64/httpd/modules/mod_jk.so libtool: install: install .libs/mod_jk.lai /usr/lib64/httpd/modules/mod_jk.la libtool: install: install .libs/mod_jk.a /usr/lib64/httpd/modules/mod_jk.a libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_jk.a libtool: install: ranlib /usr/lib64/httpd/modules/mod_jk.a libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin:/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin:/sbin" ldconfig -n /usr/lib64/httpd/modules ---------------------------------------------------------------------- Libraries have been installed in: /usr/lib64/httpd/modules If you ever happen to want to link against installed libraries in a given directory, LIBDIR, you must either use libtool, and specify the full pathname of the library, or use the `-LLIBDIR' flag during linking and do at least one of the following: - add LIBDIR to the `LD_LIBRARY_PATH' environment variable during execution - add LIBDIR to the `LD_RUN_PATH' environment variable during linking - use the `-Wl,-rpath -Wl,LIBDIR' linker flag - have your system administrator add LIBDIR to `/etc/ld.so.conf' See any operating system documentation about shared libraries for more information, such as the ld(1) and ld.so(8) manual pages. ---------------------------------------------------------------------- chmod 755 /usr/lib64/httpd/modules/mod_jk.so Please be sure to arrange /etc/httpd/conf/httpd.conf... make[1]: Leaving directory `/root/tomcat-connectors-1.2.46-src/native/apache-2.0' make[1]: Entering directory `/root/tomcat-connectors-1.2.46-src/native' make[2]: Entering directory `/root/tomcat-connectors-1.2.46-src/native' make[2]: Nothing to be done for `install-exec-am'. make[2]: Nothing to be done for `install-data-am'. make[2]: Leaving directory `/root/tomcat-connectors-1.2.46-src/native' make[1]: Leaving directory `/root/tomcat-connectors-1.2.46-src/native'
Modifiez ensuite le fichier /etc/httpd/conf/httpd.conf ainsi :
... ServerName www.i2tch.loc:80 ...
et ajoutez les directives suivantes à la fin du fichier afin de prendre en compte mod_jk et sa configuration :
... LoadModule jk_module modules/mod_jk.so JkWorkersFile conf/workers.properties JkLogFile logs/mod_jk.log JkLogLevel info JkMount /docs/* worker1 JkMount /docs worker1
Les différentes directives Apache utilisables avec mod_jk sont :
Directive | Description |
---|---|
JkWorkersFile | Spécifie le nom et l'emplacement du fichier de configuration du module nommé workers.properties par convention. Le chemin peut être absolu ou rélatif à l'installation d'Apache. |
JkWorkerProperty | L'utilisation de cette directive est mutuellement exclusive avec l'utilisation de la directive JkWorkersFile. Elle permet de définir les directives du fichier workers.properties directement dans le fichier httpd.conf sous la forme JkWorkerProperty <Directive> avec une directive par ligne. Chaque ligne doit donc commencer par JkWorkerProperty. |
JkLogFile | Spécifie le nom et l'emplacement du fichier de journalisation du module. Le chemin peut être absolu ou relatif à l'installation d'Apache. |
JkLogLevel | Spécifie le niveau de journalisation du module. Les valeurs ici peuvent être trace, debug, info, warn et error. Le fonctionnement est similaire à syslog dans la mesure où si la valeur est info alors tous les messages des niveaux info, warn et error seront journalisés. |
JkMount | Spécifie l'association d'un contexte d'application Tomcat avec un travailleur. Autrement dit, cette directive spécifie quelles sont les ressources d'une application Tomcat accessibles en passant par Apache. La syntaxe est JkMount <URL> <Nom du Travailleur>. |
JkUnMount | Spécifie une interdiction de redirection de requêtes vers une ressource d'une application Tomcat. La syntaxe est JkUnMount <URL> <Nom du Travailleur>. Notez que cette directive est prioritaire par rapport à la directive JkMount. |
JkAutoAlias | Spécifie un alias entre le répertoire des applications de Tomcat et le répertoire de publication des fichiers statiques d'Apache. De cette façon, les deux serveurs partagent un répertoire de publication unique. |
JkLogStampFormat | Spécifie le format de la date inscrite dans le fichier de journalisation du module en utilisant des séquences de contrôle, par exemple, JkLogStampFormat “[%a %b %d %H:%M:%S %Y]“. |
JkExtractSSL | Spécifie que le module peut transmettre les informations SSL vers le serveur Tomcat. |
JkHTTPSIndicator | Spécifie le nom de la variable Apache contenant l'indication SSL. |
JkCERTSIndicator | Spécifie le nom de la variable Apache contenant le certificat SSL. |
JkSESSIONIndicator | Spécifie le nom de la variable Apache contenant l'identifiant de session SSL. |
Modifiez ensuite le fichier /etc/hosts pour la prise en charge du nom de notre serveur :
[root@centos7 native]# vi /etc/hosts [root@centos7 native]# cat /etc/hosts 127.0.0.1 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 10.0.2.15 www.i2tch.loc
Créez ensuite le fichier /etc/httpd/conf/workers.properties :
[root@centos7 native]# cd ~ [root@centos7 ~]# vi /etc/httpd/conf/workers.properties [root@centos7 ~]# cat /etc/httpd/conf/workers.properties worker.list=worker1 worker.worker1.type=ajp13 worker.worker1.host=10.0.2.15 worker.worker1.port=8009
Vérifiez l'existence des lignes concernant le connecteur dans le fichier /usr/tomcat8/conf/server.xml :
[root@centos7 ~]# cat /usr/tomcat8/conf/server.xml | grep 8009 <!-- Define an AJP 1.3 Connector on port 8009 --> <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
Redémarrez ensuite les services httpd et tomcat8 :
[root@centos7 ~]# systemctl restart httpd.service [root@centos7 ~]# cd /usr/tomcat8/bin/ [root@centos7 bin]# ls bootstrap.jar catalina-tasks.xml configtest.bat digest.bat setclasspath.sh startup.bat tomcat-native.tar.gz version.bat catalina.bat commons-daemon.jar configtest.sh digest.sh shutdown.bat startup.sh tool-wrapper.bat version.sh catalina.sh commons-daemon-native.tar.gz daemon.sh setclasspath.bat shutdown.sh tomcat-juli.jar tool-wrapper.sh [root@centos7 ~]# cd /usr/tomcat8/bin/ [root@centos7 bin]# ./shutdown.sh Using CATALINA_BASE: /usr/tomcat8 Using CATALINA_HOME: /usr/tomcat8 Using CATALINA_TMPDIR: /usr/tomcat8/temp Using JRE_HOME: /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 Using CLASSPATH: /usr/tomcat8/bin/bootstrap.jar:/usr/tomcat8/bin/tomcat-juli.jar [root@centos7 bin]# ./startup.sh Using CATALINA_BASE: /usr/tomcat8 Using CATALINA_HOME: /usr/tomcat8 Using CATALINA_TMPDIR: /usr/tomcat8/temp Using JRE_HOME: /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 Using CLASSPATH: /usr/tomcat8/bin/bootstrap.jar:/usr/tomcat8/bin/tomcat-juli.jar Tomcat started.
Vérifiez maintenant le bon fonctionnement d'Apache et de Tomcat en consultant les liens suivants :
[root@centos7 bin]# lynx --dump http://www.i2tch.loc [root@centos7 bin]# lynx --dump http://www.i2tch.loc:8080 [root@centos7 bin]# lynx --dump http://www.i2tch.loc/docs/
Important : Notez qu'en consultant l'adresse http://www.i2tch.loc/docs/ vous obtenez la même page que lors de votre consultation de l'adresse http://www.i2tch.loc:8080. Ceci implique que le serveur Apache est maintenant un serveur frontal pour le serveur Tomcat 8.
Créer un Service Systemd pour Tomcat
Créez un utilisateur tomcat :
[root@centos7 ~]# useradd -M -s /bin/nologin -d /usr/tomcat8 tomcat
Naviguez à votre répertoire $CATALINA_HOME :
[root@centos7 ~]# cd $CATALINA_HOME [root@centos7 tomcat8]#
Modifiez les droits sur certains fichiers et répertoires :
[root@centos7 tomcat8]# chgrp -R tomcat conf [root@centos7 tomcat8]# chmod g+rwx conf [root@centos7 tomcat8]# chmod g+r conf/* [root@centos7 tomcat8]# chown -R tomcat logs/ temp/ webapps/ work/ [root@centos7 tomcat8]# chgrp -R tomcat bin [root@centos7 tomcat8]# chgrp -R tomcat lib [root@centos7 tomcat8]# chmod g+rwx bin [root@centos7 tomcat8]# chmod g+r bin/*
Créez le fichier de service /etc/systemd/system/tomcat.service :
[root@centos7 tomcat8]# vi /etc/systemd/system/tomcat.service [root@centos7 tomcat8]# cat /etc/systemd/system/tomcat.service # Systemd unit file for tomcat [Unit] Description=Apache Tomcat Web Application Container After=syslog.target network.target [Service] Type=forking Environment=JAVA_HOME="/usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64" Environment=CATALINA_PID=/usr/tomcat8/temp/tomcat.pid Environment=CATALINA_HOME=/usr/tomcat8/ Environment=CATALINA_BASE=/usr/tomcat8/ Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC' Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' ExecStart=/usr/tomcat8/bin/startup.sh ExecStop=/bin/kill -15 $MAINPID User=tomcat Group=tomcat [Install] WantedBy=multi-user.target
Redémarrez systemd :
[root@centos7 tomcat8]# systemctl daemon-reload
Arrêtez Tomcat :
[root@centos7 tomcat8]# cd bin [root@centos7 bin]# ./shutdown.sh Using CATALINA_BASE: /usr/tomcat8 Using CATALINA_HOME: /usr/tomcat8 Using CATALINA_TMPDIR: /usr/tomcat8/temp Using JRE_HOME: /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64 Using CLASSPATH: /usr/tomcat8/bin/bootstrap.jar:/usr/tomcat8/bin/tomcat-juli.jar
Testez le service tomcat :
[root@centos7 tomcat8]# systemctl start tomcat
Vérifiez que le Tomcat a démarré :
[root@centos7 bin]# systemctl start tomcat [root@centos7 bin]# ps aux | grep tomcat tomcat 20279 27.3 25.9 3118244 129632 ? Sl 10:58 0:02 /usr/lib/jvm/jre-1.8.0-openjdk-1.8.0.232.b09-0.el7_7.x86_64/bin/java -Djava.util.logging.config.file=/usr/tomcat8//conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Djdk.tls.ephemeralDHKeySize=2048 -Xms512M -Xmx1024M -server -XX:+UseParallelGC -Djava.endorsed.dirs=/usr/tomcat8//endorsed -classpath /usr/tomcat8//bin/bootstrap.jar:/usr/tomcat8//bin/tomcat-juli.jar -Dcatalina.base=/usr/tomcat8/ -Dcatalina.home=/usr/tomcat8/ -Djava.io.tmpdir=/usr/tomcat8//temp org.apache.catalina.startup.Bootstrap start root 20376 0.0 0.1 112712 968 pts/0 R+ 10:58 0:00 grep --color=auto tomcat
Dernièrement vérifiez que les serveur Tomcat est bien démarré sous la responsabilité de l'utilisateur tomcat :
[root@centos7 bin]# pgrep -u tomcat 20279
MariaDB
Présentation
MariaDB est un fork de MySQL et est inclut dans les dépôts de CentOS 7.
Installation
Pour installer MariaDB, utilisez yum :
[root@centos7 bin]# cd ~ [root@centos7 ~]# yum install mariadb mariadb-server
Ensuite démarrez votre serveur MariaDB :
[root@centos7 ~]# systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) Active: inactive (dead) [root@centos7 ~]# systemctl enable mariadb.service Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service. [root@centos7 ~]# systemctl start mariadb.service [root@centos7 ~]# systemctl status mariadb.service ● mariadb.service - MariaDB database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2017-04-27 13:44:02 CEST; 3s ago Process: 30380 ExecStartPost=/usr/libexec/mariadb-wait-ready $MAINPID (code=exited, status=0/SUCCESS) Process: 30295 ExecStartPre=/usr/libexec/mariadb-prepare-db-dir %n (code=exited, status=0/SUCCESS) Main PID: 30379 (mysqld_safe) CGroup: /system.slice/mariadb.service ├─30379 /bin/sh /usr/bin/mysqld_safe --basedir=/usr └─30536 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.l... Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: OK Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: To start mysqld at boot time you have to copy Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: support-files/mysql.server to the right place for your system Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: To do so, start the server, then issue the following commands: Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: '/usr/bin/mysqladmin' -u root password 'new-password' Apr 27 13:44:00 centos7.fenestros.loc mariadb-prepare-db-dir[30295]: '/usr/bin/mysqladmin' -u root -h centos7.fenestros.loc password 'new-password' Apr 27 13:44:00 centos7.fenestros.loc mysqld_safe[30379]: 170427 13:44:00 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'. Apr 27 13:44:00 centos7.fenestros.loc mysqld_safe[30379]: 170427 13:44:00 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql Apr 27 13:44:02 centos7.fenestros.loc systemd[1]: Started MariaDB database server.
Configuration
Lors de l'installation MariaDB n'a pas de mot de passe attribué à l'utilisateur root. Créez donc le mot de passe fenestros puis testez la connexion à MariaDB :
[root@centos7 ~]# mysqladmin -u root password fenestros [root@centos7 ~]# mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@centos7 ~]# mysql -uroot -p Enter password: fenestros Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 5.5.64-MariaDB MariaDB Server Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> exit Bye
OpenLDAP
Présentation
LDAP est une abréviation de Lighweight Directory Access Protocol. Comme son nom indique, LDAP est un service d'annuaire.
Un service d'annuaire est une base de données spécialisée optimisée pour la consultation. Certains services d'annuaire peuvent être locaux tandis que d'autres sont appelés distribués. Un bon exemple d'une service d'annuaire distribué est le DNS.
L'installation du serveur OpenLDAP ne peut être réussie que dans le cas où le support pour les bases de données BerkeleyDB soit installé au préalable.
Installation
Pour installer le serveur OpenLDAP, utilisez la commande yum :
[root@centos7 ~]# yum install openldap-servers openldap-clients openldap
Ensuite démarrez votre serveur OpenLDAP :
[root@centos7 ~]# systemctl status slapd.service ● slapd.service - OpenLDAP Server Daemon Loaded: loaded (/usr/lib/systemd/system/slapd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:slapd man:slapd-config man:slapd-hdb man:slapd-mdb file:///usr/share/doc/openldap-servers/guide.html [root@centos7 ~]# systemctl enable slapd.service Created symlink from /etc/systemd/system/multi-user.target.wants/slapd.service to /usr/lib/systemd/system/slapd.service. [root@centos7 ~]# systemctl start slapd.service [root@centos7 ~]# systemctl status slapd.service ● slapd.service - OpenLDAP Server Daemon Loaded: loaded (/usr/lib/systemd/system/slapd.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2017-04-27 13:47:27 CEST; 2s ago Docs: man:slapd man:slapd-config man:slapd-hdb man:slapd-mdb file:///usr/share/doc/openldap-servers/guide.html Process: 32228 ExecStart=/usr/sbin/slapd -u ldap -h ${SLAPD_URLS} $SLAPD_OPTIONS (code=exited, status=0/SUCCESS) Process: 32214 ExecStartPre=/usr/libexec/openldap/check-config.sh (code=exited, status=0/SUCCESS) Main PID: 32230 (slapd) CGroup: /system.slice/slapd.service └─32230 /usr/sbin/slapd -u ldap -h ldapi:/// ldap:/// Apr 27 13:47:27 centos7.fenestros.loc systemd[1]: Starting OpenLDAP Server Daemon... Apr 27 13:47:27 centos7.fenestros.loc runuser[32217]: pam_unix(runuser:session): session opened for user ldap by (uid=0) Apr 27 13:47:27 centos7.fenestros.loc slapd[32228]: @(#) $OpenLDAP: slapd 2.4.40 (Nov 6 2016 01:21:28) $ mockbuild@worker1.bsys.centos.org:/builddir/build/BUILD/openldap-2.4.40/openldap-2.4.4...rs/slapd Apr 27 13:47:27 centos7.fenestros.loc slapd[32230]: hdb_db_open: warning - no DB_CONFIG file found in directory /var/lib/ldap: (2). Expect poor performance for suffix "dc=my-domain,dc=com". Apr 27 13:47:27 centos7.fenestros.loc slapd[32230]: slapd starting Apr 27 13:47:27 centos7.fenestros.loc systemd[1]: Started OpenLDAP Server Daemon. Hint: Some lines were ellipsized, use -l to show in full.
<html>
Copyright © 2020 Hugh Norris.
</html>