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

Come installare lo stack LAMP su CentOS 6

In questo tutorial, ti mostreremo come installare LAMP Stack su CentOS 6. Per chi non lo sapesse, LAMP rappresenta uno stack completo contenente il server web più popolare noto come Apache, il server di database più popolare MySQL e il più popolare linguaggio di programmazione Web open source noto come PHP. Tutti i componenti sono software gratuiti e open source e la combinazione è adatta per la creazione di pagine Web dinamiche.

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. Lo farò mostra l'installazione passo passo di LAMP (Linux Apache, MySQL e PHP) sul server CentOS 6.

Prerequisiti

  • Un server che esegue uno dei seguenti sistemi operativi:CentOS 6.
  • 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 Stack su CentOS 6

Passaggio 1. Prima di tutto, assicurati che tutti i pacchetti siano aggiornati.

yum -y update

Passaggio 2. Installazione di Apache su CentOS 6.

Installeremo Apache con yum, che è il gestore di pacchetti predefinito per CentOS 6:

yum install httpd

Avvia Apache e aggiungilo per avviarlo automaticamente all'avvio del tuo sistema usando:

chkconfig --levels 235 httpd on
service httpd start

Puoi verificare che Apache sia realmente in esecuzione aprendo il tuo browser web preferito e inserendo l'URL http://your-server's-ip-address e devi aprire la porta 80 per rendere accessibile il tuo server web:

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
/etc/rc.d/init.d/iptables save

Passaggio 3. Installazione di MySQL su CentOS 6.

Installa MySQL con il seguente comando per iniziare l'installazione:

yum install mysql-server

Dopodiché aggiungilo all'avvio del tuo sistema e avvia il server MySQL usando i seguenti comandi:

chkconfig --levels 235 mysqld on
service mysqld start

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:

mysql_secure_installation

Per accedere a MySQL, usa il comando seguente (nota che è lo stesso comando che useresti per accedere a un database MySQL):

mysql -u root -p

Passaggio 4. Installazione di PHP su CentOS 6.

Infine, esegui i comandi seguenti per installare PHP insieme ad altri moduli utili:

yum install php php-mysql

Puoi installare alcune altre estensioni PHP richieste dalle tue applicazioni. Di seguito è riportato un elenco dei moduli PHP disponibili:

php-bcmath          =>     A module for PHP applications using the bcmath library
php-cli             =>     Command-line interface for PHP
php-common          =>     Common files for PHP
php-dba             =>     A database abstraction layer module for PHP applications
php-devel           =>     Files needed for building PHP extensions
php-embedded        =>     PHP library for embedding in applications
php-enchant         =>     Human Language and Character Encoding Support
php-gd              =>     A module for PHP applications using the gd graphics library
php-imap            =>     A module for PHP applications that use IMAP
php-intl            =>     Internationalization extension for PHP applications
php-ldap            =>     A module for PHP applications that use LDAP
php-mbstring        =>     A module for PHP applications which need multi-byte string handling
php-mysql           =>     A module for PHP applications that use MySQL databases
php-odbc            =>     A module for PHP applications that use ODBC databases
php-pdo             =>     A database access abstraction module for PHP applications
php-pear.noarch     =>     PHP Extension and Application Repository framework
php-pecl-apc        =>     APC cache optimizing PHP intermediate code
php-pecl-memcache   =>     Extension to work with the Memcached caching daemon
php-pgsql           =>     A PostgreSQL database module for PHP
php-process         =>     Modules for PHP scripts using system process interfaces
php-pspell          =>     A module for PHP applications using pspell interfaces
php-recode          =>     A module for PHP applications using the recode library
php-snmp            =>     A module for PHP applications that query SNMP-managed devices
php-soap            =>     A module for PHP applications that use the SOAP protocol
php-tidy            =>     Standard PHP module provides tidy library support
php-xml             =>     A module for PHP applications which use XML
php-xmlrpc          =>     A module for PHP applications which use the XML-RPC protocol
php-zts             =>     Thread-safe PHP interpreter for use with the Apache HTTP Server

Riavvia apache in modo che tutte le modifiche abbiano effetto:

service httpd restart

Per testare PHP, crea un file di prova chiamato info.php con il contenuto seguente. Salva il file, quindi cercalo per vedere se PHP funziona:

nano /var/www/html/info.php
<?php
phpinfo();
?>

Congratulazioni! Hai installato con successo LAMP. Grazie per aver utilizzato questo tutorial per l'installazione di LAMP (Linux Apache, MySQL e PHP) sul sistema CentOS 6. Per ulteriore aiuto o informazioni utili, ti consigliamo di per controllare il sito Web ufficiale di Apache, MySQL e PHP.


Cent OS
  1. Come installare PHP 5.5 su CentOS

  2. Come installare PHP 7.3 su CentOS 8

  3. Come installare PHP 8 su CentOS 7

  4. Come installare PHP 8 su CentOS 8

  5. Come installare PHP 7.2 su CentOS 7

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 lo stack LAMP su Debian 10

Come installare lo stack LAMP su CentOS 8

Come installare lo stack LAMP su CentOS 8

Come installare lo stack LEMP su CentOS 8