GNU/Linux >> Linux Esercitazione >  >> OpenSuse

Come installare Apache, MariaDB, PHP7 (LAMP) su openSUSE Leap 15.3

In questo tutorial, ti spiegheremo come installare lo stack LAMP sull'ultima versione di openSUSE. Lascia che ti rinfreschi la mente sul fatto che LAMP è una combinazione delle parole Linux Apache MySQL e Php.

Fase 1:aggiorna il tuo software

in questo passaggio aggiorneremo il repository e i pacchetti del sistema, il comando necessario è

zypper up

Passaggio 2:installa il server Web Apache

lo facciamo con :

zypper in apache2

Per impostazione predefinita, Apache non si avvierà automaticamente dopo l'installazione. Puoi iniziare con:

systemctl start apache2


E attiva l'avvio automatico all'avvio con :

systemctl enable apache2

Verifica il suo stato:

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.

Controlla la versione di Apache con :

apachectl -v

L'output è:

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


Crea la tua home page di First Welcome Apache

vi /srv/www/htdocs/index.html

Inoltre puoi usare nano editor se non hai familiarità con vi e aggiungere

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

Salva ed esci

Configura il firewall per consentire il servizio Apache

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

Ora prova a raggiungere la home page con httpd://ip

2-Installa MariaDB suOpensuse

Per installare MariaDB su OpenSUSE , segui le istruzioni seguenti.

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.


Set la password principale di MySQL

Controlla prima se MySQL/MariaDB è abilitato e in esecuzione, quindi esegui questo comando, quindi esegui questo comando

mysql_secure_installation

Accedi a 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)

Fase 4:Installa PHP

Come installare php in Opensuse 15.3

Così

 zypper install php7 php7-mysql apache2-mod_php7

Ora prova le informazioni sulla pagina PHP

Modifica con vi o nano /srv/www/htdocs/info.php e aggiungi

<?php phpinfo(); ?>

salva ed esci

Abilita i moduli Php e riavvia Apache

a2enmod php7

systemctl restart apache2

Controlla ora il http://ip/info.php

Aggiungi alcune librerie PHP extra, se lo desideri

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

Fase 5:Installa phpMyAdmin

Per questo capitolo, non fa realmente parte di LAMP, ma è comunque necessario ai principianti per gestire i database tramite un'interfaccia GUI,

Come installare phpMyAdmin su Opensuse 15.3

zypper install phpMyAdmin

Riavvia Apache

systemctl restart apache2

Join  phpMyAdmin console  http://IP/phpMyAdmin



OpenSuse
  1. Come installare Mongodb 5 in Opensuse Leap 15.3

  2. Come installare Mysql Server 8 su OpenSUSE Leap 15.3

  3. Come installare e configurare Redis 6 su OpenSUSE Leap 15.3

  4. Come installare Erlang su Opensuse Leap 15.3

  5. Come installare Java 17 in OpenSUSE Leap 15.3

Come installare TeamViewer 12 su openSUSE Leap 42.2

Come installare Dropbox su openSUSE Leap 42.2

Come installare lo stack LAMP (Apache, MariaDB, PHP7.1) su Ubuntu 17.10

Come installare il server LAMP su CentOS 8

Come installare RabbitMQ in OpenSUSE Leap 15.3

Come installare Google Chrome su openSUSE Leap 15