{"id":663,"date":"2019-08-26T16:19:18","date_gmt":"2019-08-26T21:19:18","guid":{"rendered":"http:\/\/zewwy.ca\/?p=663"},"modified":"2019-11-26T20:40:44","modified_gmt":"2019-11-27T02:40:44","slug":"migrating-wordpress","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2019\/08\/26\/migrating-wordpress\/","title":{"rendered":"Migrating WordPress"},"content":{"rendered":"<header class=\"entry-header\">\n<h1 class=\"entry-title\" style=\"text-align: center;\"><span class=\"ez-toc-section\" id=\"The_Story\"><\/span><span style=\"text-decoration: underline;\"><strong style=\"font-size: 1.5rem;\">The Story<\/strong><\/span><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<\/header>\n<div class=\"entry-content\">\n<p>In the beginning, there was a man! This man ran! This man ran a site, it was awww inspiring, and so unknown. It ran on Linux in many forms, then one day it realized!!!!!!!! Everything becomes out of date!<\/p>\n<p>Ahem, anyway\u2026<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Reasons_for_migrating\"><\/span><span id=\"Reasons_for_migrating\" class=\"ez-toc-section\">Reasons for migrating<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Whatever the reason maybe, mine happens to be this little gem right here:<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/xjGZxc8.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/xjGZxc8.png\" alt=\"\" width=\"603\" height=\"278\" \/><\/a><\/p>\n<p>I\u2019m sorry\u2026 did that just say insecure\u2026 me\u2026 insecure\u2026<\/p>\n<p>OK, sometimes I can be a little insecure but you didn\u2019t have to shove it in my face. Anyway, whatever your reason for migrating maybe. I haven\u2019t done, and maybe you haven\u2019t either. So lets do this\u2026 together!<\/p>\n<p>Yeah\u2026 I googled\u2026 <a href=\"https:\/\/www.wpexplorer.com\/migrating-wordpress-website\/\">This was my main source, so big thanks to Tom Ewer for this write up<\/a> much like his mine will be rather indepth and manual. If you wish to avoid learning the nitty gritty and just want to get it done, or use a plugin to help see <a href=\"https:\/\/www.wpbeginner.com\/wp-tutorials\/how-to-move-wordpress-to-a-new-host-or-server-with-no-downtime\/\">wpbeginner site here<\/a> they use a plugin called <a href=\"https:\/\/wordpress.org\/support\/plugin\/duplicator\/reviews\/?filter=1\">duplicator<\/a> and seems to have solid reviews. Since I\u2019m not a fan of paid magic, I\u2019m gonna do this manually.<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Migrating_WordPress\"><\/span><span id=\"Migrating_WordPress\" class=\"ez-toc-section\">Migrating WordPress<\/span><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"Step_1_%E2%80%93_Backup\"><\/span><span id=\"Step_1_Backup\" class=\"ez-toc-section\">Step 1 \u2013 Backup<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Make sure you have a backup of your WordPress Server, in my case since they are VMs, I used Veeam to create a backup of my current WordPress server. Sadly even after logging in to the hosting VM and updating the repos and host OS (Debain 8 Jessie), this version of Debian ran out of support and thus it\u2019s repos weren\u2019t able to supply the updated PHP libraries needed to clear the alert.<\/p>\n<p>After that backup I followed along with Toms blog and instead of FTP (File Transfer Protocol) I used SCP (Yeah\u2026 I\u2019m NOT insecure! :P) WinSCP that is, what this actually means I\u2019m not sure apparently either <a href=\"https:\/\/www.reddit.com\/r\/SCP\/comments\/8e3xk8\/scp_meaning\/\">Secure Contain Protect or Special Containment Procedures<\/a>, but under the hood it just uses SSH? Oh\u2026 \u201c<a href=\"http:\/\/pages.cs.wisc.edu\/~loris\/cs536\/ssh.html\">Secure Copy (SCP)<\/a> is method of transferring files between computers over a secure channel. It uses the SSH protocol to do so\u201d<\/p>\n<p>In my case since it was Turnkey Linux, the web files were located at \/var\/www<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/i4Afgps.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/i4Afgps.png\" alt=\"\" width=\"1013\" height=\"453\" \/><\/a><\/p>\n<h2><span class=\"ez-toc-section\" id=\"Step_2_%E2%80%93_Export_WP_Database\"><\/span><span id=\"Step_2_Export_WP_Database\" class=\"ez-toc-section\">Step 2 \u2013 Export WP Database<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now Tom ended up using phpMyADmin in his example, I wasn\u2019t sure if the Turnkey image I deployed was using the same, turns out after a quick google search and right on the VMs console, states Adminer on port 12322<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/0U9CBGO.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/0U9CBGO.png\" alt=\"\" width=\"944\" height=\"570\" \/><\/a><\/p>\n<p>after login\u2026<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/i7I5SFh.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/i7I5SFh.png\" alt=\"\" width=\"866\" height=\"422\" \/><\/a>Export\u2026.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Q2ZJQjL.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Q2ZJQjL.png\" alt=\"\" width=\"786\" height=\"398\" \/><\/a>Left all the default selections\u2026. then\u2026 what the\u2026.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/I9jCVm6.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/I9jCVm6.png\" alt=\"\" width=\"752\" height=\"340\" \/><\/a><\/p>\n<p>I was expecting a file to save, so instead I had to select all and save it to a file with Notepad++, all this was, was an output of the DBs in raw SQL.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Step_3_%E2%80%93_Create_DB_Instances\"><\/span><span id=\"Step_3_Create_DB_Instances\" class=\"ez-toc-section\">Step 3 \u2013 Create DB Instances<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Create your new DB instances, depending on how the SQL server handles DBs imports creation of actual DB\u2019s and their tables may very.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"Step_4_%E2%80%93_Verify_DB_Login_Credentials\"><\/span><span id=\"Step_4_Verify_DB_Login_Credentials\" class=\"ez-toc-section\">Step 4 \u2013 Verify DB Login Credentials<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>From the backup files in step 1, look in config.php for the DB user connection strings. Verify this user has a login and has proper access rights to the DB\u2019s and Tables being imported.<\/p>\n<p>Now\u2026.<\/p>\n<h2><span class=\"ez-toc-section\" id=\"What_happened_to_me\"><\/span><span id=\"What_happened_to_me\" class=\"ez-toc-section\">What happened to me<\/span><span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Now in my case I simply spun up a new TurnKey WordPress server to see if they were maintaining their images, and sure enough this new was running on Debian 9 Strech, which is the recommended version. So from here although the Adminer version is the same @ 4.2.5 it looks different. Another thing to note was on the old version I was able to login to Adminer with \u2018root\u2019 on the new Adminer I had to login in with \u2018adminer\u2019.<\/p>\n<p>Now Tom states to create the Databases, I\u2019m not sure if he means the instances here, cause in my case it turns out the creation of the databases happens at import. So what happened to me was this.. first I tried to import\u2026<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/BHm836N.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/BHm836N.png\" alt=\"\" width=\"1287\" height=\"267\" \/><\/a><\/p>\n<p>Then he says to edit the config.php in my case since it was all default WordPress I figured, meh hopefully it\u2019ll all match.. hahah so I skipped his Step 4, also skipped his step 5 cause I already did that, as I said the creation of the DBs happens at import, at least if they don\u2019t already exist like the above error. In my case it just stated it for mysql, but not wordpress so I assumed the other 4 successful queries were for my wordpress data (hahah so many assumed mistakes).<\/p>\n<p>So I uploaded those unedited web files back to the same dir on the new server\u2026.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/i4Afgps.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/i4Afgps.png\" alt=\"\" width=\"1013\" height=\"453\" \/><\/a><\/p>\n<p>and\u2026.<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/1XIV2Ha.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/1XIV2Ha.png\" alt=\"\" width=\"828\" height=\"203\" \/><\/a><\/p>\n<p>DOH! hahaha That\u2019s why you don\u2019t skip Tom\u2019s Step 4, but in my case I had no interest in creating these as they should already exist, at least unless the WordPress image has changed that (in this case so lucky, they didn\u2019t) so all I had to do was figure out how to set the wordpress users password on the new DB to match that which is in the config.php\u2026. so I opened config.php grabbed the wordpress users password, and found out about <a href=\"https:\/\/stackoverflow.com\/questions\/2703996\/how-to-find-out-the-username-and-password-for-mysql-database\">this trick by James Goodwin<\/a>\u2026 \ud83d\ude00<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/ueHMsAp.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/ueHMsAp.png\" alt=\"\" width=\"1168\" height=\"424\" \/><\/a><\/p>\n<p>However, I was able to load my new WordPress site, but it was still the default one, not mine with my posts, themes, plugins\u2026 what the\u2026 which brought me back to my \u201cfailed\u201d DB import\u2026.<\/p>\n<p>When WordPress gives you attitude you drop em like their hot, drop em like their hot\u2026. but in this case WordPress is hot is I won\u2019t drop it, but I will drop those useless databases So, since this was all just a test server anyway, I went back into the Adminer on the new server and simple selected both MySQL, and wordpress and clicked the drop button.<\/p>\n<p>Then back into import, selected the same export SQL file\u2026 and\u2026<\/p>\n<p><a href=\"https:\/\/i.imgur.com\/Wrpsu3C.png\" data-featherlight=\"image\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter\" src=\"https:\/\/i.imgur.com\/Wrpsu3C.png\" alt=\"\" width=\"1316\" height=\"278\" \/><\/a>and sure enough my site loaded with all my content, all my plugins, all my posts, and no more PHP warning!<\/p>\n<h1><span class=\"ez-toc-section\" id=\"Summary\"><\/span><span id=\"Summary\" class=\"ez-toc-section\">Summary<\/span><span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>Now this covers the manual work to move WordPress, however much like what Tom covered, the final touches of how the site is accessed (direct NAT, behind load balancers, etc) are all on you in order to complete the migration for public access.<\/p>\n<p>In my case I\u2019ll probably prepare this new VM with the exact same Private IP information just on a separate vSwitch, once it\u2019s verified working 100% shutdown the old VM, swap the vSwitch connection to production, test, if good, delete old VM, if not change vSwitch ports and bring up old server.<\/p>\n<p>Worse case delete both VMs, restore my original server from my Veeam backups.<\/p>\n<p>*NOTE* I did experience one issue were I was unable to update WordPress or plugins after the migration. Turns out many posts point to the <a href=\"https:\/\/wordpress.org\/support\/article\/changing-file-permissions\/\">File System permissions<\/a> (which I suspected) I checked my old WordPress instance vs my new one and noticed all the files under the physical path had different owner and grp (root on new vs www-data on old) so&#8230;<\/p>\n<pre>chown -R www-data:www-data \/path\/to\/wordpress<\/pre>\n<p>After that updates worked without issue.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>The Story In the beginning, there was a man! This man ran! This man ran a site, it was awww inspiring, and so unknown. It ran on Linux in many forms, then one day it realized!!!!!!!! Everything becomes out of date! Ahem, anyway\u2026 Reasons for migrating Whatever the reason maybe, mine happens to be this &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2019\/08\/26\/migrating-wordpress\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Migrating WordPress&#8221;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[8,223],"tags":[225,224,45,56],"class_list":["post-663","post","type-post","status-publish","format-standard","hentry","category-server-administration","category-wordpress","tag-manual","tag-migrate","tag-migration","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/663","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=663"}],"version-history":[{"count":5,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/663\/revisions"}],"predecessor-version":[{"id":772,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/663\/revisions\/772"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=663"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=663"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=663"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}