GNU/Linux >> Linux Esercitazione >  >> Cent OS

Come installare il server LAMP su RHEL 8 / CentOS 8 Linux

Il server LAMP è la base del web hosting Linux. Se stai cercando di configurare uno stack LAMP per ospitare il tuo sito Web, questa guida ti fornirà le informazioni necessarie su come iniziare a utilizzare LAMP sul server Linux RHEL 8 / CentOS 8.

In questo tutorial imparerai:

  • Come installare tutti i pacchetti di prerequisiti LAMP su RHEL 8 / CentOS 8.
  • Come proteggere il database MariaDB.
  • Come avviare i servizi httpd e MariaDB.
  • Come aprire le porte del firewall HTTP e HTTPS.

Installazione del server stack LAMP su RHEL 8 / CentOS 8.

Requisiti e convenzioni software utilizzati

Requisiti software e convenzioni della riga di comando Linux
Categoria Requisiti, convenzioni o versione del software utilizzata
Sistema RHEL 8 / CentOS 8
Software MariaDB Server 10.3.10, PHP 7.2.11-1, Apache/2.4.35 (Red Hat Enterprise Linux)
Altro Accesso privilegiato al tuo sistema Linux come root o tramite sudo comando.
Convenzioni # – richiede che i comandi linux dati vengano eseguiti con i privilegi di root direttamente come utente root o usando sudo comando
$ – richiede che i comandi linux dati vengano eseguiti come un normale utente non privilegiato

Come installare LAMP Server su RHEL 8 / CentOS 8 Linux istruzioni passo passo

  1. Installa tutti i prerequisiti. Il comando seguente installerà tutti i prerequisiti del pacchetto e gli strumenti necessari per eseguire l'installazione di LAMP:
    # dnf install php-mysqlnd php-fpm mariadb-server httpd
    
  2. Apri HTTP e opzionalmente le porte HTTPS 80 e 443 sul firewall:
    # firewall-cmd --permanent --zone=public --add-service=http 
    # firewall-cmd --permanent --zone=public --add-service=https
    # firewall-cmd --reload
    
  3. Avvia sia il server web Apache che i servizi MariaDB:
    # systemctl start mariadb
    # systemctl start httpd
    

    Abilita MariaDB e httpd per l'avvio dopo il riavvio del sistema:

    # systemctl enable mariadb
    # systemctl enable httpd
    
  4. Proteggi la tua installazione di MariaDB e imposta la password di root:
    # mysql_secure_installation
    
  5. Conferma l'installazione del server LAMP. Crea un file chiamato info.php all'interno del /var/www/html/ directory con il seguente contenuto:
    <?php phpinfo(); ?>
    
  6. modifica i permessi e cambia il contesto di sicurezza di SELinux del file:

    # chown -R apache:apache /var/www/html/*
    # chcon -t httpd_sys_rw_content_t /var/www/html/ -R
    
  7. Naviga con il tuo browser su http://localhost/info.php URL e conferma l'installazione della LAMP.
  8. Installa moduli PHP aggiuntivi. Finora abbiamo appena installato uno stack LAMP barebone. A seconda dell'applicazione che intendi utilizzare, potresti anche dover installare moduli PHP aggiuntivi. Il comando seguente potrebbe fornirti alcuni suggerimenti:
    # dnf search php-
    
    php-gd.x86_64 : A module for PHP applications for using the gd graphics library
    php-fpm.x86_64 : PHP FastCGI Process Manager
    php-pdo.x86_64 : A database access abstraction module for PHP applications
    php-gmp.x86_64 : A module for PHP applications for using the GNU MP library
    php-dbg.x86_64 : The interactive PHP debugger
    php-pdo.x86_64 : A database access abstraction module for PHP applications
    php-xml.x86_64 : A module for PHP applications which use XML
    php-fpm.x86_64 : PHP FastCGI Process Manager
    php-cli.x86_64 : Command-line interface for PHP
    php-dba.x86_64 : A database abstraction layer module for PHP applications
    php-soap.x86_64 : A module for PHP applications that use the SOAP protocol
    php-snmp.x86_64 : A module for PHP applications that query SNMP-managed devices
    php-ldap.x86_64 : A module for PHP applications that use LDAP
    php-pear.noarch : PHP Extension and Application Repository framework
    php-intl.x86_64 : Internationalization extension for PHP applications
    php-json.x86_64 : JavaScript Object Notation extension for PHP
    php-odbc.x86_64 : A module for PHP applications that use ODBC databases
    php-devel.x86_64 : Files needed for building PHP extensions
    php-pgsql.x86_64 : A PostgreSQL database module for PHP
    php-common.x86_64 : Common files for PHP
    php-common.x86_64 : Common files for PHP
    php-recode.x86_64 : A module for PHP applications for using the recode library
    php-bcmath.x86_64 : A module for PHP applications for using the bcmath library
    php-xmlrpc.x86_64 : A module for PHP applications which use the XML-RPC protocol
    php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
    php-enchant.x86_64 : Enchant spelling extension for PHP applications
    php-process.x86_64 : Modules for PHP script using system process interfaces
    php-mysqlnd.x86_64 : A module for PHP applications that use MySQL databases
    php-opcache.x86_64 : The Zend OPcache
    php-mbstring.x86_64 : A module for PHP applications which need multi-byte string handling
    php-pecl-zip.x86_64 : A ZIP archive management extension
    php-embedded.x86_64 : PHP library for embedding in applications
    php-pecl-apcu.x86_64 : APC User Cache
    php-pecl-apcu-devel.x86_64 : APCu developer files (header)
    

    Per installare un pacchetto aggiuntivo eseguire:

    # dnf install PACKAGENAME
    

    Una volta installato il pacchetto, ricaricare httpd servizio:

    # systemctl reload httpd
    
  9. Tutto fatto.


Cent OS
  1. Come installare il server DNS su RHEL 8 / CentOS 8 Linux

  2. Come installare o aggiornare a PHP 7 su CentOS 7 Linux Server

  3. Come installare PHP 7.4/7.3/7.2 su CentOS 7/RHEL 7 e CentOS 6/RHEL 6

  4. Come installare PHP 7.4 / 7.3 su CentOS 8 / RHEL 8

  5. Come installare PHP 8 su CentOS 8 Linux

Come installare PHP 7.4 su CentOS 8 / RHEL 8

Come installare Linux, Apache, MariaDB, PHP (stack LAMP) su CentOS 7 / RHEL 7

Come installare Linux, Apache, MariaDB, PHP (stack LAMP) su CentOS 8 / RHEL 8

Come installare la GUI su CentOS 8 / RHEL 8 Server Linux minimo

Come installare PHP 7.4 su CentOS 8 | RHEL 8

Come installare LAMP (Linux Apache, MariaDB, PHP) su CentOS 7