{"id":156,"date":"2010-12-19T02:26:02","date_gmt":"2010-12-19T07:26:02","guid":{"rendered":"http:\/\/wcarss.ca\/log\/?p=156"},"modified":"2010-12-19T02:26:02","modified_gmt":"2010-12-19T07:26:02","slug":"migrating-wordpress-and-the-server","status":"publish","type":"post","link":"https:\/\/wcarss.ca\/log\/2010\/12\/migrating-wordpress-and-the-server\/","title":{"rendered":"Migrating wordpress and the server"},"content":{"rendered":"<p>I migrated the site to a different server earlier this evening; let&#8217;s recap. Things in &#8221;s are commands to be run.<\/p>\n<ol>\n<li>Log into your new server<\/li>\n<li>&#8216;screen bash&#8217; (in case your net drops)<\/li>\n<li>&#8216;scp -R existing_website_name:~\/destinationfolder folder_to_be_copied&#8217; (the new setup will be \/home\/yourname\/destinationfolder\/folder_to_be_copied)<\/li>\n<li>hit &#8216;CTRL-A d&#8217; (detach screen)<\/li>\n<li>hang out on IRC while your data transfers, check in every once in a while<\/li>\n<li>Next up is backing up the existing database &#8211; ssh into your existing server, then dump your database using &#8216;mysqldump -h hostname -u username -p databasename | bzip2 -c &gt; dump.bz2&#8217;<\/li>\n<li>exit ssh and &#8216;scp existing_website:~\/path_to_dump\/dump.bz2 dump.bz2&#8217;<\/li>\n<li>log into mysql, then create your wordpress db user and your wordpress db, and then grant necessary privileges<\/li>\n<li>log out of mysql, and extract your database dump, then restore it by calling &#8216;mysql -h hostname -u username -p databasename < dump'<\/li>\n<li>change your wordpress directory&#8217;s ownership to the user who runs the webserver &#8211; probably www-data, by using &#8216;chown -R www-data directory&#8217;<\/li>\n<li>test everything out, make sure your new site is operating the way you&#8217;d expect<\/li>\n<li>change over your zonefiles to update your DNS.<\/li>\n<\/ol>\n<p>In the middle of this, I had some extra steps:<\/p>\n<ol>\n<li>Get frustrated that I don&#8217;t have &#8216;interactive autocomplete&#8217; turned on. In order to make screen autocomplete when I type &#8216;screen -r&#8217;, I have to enable bash_completion. I just copied a friend&#8217;s .bashrc and .bash_profile to make this work &#8212; I love having smart friends. The relevant lines in each of them are:<\/li>\n<p>.bash_profile: <\/p>\n<pre class=\"brush: php\"># include .bashrc if it exists\r\nif [ -f ~\/.bashrc ]; then\r\n    . ~\/.bashrc\r\nfi<\/pre>\n<p>.bashrc:<\/p>\n<pre class=\"brush: php\"># enable programmable completion features (you don&#039;t need to enable\r\n# this, if it&#039;s already enabled in \/etc\/bash.bashrc and \/etc\/profile\r\n# sources \/etc\/bash.bashrc).\r\nif [ -f \/etc\/bash_completion ]; then\r\n    . \/etc\/bash_completion\r\nfi<\/pre>\n<li>screen -r &lt;TAB&gt; to reattach my last screen session<\/li>\n<\/ol>\n<p>And it&#8217;s all working well!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I migrated the site to a different server earlier this evening; let&#8217;s recap. Things in &#8221;s are commands to be run. Log into your new server &#8216;screen bash&#8217; (in case your net drops) &#8216;scp -R existing_website_name:~\/destinationfolder folder_to_be_copied&#8217; (the new setup will be \/home\/yourname\/destinationfolder\/folder_to_be_copied) hit &#8216;CTRL-A d&#8217; (detach screen) hang out on IRC while your data [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/156"}],"collection":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":4,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"predecessor-version":[{"id":160,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/posts\/156\/revisions\/160"}],"wp:attachment":[{"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wcarss.ca\/log\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}