GNU/Linux >> LINUX-Kenntnisse >  >> OpenSuse

So installieren Sie Apache, MariaDB, PHP7 (LAMP) auf openSUSE Leap 15.3

In diesem Tutorial erklären wir Ihnen, wie Sie den LAMP-Stack auf der neuesten openSUSE-Version installieren. Lassen Sie mich nur auffrischen, dass LAMP eine Kombination aus den Wörtern Linux Apache MySQL und Php ist.

Schritt 1:Aktualisieren Sie Ihre Software

In diesem Schritt werden wir das Repository und die Pakete des Systems aktualisieren, der benötigte Befehl ist

zypper up

Schritt 2:Apache-Webserver installieren

wir machen es mit:

zypper in apache2

Standardmäßig wird Apache nach der Installation nicht automatisch gestartet. Sie können es starten mit:

systemctl start apache2


Und aktivieren Sie den automatischen Start beim Booten mit :

systemctl enable apache2

Status prüfen:

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.

Überprüfen Sie die Apache-Version mit :

apachectl -v

Ausgabe ist:

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


Erstellen Sie Ihre First Welcome Apache-Startseite

vi /srv/www/htdocs/index.html

Sie können stattdessen auch den Nano-Editor verwenden, wenn Sie mit vi nicht vertraut sind, und

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

Speichern und beenden

Konfigurieren Sie die Firewall so, dass sie den Apache-Dienst zulässt

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

Versuchen Sie nun mit httpd://ip

die Startseite zu erreichen

2-Installieren Sie MariaDB auf Opensuse

Um MariaDB auf OpenSUSE zu installieren, befolgen Sie bitte die nachstehenden Anweisungen.

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.


Legen Sie das Mysql-Root-Passwort fest

Überprüfen Sie zuerst, ob MySQL/MariaDB aktiviert ist und ausgeführt wird, führen Sie also diesen Befehl aus, und führen Sie dann diesen Befehl aus

mysql_secure_installation

Bei Mariadb anmelden

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)

Schritt 4:Installieren Sie PHP

So installieren Sie PHP in Opensuse 15.3

So

 zypper install php7 php7-mysql apache2-mod_php7

Jetzt PHP-Seiteninfo testen

Bearbeiten Sie mit vi oder nano /srv/www/htdocs/info.php und fügen Sie

hinzu

<?php phpinfo(); ?>

speichern und beenden

Aktivieren Sie Php-Module und starten Sie Apache neu

a2enmod php7

systemctl restart apache2

Überprüfen Sie nun die http://ip/info.php

Wenn Sie möchten, fügen Sie einige zusätzliche PHP-Bibliotheken hinzu

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

Schritt 5:Installieren Sie phpMyAdmin

Für dieses Kapitel ist es nicht wirklich Teil von LAMP, wird aber dennoch für Anfänger benötigt, um die Datenbanken über eine GUI-Oberfläche zu verwalten,

So installieren Sie phpMyAdmin unter Opensuse 15.3

zypper install phpMyAdmin

Starten Sie Apache neu

systemctl restart apache2

Join  phpMyAdmin console  http://IP/phpMyAdmin


bei
OpenSuse
  1. So installieren Sie Mongodb 5 in Opensuse Leap 15.3

  2. So installieren Sie Mysql Server 8 auf OpenSUSE Leap 15.3

  3. So installieren und konfigurieren Sie Redis 6 unter OpenSUSE Leap 15.3

  4. So installieren Sie Erlang auf Opensuse Leap 15.3

  5. So installieren Sie Java 17 in OpenSUSE Leap 15.3

So installieren Sie TeamViewer 12 auf openSUSE Leap 42.2

So installieren Sie Dropbox auf openSUSE Leap 42.2

So installieren Sie LAMP Stack (Apache, MariaDB, PHP7.1) unter Ubuntu 17.10

So installieren Sie LAMP Server unter CentOS 8

So installieren Sie RabbitMQ in OpenSUSE Leap 15.3

So installieren Sie Google Chrome auf openSUSE Leap 15