GNU/Linux >> LINUX-Kenntnisse >  >> Cent OS

So installieren Sie LAMP Server unter RHEL 8 / CentOS 8 Linux

Der LAMP-Server ist die Grundlage des Linux-Webhostings. Wenn Sie einen LAMP-Stack zum Hosten Ihrer Website einrichten möchten, erhalten Sie in diesem Leitfaden die erforderlichen Informationen zu den ersten Schritten mit LAMP auf einem RHEL 8-/CentOS 8-Linux-Server.

In diesem Tutorial lernen Sie:

  • So installieren Sie alle LAMP-Voraussetzungspakete unter RHEL 8/CentOS 8.
  • So sichern Sie die MariaDB-Datenbank.
  • So starten Sie httpd- und MariaDB-Dienste.
  • Wie man HTTP- und HTTPS-Firewall-Ports öffnet.

LAMP-Stack-Server-Installation auf RHEL 8 / CentOS 8.

Softwareanforderungen und verwendete Konventionen

Softwareanforderungen und Linux-Befehlszeilenkonventionen
Kategorie Anforderungen, Konventionen oder verwendete Softwareversion
System RHEL 8 / CentOS 8
Software MariaDB Server 10.3.10, PHP 7.2.11-1, Apache/2.4.35 (Red Hat Enterprise Linux)
Andere Privilegierter Zugriff auf Ihr Linux-System als root oder über sudo Befehl.
Konventionen # – erfordert, dass bestimmte Linux-Befehle mit Root-Rechten ausgeführt werden, entweder direkt als Root-Benutzer oder durch Verwendung von sudo Befehl
$ – erfordert, dass bestimmte Linux-Befehle als normaler, nicht privilegierter Benutzer ausgeführt werden

Schritt-für-Schritt-Anleitung zur Installation von LAMP Server auf RHEL 8 / CentOS 8 Linux

  1. Alle Voraussetzungen installieren. Der folgende Befehl installiert alle Paketvoraussetzungen und Tools, die für die LAMP-Installation erforderlich sind:
    # dnf install php-mysqlnd php-fpm mariadb-server httpd
    
  2. Öffnen Sie HTTP- und optional HTTPS-Port 80 und 443 auf Ihrer Firewall:
    # firewall-cmd --permanent --zone=public --add-service=http 
    # firewall-cmd --permanent --zone=public --add-service=https
    # firewall-cmd --reload
    
  3. Starten Sie sowohl den Apache-Webserver als auch die MariaDB-Dienste:
    # systemctl start mariadb
    # systemctl start httpd
    

    Aktivieren Sie MariaDB und httpd, um nach dem Systemneustart zu starten:

    # systemctl enable mariadb
    # systemctl enable httpd
    
  4. Sichern Sie Ihre MariaDB-Installation und legen Sie das Root-Passwort fest:
    # mysql_secure_installation
    
  5. Bestätigen Sie die Installation des LAMP-Servers. Erstellen Sie eine Datei namens info.php innerhalb von /var/www/html/ Verzeichnis mit folgendem Inhalt:
    <?php phpinfo(); ?>
    
  6. Berechtigungen ändern und Datei-SELinux-Sicherheitskontext ändern:

    # chown -R apache:apache /var/www/html/*
    # chcon -t httpd_sys_rw_content_t /var/www/html/ -R
    
  7. Navigieren Sie in Ihrem Browser zu http://localhost/info.php URL und bestätigen Sie die LAMP-Installation.
  8. Installieren Sie zusätzliche PHP-Module. Bisher haben wir nur einen Bare-Bones-LAMP-Stack installiert. Abhängig von der Anwendung, die Sie verwenden werden, müssen Sie möglicherweise auch zusätzliche PHP-Module installieren. Der folgende Befehl könnte Ihnen einige Hinweise geben:
    # 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)
    

    Um ein zusätzliches Paket zu installieren, führen Sie Folgendes aus:

    # dnf install PACKAGENAME
    

    Sobald das Paket installiert ist, laden Sie httpd neu Dienst:

    # systemctl reload httpd
    
  9. Alles erledigt.


Cent OS
  1. So installieren oder aktualisieren Sie auf PHP 7 auf CentOS 7 Linux Server

  2. So installieren Sie PHP 7.4 / 7.3 / 7.2 unter CentOS 7 / RHEL 7 und CentOS 6 / RHEL 6

  3. So installieren Sie Apache, MySQL, PHP (LAMP) unter CentOS/RHEL 7

  4. So installieren Sie PHP 8 unter CentOS 8 Linux

  5. So installieren Sie LAMP unter CentOS 7

So installieren Sie PHP 7.4 unter CentOS 8 / RHEL 8

So installieren Sie Linux, Apache, MariaDB, PHP (LAMP Stack) unter CentOS 7 / RHEL 7

So installieren Sie Linux, Apache, MariaDB, PHP (LAMP Stack) unter CentOS 8 / RHEL 8

So installieren Sie die GUI auf CentOS 8 / RHEL 8 Minimal Linux Server

So installieren Sie PHP 7.4 unter CentOS 8 | RHEL8

So installieren Sie LAMP (Linux Apache, MariaDB, PHP) unter CentOS 7