User Tools

Site Tools


computing:migratewp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
computing:migratewp [2019/02/18 05:45] – created oemb1905computing:migratewp [2019/06/16 05:50] oemb1905
Line 11: Line 11:
 ------------------------------------------- -------------------------------------------
  
-This tutorial is designed to step one through how to migrate a self-hosted Word Press site manually.  First, authenticate as root on the //old host// and backup your entire database.+This tutorial is designed to step one through how to migrate a self-hosted Word Press site manually.  First, completely set up LAMP and TLS and DNS, etc., before you begin migration, and review [[https://jonathanhaack.com/dokuwiki/doku.php?id=computing:apachesurvival|Apache Survival]] if you are unclear on how to do that.  Now, once that is set up, authenticate as root on the //old host// and backup your entire database (thanks to @jjscha for this mysqldump syntax):
  
   sudo -i   sudo -i
Line 30: Line 30:
   > mysqldump-all-databases.sql   > mysqldump-all-databases.sql
  
-The spacing is optional and thanks to @jjscha for providing a great template to use.  This can and should be used as a backup script.  You can find the latest version [[https://codetalkers.services/oemb1905/hackingclub/blob/master/nixnscripts/backup_mysql.sh|mysql-backup.sh]] Now that your database is securelet'import that database into the //new host// as follows:+Use scp to get the file to the new host: 
 +   
 +  sudo scp mysqldump-all-databases.sql user@newhostorip.com: 
 + 
 +Now, time to import that database into the new host:
  
   mysql -u user -h localhost -p < /path/to/mysqldump-all-databases.sql   mysql -u user -h localhost -p < /path/to/mysqldump-all-databases.sql
Line 36: Line 40:
 This will take some time.  Once it finishes, log into the mysql command mode and verify the databases made it over: This will take some time.  Once it finishes, log into the mysql command mode and verify the databases made it over:
  
-  mysql -u user -p+  sudo mysql -u user -p
   > SHOW DATABASES;   > SHOW DATABASES;
   > EXIT   > EXIT
  
-Run this command on both machines, and the output should be identical.  Now, it is time to migrate the website over:+Run this command on both machines, and the output should be identical.  Now, it is time to migrate the website //files// over to the new host:
  
-  scp -r /var/www/website.com user@newhost.com:+  sudo scp -r /var/www/website.com/public_html user@newhostorip.com:/var/www/newwebsite.com/
      
-Put the files in the appropriate locations, obviously make sure you set up TLS again if needed and check file permissions for the directories, but that should be it.  Your WP website is now on the new host.  Of course, also make appropriate DNS / port forwarding adjustments so that the new website is accessible.+Put the files in the appropriate locations, and that should be it.  Definitely reboot, and I have found it is helpful to restart the router, modem, and workstations on the network.  If the old host is on the same network, this is helpful.
  
- --- //[[netcmnd@jonathanhaack.com|oemb1905]] 2019/02/17 22:06// + --- //[[netcmnd@jonathanhaack.com|oemb1905]] 2019/06/15 23:42//  
-  +
      
computing/migratewp.txt · Last modified: 2022/09/03 23:11 by oemb1905