GNU/Linux >> LINUX-Kenntnisse >  >> AlmaLinux

So installieren Sie LAMP auf Manjaro 20

In diesem Tutorial zeigen wir Ihnen, wie Sie LAMP auf Manjaro 20 installieren. Für diejenigen unter Ihnen, die es nicht wussten, LAMP steht für Linux, Apache, MySQL/MariaDB, PHP oder Perl oder Python. Alle Komponenten sind kostenlose Open-Source-Software und die Kombination eignet sich zum Erstellen dynamischer Webseiten. Der LAMP-Stack ist eine der beliebtesten Serverkonfigurationen der Welt.

Dieser Artikel geht davon aus, dass Sie zumindest über Grundkenntnisse in Linux verfügen, wissen, wie man die Shell verwendet, und vor allem, dass Sie Ihre Website auf Ihrem eigenen VPS hosten. Die Installation ist recht einfach und setzt Sie voraus im Root-Konto ausgeführt werden, wenn nicht, müssen Sie möglicherweise 'sudo hinzufügen ‘ zu den Befehlen, um Root-Rechte zu erhalten. Ich zeige Ihnen Schritt für Schritt die Installation von LAMP Stack auf einem Manjaro 20 (Nibia).

Voraussetzungen

  • Ein Server oder Desktop, auf dem eines der folgenden Betriebssysteme ausgeführt wird:Manjaro oder Arch Linux.
  • Es wird empfohlen, dass Sie eine neue Betriebssysteminstallation verwenden, um potenziellen Problemen vorzubeugen.
  • SSH-Zugriff auf den Server (oder öffnen Sie einfach das Terminal, wenn Sie sich auf einem Desktop befinden).
  • Ein non-root sudo user oder Zugriff auf den root user . Wir empfehlen, als non-root sudo user zu agieren , da Sie Ihr System beschädigen können, wenn Sie als Root nicht aufpassen.

Installieren Sie LAMP auf Manjaro 20 Nibia

Schritt 1. Bevor Sie das folgende Tutorial ausführen, vergewissern Sie sich, dass unser System auf dem neuesten Stand ist:

sudo pacman -Syu

Schritt 2. Apache installieren.

Lassen Sie uns den Apache-Webserver mit dem folgenden Befehl installieren:

sudo pacman -S apache

Öffnen Sie nach Abschluss der Installation die Apache-Konfigurationsdatei, die sich unter /etc/httpd/conf/httpd.conf befindet , suchen und kommentieren Sie die folgende Zeile:
# LoadModule unique_id_module modules/mod_unique_id.so

Wir können jetzt den Apache-Server mit dem folgenden Befehl aktivieren und starten:

sudo systemctl enable httpd
sudo systemctl restart httpd

Schritt 3. Installieren Sie MySQL.

Führen Sie den folgenden Befehl aus, um MySQL Server auf Manjaro zu installieren:

sudo pacman -S mysql

Wenn Sie fertig sind, beginnen Sie mit der Initialisierung des MySQL-Datenverzeichnisses mit dem folgenden Befehl:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Als nächstes aktivieren und starten Sie es mit den folgenden Befehlen:

sudo systemctl enable mysqld
sudo systemctl restart mysqld

Standardmäßig ist MySQL nicht gehärtet. Sie können MySQL mit mysql_secure_installation sichern Skript. Sie sollten jeden Schritt sorgfältig lesen und befolgen, der ein Root-Passwort festlegt, anonyme Benutzer entfernt, Remote-Root-Login verbietet und die Testdatenbank und den Zugriff auf sicheres MySQL entfernt:

$ sudo mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Schritt 4. Installation von PHP.

Um PHP und das PHP-Apache-Modul in Manjaro zu installieren, verwenden Sie einfach pacman der Befehl:

sudo pacman -S php php-apache

Nach der Installation müssen wir PHP konfigurieren. Bearbeiten Sie die Datei:/etc/httpd/conf/httpd.conf:

sudo nano /etc/httpd/conf/httpd.conf

Suchen Sie die folgende Zeile und kommentieren Sie sie:

#LoadModule mpm_event_module modules/mod_mpm_event.so

Kommentieren Sie außerdem die Zeile aus oder fügen Sie sie hinzu:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Fügen Sie dann die folgenden Zeilen am Ende der Konfigurationsdatei hinzu:

LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

Speichern Sie nun die Datei und beenden Sie. Starten Sie den Apache-Server neu, um sicherzustellen, dass alle Konfigurationen ordnungsgemäß geladen werden:

sudo systemctl restart httpd

Um die PHP-Installation zu testen, erstellen Sie eine Datei unter /srv/http/phpinfo.php und schreiben Sie den folgenden PHP-Code:

<?php
phpinfo();
?>

Öffnen Sie nun diese Datei im Browser, indem Sie die localhost/phptest.php besuchen und überprüfen Sie, ob der Apache-Server mit der neuesten PHP-Version auf Ihrem Manjaro Linux installiert ist.

Herzlichen Glückwunsch! Sie haben den LAMP-Server erfolgreich installiert. Vielen Dank, dass Sie dieses Tutorial zur Installation von LAMP (Apache, MariaDB und PHP) in Manjaro 20-Systemen verwendet haben. Für zusätzliche Hilfe oder nützliche Informationen empfehlen wir Besuchen Sie die offizielle Apache-, MariaDB- und PHP-Website.


AlmaLinux
  1. So installieren Sie den LAMP-Stack unter CentOS 7

  2. So installieren Sie Gibbon unter Ubuntu 16.04

  3. So installieren Sie LAMP auf Fedora 27 / Fedora 26 / 25

  4. Installieren Sie LAMP auf Manjaro

  5. So installieren Sie LAMP unter Ubuntu 16.04

So installieren Sie uTorrent auf Manjaro 20

So installieren Sie NetBeans auf Manjaro 21

So installieren Sie den Zoom-Client auf Manjaro 21

So installieren Sie den LAMP-Stack unter Debian 11

So installieren Sie Magento unter Debian 11

So installieren Sie den LAMP-Stack unter Linux Mint 20