Installazione di WordPress su Ubuntu 18
In questo articolo andremo a descrivere come installare il famoso CMS WordPress su Ubuntu 18.
Consideriamo di partire da una macchina virtuale Ubuntu 18 preinstallata ( qui l’articolo dell’ installazione) ed aggiorniamola
sudo apt-get update
sudo apt-get upgrade
installiamo il server web Apache
sudo apt-get install apache2
abilitiamo sul firewall sia la porta 80 (HTTP) che la 443 ( HTTPS)
sudo ufw allow 80
sudo ufw allow 443
abilitiamo il demone di apache all’avvio automatico
sudo systemctl enable apache2
sudo systemctl start apache2
adesso installiamo PHP 7.2 e relativi moduli per poter installare WordPress
sudo apt-get install php php-curl php-gd php-mbstring php-xml php-xmlrpc php-soap php-intl php-zip libapache2-mod-php
verifichiamo la versione di PHP
php -v
PHP 7.2.19-0ubuntu0.18.04.2 (cli) (built: Aug 12 2019 19:34:28) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.19-0ubuntu0.18.04.2, Copyright (c) 1999-2018, by Zend Technologies
successivamente installiamo il database Mysql
sudo apt-get install mysql-server
rendiamo sicuro il database
sudo mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank 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:Y
immettiamo la password di root
New password:
Re-enter new password:
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.
rimuoviamo l’utente anonimo
Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y
Normally, root should only be allowed to connect from
‘localhost’. This ensures that someone cannot guess at
the root password from the network.
non concediamo i permessi di accesso da remoto tramite root
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : Y
ed infine rimuovimo il database di test
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.
aggiorniamo i privilegi delle tabelle
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :Y
All done!
Creiamo il database che verrà utilizzato da WordPress, colleghiamoci al server Mysql
sudo mysql -u root -p
creiamo il database
mysql> CREATE DATABASE wp_test;
aggiungiamo un utente e concediamo i permessi per operare sul database appena creato
mysql> GRANT ALL PRIVILEGES ON wp_test.* TO 'utentewp'@'localhost' IDENTIFIED BY 'password_a_scelta';
aggiorniamo i permessi ed usciamo
mysql> FLUSH PRIVILEGES;
mysql> exit
A questo punto installiamo WordPress
cd
scarichiamo l’ultima versione di WordPress
wget http://wordpress.org/latest.tar.gz
tar -xvzf latest.tar.gz
creiamo una cartella per il sito web
mkdir -p /var/www/html/sito1
spostiamo i file di wordpress nella cartella appena creata
mv wordpress/* /var/www/html/sito1
e diamo i permessi
chown -R www-data. /var/www/html/sito1
Creiamo il file di configurazione di WordPress
cd /var/www/html/sito1
cp wp-config-sample.php wp-config.php
ed inseriamo i parametri del database
vim wp-config.php
define( ‘DB_NAME’, ‘wp_test’ );
/** MySQL database username */
define( ‘DB_USER’, ‘utentewp’ );/** MySQL database password */
define( ‘DB_PASSWORD’, ‘password_a_scelta’ );/** MySQL hostname */
define( ‘DB_HOST’, ‘localhost’ );
a questo punto possiamo configurare il sito WordPress collegandoci al seguente indirizzo http://ip_server/sito1/ ed avremo
scegliamo la lingua ed andiamo avanti
creiamo l’utente che successivamente farà accesso all’ area amministrazione e andiamo avanti.
inseriamo le credenziali precedentemente impostate ( utentewp ) ed accediamo all’area amministrativa