Installazione ambiente LAMP (Linux Apache Mysql PHP) su Ubuntu 17.10
In questo tutorial andremo ad installare passo passo l’ambiente LAMP (Linux Apache Mysql Php) su Ubuntu 17.10.
Partiamo da un sistema Ubuntu Server 17.10 preinstallato ( leggere il seguente articolo), verifichiamo che sia completamente aggiornato
sudo apt-get update
sudo apt-get upgrade
installiamo il server web Apache
sudo apt-get install apache2
sudo systemctl start apache2
avviamolo al boot
sudo systemctl enable apache2
verifichiamo il corretto funzionamento, visitando il seguente url http://ip_server
Installiamo adesso il database Mysql
sudo apt-get install mysql-server
impostiamo la password dell’utente root (di Mysql non del sistema operativo)
sudo systemctl start mysql
sudo systemctl enable mysql
conclusa la fase d’installazione, cambiamo alcune impostazioni di default
sudo mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:inserire la password impostata precedentemente
scegliamo per scopi di test di non utilizzare il plug in di validazione della password
VALIDATE PASSWORD PLUGIN can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD plugin?Press y|Y for Yes, any other key for No:N
Using existing password for root.
Change the password for root ? ((Press y|Y for Yes, any other key for No) :N
rimuoviamo l’utente anonimo
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) :Y
per il momento non permettiamo il collegamento da remoto all’utente root
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? (Press y|Y for Yes, any other key for No) :N
rimuoviamo il database di test
By default, MySQL 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? (Press y|Y for Yes, any other key for No) :Y
– Dropping test database…
Success.– Removing privileges on test database…
Success.
infine ricarichiamo i privileggi
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Y
Success.
All done!
Adesso installiamo il PHP e le librerie per la comunicazione con i componenti Apache e Mysql
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql
E’ possibile installare ulteriori librerie a secondo del tipo di applicazione che si va a distribuire (apt-get install php-nome_modulo)
Per provare il funzionamento dello stack LAMP, creiamo una classica pagina web
sudo apt-get install vim
vim /var/www/html/info.php
cat /var/www/html/info.php
<?php
phpinfo();
?>
e visitiamo il seguente url http://ip_server/info.php
installazione terminata.