GNU/Linux >> Linux Esercitazione >  >> AlmaLinux

Come installare LAMP su Manjaro 20

In questo tutorial, ti mostreremo come installare LAMP su Manjaro 20. Per chi non lo sapesse, LAMP sta per Linux, Apache, MySQL/MariaDB, PHP o Perl o Python. Tutti i componenti sono software gratuiti e open source e la combinazione è adatta per la creazione di pagine Web dinamiche. Lo stack LAMP è una delle configurazioni di server più popolari al mondo.

Questo articolo presuppone che tu abbia almeno una conoscenza di base di Linux, sappia come usare la shell e, soprattutto, che ospiti il ​​tuo sito sul tuo VPS. L'installazione è abbastanza semplice e presuppone che tu sono in esecuzione nell'account root, in caso contrario potrebbe essere necessario aggiungere 'sudo ' ai comandi per ottenere i privilegi di root. Ti mostrerò passo passo l'installazione di LAMP Stack su un Manjaro 20 (Nibia).

Prerequisiti

  • Un server o desktop che esegue uno dei seguenti sistemi operativi:Manjaro o Arch Linux.
  • Si consiglia di utilizzare una nuova installazione del sistema operativo per prevenire potenziali problemi.
  • Accesso SSH al server (o semplicemente apri Terminal se sei su un desktop).
  • Un non-root sudo user o accedere all'root user . Ti consigliamo di agire come non-root sudo user , tuttavia, poiché puoi danneggiare il tuo sistema se non stai attento quando agisci come root.

Installa LAMP su Manjaro 20 Nibia

Passaggio 1. Prima di eseguire il tutorial di seguito, assicurati che il nostro sistema sia aggiornato:

sudo pacman -Syu

Passaggio 2. Installazione di Apache.

Installiamo il server web Apache utilizzando il seguente comando:

sudo pacman -S apache

Una volta completata l'installazione, apri il file di configurazione di Apache che esiste su /etc/httpd/conf/httpd.conf , cerca e commenta sulla riga seguente:
# LoadModule unique_id_module modules/mod_unique_id.so

Ora possiamo abilitare e avviare il server apache usando il seguente comando:

sudo systemctl enable httpd
sudo systemctl restart httpd

Passaggio 3. Installa MySQL.

Esegui il seguente comando per installare MySQL Server su Manjaro:

sudo pacman -S mysql

Una volta completato, inizia inizializzando la directory dei dati MySQL utilizzando il seguente comando:

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

Successivamente, abilitalo e avvialo usando i seguenti comandi:

sudo systemctl enable mysqld
sudo systemctl restart mysqld

Per impostazione predefinita, MySQL non è protetto. Puoi proteggere MySQL utilizzando mysql_secure_installation sceneggiatura. dovresti leggere attentamente e sotto ogni passaggio che imposterà una password di root, rimuoverà gli utenti anonimi, non consentirà l'accesso root remoto e rimuoverà il database di test e l'accesso per proteggere MySQL:

$ 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!

Passaggio 4. Installazione di PHP.

Per installare il modulo PHP e PHP Apache in Manjaro, usa semplicemente pacman il comando:

sudo pacman -S php php-apache

Dopo l'installazione, dobbiamo configurare PHP. Modifica file:/etc/httpd/conf/httpd.conf:

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

Trova la riga seguente e commentala:

#LoadModule mpm_event_module modules/mod_mpm_event.so

Inoltre, decommenta o aggiungi la riga:

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

Quindi, aggiungi le seguenti righe in fondo al file di configurazione:

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

Ora salva il file ed esci. Riavvia il server Apache per assicurarti che tutte le configurazioni siano caricate correttamente:

sudo systemctl restart httpd

Per testare l'installazione di PHP, crea un file in /srv/http/phpinfo.php e scrivi il seguente codice PHP:

<?php
phpinfo();
?>

Ora apri questo file nel browser visitando il localhost/phptest.php e controlla che sul tuo Manjaro Linux sia installato il server Apache con l'ultima versione di PHP.

Congratulazioni! Hai installato correttamente il server LAMP. Grazie per aver utilizzato questo tutorial per l'installazione di LAMP (Apache, MariaDB e PHP) nei sistemi Manjaro 20. Per ulteriore aiuto o informazioni utili, ti consigliamo controllare il sito Web ufficiale di Apache, MariaDB e PHP.


AlmaLinux
  1. Come installare lo stack LAMP su CentOS 7

  2. Come installare Gibbon su Ubuntu 16.04

  3. Come installare LAMP su Fedora 27 / Fedora 26/25

  4. Installa LAMP su Manjaro

  5. Come installare LAMP su Ubuntu 16.04

Come installare uTorrent su Manjaro 20

Come installare NetBeans su Manjaro 21

Come installare Zoom Client su Manjaro 21

Come installare lo stack LAMP su Debian 11

Come installare Magento su Debian 11

Come installare lo stack LAMP su Linux Mint 20