GNU/Linux >> Tutoriels Linux >  >> OpenSuse

Comment installer Apache, MariaDB, PHP7 (LAMP) sur openSUSE Leap 15.3

Dans ce tutoriel, nous vous expliquerons comment installer la pile LAMP sur la dernière version d'openSUSE. Permettez-moi de vous rappeler que LAMP est une combinaison des mots Linux Apache MySQL et Php.

Etape 1 :mettez à jour votre logiciel

dans cette étape, nous mettrons à jour le référentiel et les packages du système, la commande nécessaire est

zypper up

Étape 2 :Installer le serveur Web Apache

on le fait avec :

zypper in apache2

Par défaut, Apache ne démarre pas automatiquement après l'installation. Vous pouvez le démarrer avec :

systemctl start apache2


Et activez le démarrage automatique au démarrage avec :

systemctl enable apache2

Vérifiez son état :

stemctl status apache

unixcop-opensuse:~ # systemctl status apache2
● apache2.service - The Apache Webserver
     Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-09-22 06:12:58 EDT; 7s ago
   Main PID: 17278 (httpd-prefork)
     Status: "Processing requests..."
      Tasks: 6
     CGroup: /system.slice/apache2.service
             ├─17278 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17287 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17288 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17290 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             ├─17291 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>
             └─17292 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/a>

Sep 22 06:12:58 unixcop-opensuse systemd[1]: Starting The Apache Webserver...
Sep 22 06:12:58 unixcop-opensuse start_apache2[17278]: AH00557: httpd-prefork: apr_sockaddr_info_get() failed for unixcop-opensuse
Sep 22 06:12:58 unixcop-opensuse start_apache2[17278]: AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 1>
Sep 22 06:12:58 unixcop-opensuse systemd[1]: Started The Apache Webserver.

Vérifiez la version d'Apache avec :

apachectl -v

La sortie est :

unixcop-opensuse:~ # apachectl   -v
Server version: Apache/2.4.43 (Linux/SUSE)
Server built:   2021-08-13 07:09:48.000000000 +0000


Créez votre page d'accueil First Welcome Apache

vi /srv/www/htdocs/index.html

Vous pouvez également utiliser l'éditeur nano à la place si vous n'êtes pas familier avec vi et ajouter

<html> 
<body> 
  <h1> It Unixcop home page at Opensuse !</h1> 
</body> 
</html>

Enregistrer et quitter

Configurer le pare-feu pour autoriser le service apache

firewall-cmd  --permanent  --zone=public --add-service=http
firewall-cmd  --permanent  --zone=public --add-service=https
firewall-cmd  --reload

Essayez maintenant d'atteindre la page d'accueil avec httpd://ip

2-Installer MariaDB sur Opensuse

Pour installer MariaDB sur OpenSUSE, veuillez suivre les instructions ci-dessous.

zypper install mariadb mariadb-client mariadb-tools
You have just installed MariaDB server for the first time.

You can start it via:
 systemctl start mariadb
or
 rcmysql start

During the first start, empty database will be created for you automatically.

PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER!
To do so, start the server and run the following commands:

'/usr/bin/mysqladmin' -u root password 'new-password'
'/usr/bin/mysqladmin' -u root -h <hostname> password 'new-password'

Alternatively you can run:
'/usr/bin/mysql_secure_installation'

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.


Setez le mot de passe racine Mysql

Vérifiez d'abord si MySQL/MariaDB est activé et en cours d'exécution, alors exécutez cette commande, puis faites cette commande

mysql_secure_installation

Se connecter à Mariadb

unixcop-opensuse:~ # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.5.12-MariaDB MariaDB package

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)]> create  database   test;
Query OK, 1 row affected (0.001 sec)

Étape 4 :Installer PHP

Comment installer php dans Opensuse 15.3

Comme ça

 zypper install php7 php7-mysql apache2-mod_php7

Testez maintenant les informations de la page PHP

Éditez avec vi ou nano /srv/www/htdocs/info.php , et ajoutez

<?php phpinfo(); ?>

enregistrer et quitter

Activer les modules Php et redémarrer Apache

a2enmod php7

systemctl restart apache2

Vérifiez maintenant le http://ip/info.php

Vous ajoutez des bibliothèques PHP supplémentaires si vous le souhaitez

php7-xmlreader php7-zip php7-pdo php7-gd php7-json php7-mysql php7-mbstring php7-openssl

Étape 5 :Installer phpMyAdmin

Pour ce chapitre, il ne fait pas vraiment partie de LAMP, mais reste nécessaire pour les débutants pour gérer les bases de données via une interface graphique,

Comment installer phpMyAdmin sur Opensuse 15.3

zypper install phpMyAdmin

Redémarrez Apache

systemctl restart apache2

Join  phpMyAdmin console  http://IP/phpMyAdmin



OpenSuse
  1. Comment installer Mongodb 5 dans Opensuse Leap 15.3

  2. Comment installer Mysql Server 8 sur OpenSUSE Leap 15.3

  3. Comment installer et configurer Redis 6 sur OpenSUSE Leap 15.3

  4. Comment configurer Opencart avec LAMP (PHP, Apache, Mariadb) sur OpenSUSE Leap 15.3

  5. Comment installer et configurer PHP et Apache (pile LAMP) sur OpenSUSE Leap 15.3

Comment installer TeamViewer 12 sur openSUSE Leap 42.2

Comment installer Dropbox sur openSUSE Leap 42.2

Comment installer LAMP Stack (Apache, MariaDB, PHP7.1) sur Ubuntu 17.10

Comment installer le serveur LAMP sur CentOS 8

Comment installer RabbitMQ dans OpenSUSE Leap 15.3

Comment installer Google Chrome sur openSUSE Leap 15