Skip to content

Commit

Permalink
[NEW] How to Migrate a WordPress.com Website to Linode (linode#1954)
Browse files Browse the repository at this point in the history
* Draft finished

* tech edit to migrate wp.com to linode

* techedit tweaks to lamp and wp guides

* added authsocket to dictionary

* keywords in shortguides to appease travis

* Copy edited

Formatting fix in use-linode-nameservers shortguide.
  • Loading branch information
nmelehan authored and Guaris committed Aug 16, 2018
1 parent 278cc6e commit 73cb705
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 78 deletions.
1 change: 1 addition & 0 deletions ci/vale/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ authmysql
authmysqlrc
authn
authomator
authsocket
authy
autocompletion
autoconfiguration
Expand Down
23 changes: 23 additions & 0 deletions docs/limited-user-note-shortguide/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
author:
name: Linode
email: [email protected]
description: 'Shortguide that displays the limited user note used in many guides.'
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
modified: 2018-08-03
modified_by:
name: Nathan Melehan
published: 2018-08-03
title: Limited User Alert
keywords: []
shortguide: true
show_on_rss_feed: false
---

{{< note >}}

This guide is written for a non-root user. Commands that require elevated privileges are prefixed with `sudo`. If you're not familiar with the `sudo` command, visit our [Users and Groups](/docs/tools-reference/linux-users-and-groups/) guide.

All configuration files should be edited with elevated privileges. Remember to include `sudo` before running your text editor.

{{< /note >}}
2 changes: 1 addition & 1 deletion docs/networking/dns/use-linode-name-servers/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Most nameserver authorities will allow you to set the TTL on your domain or on i

{{< image src="whois-icann-registrar.png" alt="linode.com nameservers" title="whois.icann.org lookup of nameservers for linode.com" >}}

Your registrar may not be the same organization as your current nameserver authority, though they often are, as registrars generally offer free DNS services.
Your registrar may not be the same organization as your current nameserver authority, though they often are, as registrars generally offer free DNS services.

1. Log in to your domain registrar's control panel and update the authoritative nameservers to be Linode's nameservers:

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
author:
name: Nathan Melehan
email: [email protected]
description: 'Shows how to export posts from a WordPress.com website and import them to WordPress on a Linode.'
keywords: ["wordpress", "wordpress.com", "migrate", "website migration"]
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
modified: 2018-08-07
modified_by:
name: Linode
published: 2018-08-07
title: How to Migrate a WordPress.com Website to Linode
external_resources:
- '[WordPress.com: Moving to Self-Hosted WordPress](https://move.wordpress.com/)'
---

This guide describes how to export your content from WordPress.com and self-host your WordPress website on Linode. Read the [Best Practices when Migrating to Linode](/docs/platform/migrate-to-linode/best-practices-when-migrating-to-linode/) guide prior to following this guide for more information about migrating your site.

Ubuntu 18.04 is used as the distribution for the new Linode deployment in this guide. If you'd like to choose another distribution, use the examples here as an approximation for the commands you'll need to run. You will also install either a [LAMP](/docs/web-servers/lamp/install-lamp-stack-on-ubuntu-18-04/) or [LEMP](/docs/web-servers/lemp/how-to-install-a-lemp-server-on-ubuntu-18-04/) environment on your new Linode.

{{< note >}}
WordPress.com's export feature will export pages, posts, and comments from your site, but it will not export your themes and widgets. You will need to customize your new self-hosted WordPress site's appearance after completing your migration.
{{< /note >}}

## Migrate Your Website

### Deploy Your Linode

1. Follow Linode's [Getting Started](/docs/getting-started/) guide and choose Ubuntu 18.04 as your Linux image when deploying. Choose a Linode plan with enough storage space to accommodate the website data from your current host.

1. Follow the [How to Secure Your Server](/docs/security/securing-your-server/) guide and create a limited Linux user with `sudo` privileges.

1. Follow the [Install WordPress on Ubuntu 18.04](/docs/websites/cms/install-wordpress-ubuntu-18-04) guide to stand up a new web server and WordPress installation. Later in this guide you will use the WordPress credentials you create during the installation, so be sure to record them.

### Export Your WordPress.com Content

1. Login to your WordPress.com dashboard and navigate to the `Settings` page. Choose the `Export` option from the `Settings` page:

![WordPress.com Settings Page](wordpressdotcom-settings.png "Choose the Export option from the Settings page.")

1. Click `Export All`, then `Download` to download a compressed file of your content in XML form. A copy will also be emailed to you:

![WordPress.com Export Page](wordpressdotcom-export.png "Click Export All to export your content to an XML file.")

To export posts, pages, or feedback from the site, press the down arrow to the right of the `Export All` button.

1. Unzip the file.

### Import Your Content on Linode

1. Visit your Linode-hosted WordPress login from your browser (usually `http://<your-linode-ip>/wp-admin`) and login with your WordPress credentials.

1. Navigate to the Import page of the Tools section. The WordPress importer plugin will be listed:

![WordPress Tools Page](tools-import-wordpress.png "WordPress Importer plugin.")

1. Choose `Install Now` and then run this plugin. On the page that appears, click `Choose File` and locate the XML file you previously exported from WordPress.com to your computer:

![WordPress Importer Plugin - Page 1](wordpress-importer-plugin-1.png "Import file dialog box.")

1. A page will appear that surfaces a few import options:

![WordPress Importer Plugin - Page 1](wordpress-importer-plugin-2.png "Import file options show author and post options.")

You are able to assign your imported posts to:

- Your previous WordPress.com user, which will also be imported
- A brand new user that the import plugin will create
- One of the WordPress users you've already created on your Linode as part of deploying your web server

**Be sure to enable** the *Download and import file attachment* option on this page.

1. Submit this form. Your content will now be imported.

1. Navigate to the `Permalinks` page in the `Settings` section:

![WordPress Permalinks](wordpress-permalinks.png "WordPress permalinks day and name option.")

1. Choose the `Day and name` option and save the change. This option matches the permalink style used on WordPress.com.

## Migrating DNS Records

The last step required to migrate is to update your DNS records to reflect your new Linode's IP. Once this is done, visitors will start loading the page from your Linode.

{{< content "use-linode-name-servers" >}}

## Next Steps

The WordPress.com team recommends installing the [Jetpack plugin](https://jetpack.com/) on your new self-hosted WordPress site. This free plugin is maintained by the WordPress.com team and provides features available on your WordPress.com site, including analytics, site management tools, and access to the [WordPress.com apps](https://apps.wordpress.com/). [Premium versions](https://jetpack.com/pricing/) of the Jetpack plugin provide extra features.

If you had subscribers on your WordPress.com site, you can also migrate them to your new self-hosted site. This requires that you install the Jetpack plugin and uses Jetpack's [subscription migration tool](https://jetpack.com/support/subscription-migration-tool/).

Your new self-hosted WordPress site uses the default theme and widgets. Review the WordPress.org documentation for [themes](https://codex.wordpress.org/Using_Themes#Adding_New_Themes_using_the_Administration_Panels) and [widgets](https://codex.wordpress.org/WordPress_Widgets) to learn how to customize your site's appearance.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 25 additions & 44 deletions docs/web-servers/lamp/install-lamp-stack-on-ubuntu-18-04/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ This guide shows how to install and test a LAMP stack on Ubuntu 18.04 (LTS).

<!-- ![Install LAMP on Ubuntu 18.04](install-lamp-on-ubuntu-18-04.png "Install LAMP on Ubuntu 18.04") -->

{{< note >}}
This guide is written for a non-root user. Commands that require elevated privileges are prefixed with `sudo`. If you're not familiar with the `sudo` command, see the [Linux Users and Groups guide](/docs/tools-reference/linux-users-and-groups/).
{{< content "limited-user-note-shortguide" >}}

Replace each instance of `example.com` in this guide with your site's domain name.
{{< /note >}}
Replace each instance of `example.com` in this guide with your site's domain name or IP.

## Before You Begin

Expand All @@ -45,11 +43,11 @@ Replace each instance of `example.com` in this guide with your site's domain nam

Instead of installing Apache, MySQL, and PHP separately, Tasksel offers a convenient way to get a LAMP stack running quickly.

1. Install Tasksel if not already installed by default.
1. Install Tasksel if not already installed by default:

sudo apt install tasksel

2. Use Tasksel to install the LAMP stack.
1. Use Tasksel to install the LAMP stack:

sudo tasksel install lamp-server

Expand All @@ -61,19 +59,18 @@ If you prefer not to install the bundled packages via Tasksel, you can instead i

sudo apt install apache2

2. Install the `mysql-server` package:
1. Install the `mysql-server` package:

sudo apt install mysql-server

3. Install PHP, the PHP Extension and Application Repository, Apache support, and MySQL support:
1. Install PHP, the PHP Extension and Application Repository, Apache support, and MySQL support:

sudo apt install php7.2 libapache2-mod-php7.2 php-mysql

Optionally, install additional cURL, JSON, and CGI support:

sudo apt install php-curl php-json php-cgi


## Configuration

### Apache
Expand All @@ -93,7 +90,7 @@ KeepAliveTimeout 5
The `MaxKeepAliveRequests` setting controls the maximum number of requests during a persistent connection. 50 is a conservative amount; you may need to set this number higher depending on your use-case. The `KeepAliveTimeout` setting controls how long the server waits (measured in seconds) for new requests from already connected clients. Setting this to 5 will avoid wasting RAM.
{{< /note >}}

2. The default *multi-processing module* (MPM) is the **prefork** module. `mpm_prefork` is the module that is compatible with most systems. Open the `mpm_prefork.conf` file located in `/etc/apache2/mods-available` and edit the configuration. Below are the suggested values for a **2GB Linode**:
1. The default *multi-processing module* (MPM) is the **prefork** module. `mpm_prefork` is the module that is compatible with most systems. Open the `mpm_prefork.conf` file located in `/etc/apache2/mods-available` and edit the configuration. Below are the suggested values for a **2GB Linode**:

{{< file "/etc/apache2/mods-available/mpm_prefork.conf" aconf >}}
<IfModule mpm_prefork_module>
Expand All @@ -105,12 +102,12 @@ The `MaxKeepAliveRequests` setting controls the maximum number of requests durin
</IfModule>
{{< /file >}}

3. Disable the event module and enable prefork:
1. Disable the event module and enable prefork:

sudo a2dismod mpm_event
sudo a2enmod mpm_prefork

4. Restart Apache:
1. Restart Apache:

sudo systemctl restart apache2

Expand All @@ -120,9 +117,9 @@ You can set up virtual hosts several ways, and the following steps outline the r

1. Create a copy of the default Apache configuration file for your site:

sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/example.com.conf

2. Open the new `example.com` configuration file in your text editor. Uncomment the `ServerName` option and update it with your domain. Enter the document root path and log directories as shown below, and add a `Directory` block before `<VirtualHost>`:
1. Open the new `example.com` configuration file in your text editor. Uncomment the `ServerName` option and update it with your domain. Enter the document root path and log directories as shown below, and add a `Directory` block before `<VirtualHost>`:

{{< file "/etc/apache2/sites-available/example.com.conf" apache >}}
<Directory /var/www/html/example.com/public_html>
Expand All @@ -142,32 +139,32 @@ You can set up virtual hosts several ways, and the following steps outline the r
{{< /file >}}

{{< note >}}
The file example above has all comment sections removed for brevity; you may keep or remove the commented areas as you see fit.
The file example above has all comment sections removed for brevity. Keep or remove the commented areas as you see fit.

The `ServerAlias` directive allows you to include multiple domain names or subdomains for a single host. The example above allows visitors to use `example.com` or `www.example.com` to navigate to this virtual host.
{{< /note >}}

3. Create the directories referenced above:
1. Create the directories referenced above:

sudo mkdir -p /var/www/html/example.com/{public_html,logs}

{{< note >}}
Make sure that you do not put a space after the comma between `public_html` and `logs` because it will create a folder named `{public_html,` and will cause an error when you will reload Apache.
{{< /note >}}

4. Link your virtual host file from the `sites-available` directory to the `sites-enabled` directory:
1. Link your virtual host file from the `sites-available` directory to the `sites-enabled` directory:

sudo a2ensite example.com

{{< note >}}
If you need to disable your website, run `a2dissite example.com`.
To disable your website, run `a2dissite example.com`.
{{< /note >}}

5. Disable the default virtual host to minimize security risks:
1. Disable the default virtual host to minimize security risks:

sudo a2dissite 000-default.conf

6. Reload Apache:
1. Reload Apache:

sudo systemctl reload apache2

Expand All @@ -181,38 +178,22 @@ If there are additional websites you wish to host on your Linode, repeat the abo

sudo mysql -u root

The database will not prompt you for a password, as it is initially configured to use the `auth_socket` authorization plugin. This authorization scheme allows you to log in to the database's root user as long as you are connecting from the Linux root user on localhost:
{{< highlight sql >}}
mysql> SELECT user,host,authentication_string,plugin FROM mysql.user WHERE user='root';
+------+-----------+-----------------------+-------------+
| user | host | authentication_string | plugin |
+------+-----------+-----------------------+-------------+
| root | localhost | | auth_socket |
+------+-----------+-----------------------+-------------+
1 row in set (0.02 sec)
{{< /highlight >}}

2. You can keep using the `auth_socket` plugin, and this is considered a secure option for production systems. If you'd rather switch to password authentication and assign a password, enter the following commands. Replace `password` with a new root password:

{{< highlight sql >}}
ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'password';
FLUSH PRIVILEGES;
{{< /highlight >}}
{{< content "mysql-authsocket-authentication-note-shortguide" >}}

3. Create a database and a user with permissions for it. In this example, the database is called `webdata`, the user `webuser`, and password `password`. Be sure to enter your own password; this should be different from the root password for MySQL:
1. Create a database and a user with permissions for it. In this example, the database is called `webdata`, the user `webuser`, and password `password`. Be sure to enter your own password. This should be different from the root password for MySQL:

{{< highlight sql >}}
CREATE DATABASE webdata;
GRANT ALL ON webdata.* TO 'webuser' IDENTIFIED BY 'password';
{{< /highlight >}}

4. Exit the SQL shell:
1. Exit the SQL shell:

{{< highlight sql >}}
quit
{{< /highlight >}}

5. Use the *[mysql_secure_installation](https://mariadb.com/kb/en/library/mysql_secure_installation/)* tool to configure additional security options. This tool will ask if you want to set a new password for the MySQL root user, but you can skip that step:
1. Use the *[mysql_secure_installation](https://mariadb.com/kb/en/library/mysql_secure_installation/)* tool to configure additional security options. This tool will ask if you want to set a new password for the MySQL root user, but you can skip that step:

sudo mysql_secure_installation

Expand All @@ -237,12 +218,12 @@ error_log = /var/log/php/error.log
The beginning of the `php.ini` file contains examples commented out with a semicolon (**;**), which disables these directives. Ensure that the lines you modify in this step follow the examples section and are uncommented.
{{< /note >}}

2. Create the log directory for PHP and give ownership to the Apache system user:
1. Create the log directory for PHP and give ownership to the Apache system user:

sudo mkdir /var/log/php
sudo chown www-data /var/log/php

3. Restart Apache:
1. Restart Apache:

sudo systemctl restart apache2

Expand Down Expand Up @@ -283,9 +264,9 @@ In this section, you'll create a test page that shows whether Apache can render

{{< /file >}}

2. Navigate to `example.com/phptest.php` from your local machine. If the components of your LAMP stack are working correctly, the browser will display a "Connected successfully" message. If not, the output will be an error message.
1. Navigate to `example.com/phptest.php` from your local machine. If the components of your LAMP stack are working correctly, the browser will display a "Connected successfully" message. If not, the output will be an error message.

3. Remove the test file:
1. Remove the test file:

sudo rm /var/www/html/example.com/public_html/phptest.php

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
author:
name: Linode
email: [email protected]
description: 'Shortguide that describes how MySQL auth_socket authentication works.'
license: '[CC BY-ND 4.0](https://creativecommons.org/licenses/by-nd/4.0)'
modified: 2018-08-03
modified_by:
name: Nathan Melehan
published: 2018-08-03
title: About MySQL auth_socket Authentication
keywords: []
shortguide: true
show_on_rss_feed: false
---

{{< disclosure-note "About MySQL authentication" >}}

By default, MySQL is configured to use the `auth_socket` authorization plugin. This authorization scheme allows you to log in to the database's root user as long as you are connecting from the Linux root user on localhost, or as a user with sudo privileges (i.e. with `sudo mysql -u root`). In this scheme, no password is assigned to MySQL's root user:

{{< highlight sql >}}
mysql> SELECT user,host,authentication_string,plugin FROM mysql.user WHERE user='root';
+------+-----------+-----------------------+-------------+
| user | host | authentication_string | plugin |
+------+-----------+-----------------------+-------------+
| root | localhost | | auth_socket |
+------+-----------+-----------------------+-------------+
1 row in set (0.02 sec)
{{< /highlight >}}

You can keep using the `auth_socket` plugin, and this is considered a secure option for production systems. If you'd rather switch to password authentication and assign a password, enter the following commands. Replace `password` with a new root password:

{{< highlight sql >}}
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH 'mysql_native_password' BY 'password';
mysql> FLUSH PRIVILEGES;
{{< /highlight >}}

After making this change, you should pass the `-p` option when invoking the MySQL shell:

mysql -u root -p

{{< /disclosure-note >}}
Loading

0 comments on commit 73cb705

Please sign in to comment.