Restauration d’un site (rejeu procédure)
Après avoir sauvegarder mon site et ma bdd hébergé chez Free, j’install une vm en local avec virtualbox et je restaure le tout
Pré-requis
– Voir l’article [Linux] Sauvegarder son WordPress avec LFTP
– Installation d’une Centos 7
– Desactivation selinux
– Desactivation firewalld
– Mettre a jour le hostname et fichier hosts
Installation de quelques paquets utiles
1 |
$ sudo yum install vim wget rsync -y |
Installation apache, php, mariadb
1 |
$ sudo yum install httpd mariadb mariadb-server php php-mysqli php-gd mod_ssl -y |
Récupération de la source, dezip et attribution des droits
1 2 3 4 5 6 7 8 |
<del>$ wget https://fr.wordpress.org/wordpress-4.8.2-fr_FR.tar.gz</del> <del>$ tar zxvf wordpress-4.8.2-fr_FR.tar.gz </del> <del>$ sudo rsync -avP /opt/wordpress/ /var/www/html/</del> <del>$ sudo mkdir /var/www/html/wp-content/uploads</del> $ sudo scp -r /home/bef/Save_sitex013_24092017/* root@monsite.domaine.local:/var/www/html $ sudo chown -R apache:apache /var/www/html/* $ sudo find /var/www -type d -exec chmod 755 {} \; $ sudo find /var/www -type f -exec chmod 644 {} \; |
Démarrage des services
1 2 3 4 |
$ sudo systemctl start httpd $ sudo systemctl enable httpd $ sudo systemctl start mariadb $ sudo systemctl enable mariadb |
Configuration de mariadb
1 2 |
$ mysql_secure_installation $ mysql -u root -p |
1 2 3 |
mysql> CREATE DATABASE nomdeladb COLLATE UTF8_general_ci; mysql> CREATE USER 'nomdelutilisateur' identified by 'motdepassedelutilisateur'; mysql> GRANT ALL PRIVILEGES ON nomdeladb.* to 'nomdelutilisateur'@localhost identified by 'motdepassedelutilisateur'; |
Creation du vhost
Voir l’article [Apache] Activer / Désactiver plusieurs vhost sur Centos, puis
1 |
$ sudo vim /etc/httpd/sites-available/monsite.domaine.local.conf |
1 2 3 4 |
<VirtualHost *:80> DocumentRoot /var/www/html ServerName monsite.domaine.local </VirtualHost> |
1 |
$ sudo a2ensite monsite.domaine.local |
Créer le fichier de conf et renseigner le (voir [CMS] Installation d’un WordPress)
1 |
$ sudo mv /var/www/html/wp-config-sample.php /var/www/html/wp-config.php |
Récupérer la BDD et modifier le fqdn
1 2 3 |
$ sudo scp /home/bef/Save_bddx013_24092017/x013-2017-09-24-18-17-50.gz root@monsite.domaine.local:/tmp $ cd /tmp $ sudo vim x013-2017-09-24-18-17-50.gz |
Puis en mode édition, remplacer toutes les entrées fqdn
1 |
:%s/it.izero.fr/monsite.domaine.local/g |
1 |
+ modifier dans le fichier sql.free.fr par localhost |
De-zipper le fichier et restaurer la bdd
1 2 |
$ gunzip /tmp/x013-2017-09-24-18-17-50.gz $ sudo mysql --user=root --password=mettremotdepassedefini bddwordpress < x013-2017-09-24-18-17-50 |
Redémarrer les services
1 2 |
$ sudo systemctl restart httpd $ sudo systemctl restart mariadb |