0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

WordPress プラグイン Updraft (無料) を使ってバックアップ

Posted at

前提

ローカル開発環境として、wordpress-develop を使用しています。Node.js と npm があれば、WSL2の Docker コンテナ上に WordPress 環境を構築できます。

Word Pressにサイトにログインできることが前提となります。

また、WordPressをマルチサイトホストしている場合は UpdraftPlus Premium (有料) や UpdraftCentral 、あるいはその両方が必要。

【ローカル】Updraft ( バックアップツール )

ローカルで直接 WordPressのテーマとかテンプレートを書く想定で、バックアップは別のミラーサイトとしてとっておこうと思います。

バックアップのために、Updraft を使用して ローカルサイトをミラー (コピー) しようと思います。

下記のようにコマンドでもインストール&有効化できます。( wordpress-develop の場合 )

  • マルチサイトではなく、普通のインストールなら、--activate でインストールと同時に有効化。
  • バーチャルホストのマルチサイト全体にインストール&有効化する場合、 --activate-network をつける
.bash
# Node.js パッケージである wordpress-develop の機能で Updraft をインストールする。(今回は wordpress-develop の WP-CLI を npm で使用。)

# プラグインを検索 ( 1行目 の updraftplus をインストールしていく )
npm run env:cli -- plugin search updraft

> WordPress@6.9.0 env:cli
> node ./tools/local-env/scripts/docker.js exec --user wp_php cli wp plugin search updraft

Success: Showing 10 of 21 plugins.
+------------------------------------------------+--------------------------------------------------+--------+
| name                                           | slug                                             | rating |
+------------------------------------------------+--------------------------------------------------+--------+
| UpdraftPlus: WP Backup & Migration Plugin  | updraftplus                                      | 96     |
| Exclude Image Thumbnails From UpdraftPlus Back | de-updraftplus-backup-exclude-image-thumbnails   | 100    |
| ups                                            |                                                  |        |
| UpdraftCentral Dashboard                       | updraftcentral                                   | 90     |
| SSH SFTP Updater Support                       | ssh-sftp-updater-support                         | 96     |
| Disable Admin WP Cron Notice For UpdraftPlus   | de-updraftplus-disable-admin-wp-cron-notice      | 0      |
| DE Hide UpdraftPlus Dashboard News             | de-hide-updraftplus-dashboard-news               | 20     |
| LifterLMS – WP LMS for eLearning, Online | lifterlms                                        | 96     |
|  Courses, & Quizzes                        |                                                  |        |
| Simba Plugin Updates Manager                   | simba-plugin-updates-manager                     | 100    |
| PDF Invoices & Packing Slips for WooCommer | woocommerce-pdf-invoices-packing-slips           | 100    |
| ce                                             |                                                  |        |
| Internal Link Juicer: SEO Auto Linker for Word | internal-links                                   | 94     |
| Press                                          |                                                  |        |
+------------------------------------------------+--------------------------------------------------+--------+

# updraftplus をインストール。
npm run env:cli -- plugin install updraftplus

> WordPress@6.9.0 env:cli
> node ./tools/local-env/scripts/docker.js exec --user wp_php cli wp plugin install updraftplus

Installing UpdraftPlus: WP Backup & Migration Plugin (1.25.7)
Downloading installation package from https://downloads.wordpress.org/plugin/updraftplus.1.25.7.zip...
Unpacking the package...
Installing the plugin...
Plugin installed successfully.
Success: Installed 1 of 1 plugins.

  • CLI に慣れていて WP-CLI ( wp コマンド ) がインストールされている方は、個人的に WP-CLI のほうがインストールが楽です。
  • 実際のバックアップとかは、WP-CLI による実行は有料 ( Updraft Premium ) サポートなので、WordPress サイトにログインして実行してください。

UpdraftPlus を使用してバックアップする

ログイン情報の更新

まず、wordpress-develop の GitHub の README にしたがって、以下のクレデンシャルで http://localhost:8889/wp-admin にログインします。

Credencial
( 中略 )
To login to the site, navigate to http://localhost:8889/wp-admin.

Username: admin
Password: password

スクリーンショット (112).png

最初にログインしたら、パスワードを変更します。

↓なんか、Chrome も注意をしてくれました。

スクリーンショット (99).png

公式に従います:

To generate a new password (recommended):

Go to the Dashboard
Click the Users menu on the left
Click the Edit link below the admin user
Scroll down and click 'Generate password'. Either use this password (recommended) or change it, then click 'Update User'. If you use the generated password be sure to save it somewhere (password manager, etc).

[Dashboard] > 左上の [ ]> [All Users]

スクリーンショット (103).png

[Username] のパネルに admin ユーザーがあるので、そこにカーソルをあてて [Edit] をクリック。

スクリーンショット (106).png

プロフィール編集画面が開きます。
下の方に "Account Management" とあるところの、[Set New Password] をクリック。

任意のパスワードを入力し、"Update Profile" をクリック。

スクリーンショット (110).png

アクティベート (プラグイン)

Plugins > UpdraftPlus からアクティベート (有効化)

  • npm run env:cli -- plugin install updraftplus --activate でインストール時に有効化も可能。

admin ユーザー ( 初期管理者ユーザ ) 以外のユーザを作成する

WordPress のユーザーとして、デフォルトの管理者ユーザ ( admin ) 以外に、別の管理者用 ユーザーを追加します。

そのため、以下に沿ってあたらしいユーザーを作成。

Dashboard >Users > [All Users]

スクリーンショット (117).png

[Add User] ボタンを選択。

Role を Administrator にする

スクリーンショット (118).png

Password がrandom生成になっているので好きなパスワードにする。

[Add User] で完了。

もういちど、あららしいゆーざでログイン。

※ax.k.onoda@gmail.comを登録しないで下さい。

WordPress の 管理者 E メールアドレスの登録

[Dashboard] > 左上の [ ] or 左に表示されているメニュー一覧 から>
Settings (General) > Administration Email Address
[ Save Changes ] で、新しい Email アドレスにメールが来るのを待ちましょう。

もし、登録したEmailアドレスが There is a pending change of the admin email to < Emailアドレス> として表示されている場合:
Chrome のキャッシュを削除し、それでも表示されているならば、メッセージ右にある Cancel リンクを押して、もう一度別の (上記で作成したユーザの ) 登録メールアドレス に変更します。

  • それでも Email が一日たっても来なかったら、WP-CLI でデータベースを強制書き換え。(これが最も早く確実)
.bash
# WP-CLI で wp_poption の admin_email フィールドを設定する
npm run env:cli -- option update admin_email your-correct-address@icloud.com
 
> WordPress@6.9.0 env:cli
> node ./tools/local-env/scripts/docker.js exec --user wp_php cli wp option update admin_email your-correct-address@icloud.com

Success: Updated 'admin_email' option.

Updraft こうなっていれば OK → [Save Changes] クリック

スクリーンショット (121).png

【サイトにログインしてEmail アドレスを登録する場合】→非推奨

Setteing (General) > Administration Email Address

スクリーンショット (119).png

Confirm しないと新しいのがアクティベートされません。
( 一時的に There is a pending change of the admin email to <新しい Emailアドレス> という表示になります。 )

メールが届かないことがあります。そもそも、admin ユーザー ベストプラクティスとして推奨されていない ので、届かない可能性があります。

Perhaps you created your website with the default administrator username “admin” and later learned that’s not the best security practice and would like to change your own username.

ユーザー名が admin 以外のアカウントを作成し、再度そのユーザーでログインして、Email アドレスの変更を行います。

レポートの有効化

[Dashboard] > 左上の [ ]>
UpdraftPlus > Settings

スクリーンショット (113).png

Updraft の画面が開きます。Settings のタブをクリック。

スクリーンショット (114).png

下の方に、Email という項目がありますのでチェック。上で登録したメールアドレス ( 上の例 で WP‐CLIに より アップデートした your-correct-address@iclud.com )が表示されていることを確認します。

[ Save Changes ] をクリック。

スクリーンショット (121).png

バックアップ先の選択

UpdraftPlus > Settings

スクリーンショット (122).png

DropBox, Google Drive, Azure, S3, Google Cloud など、いろいろなクラウドストレージがあります。
今回、DropBox ( 無料プラン 2GB を使っています ) でやろうと思います。

バックアップ頻度の設定

2 GB しかないので Manual にしました。
[Save Changes] を押して設定を保存。

【DropBox にバックアップする場合】DropBox の認証

Authentication with DropBox
正しいアカウントにログインしていることを確認してください。[Save Changes] を押して設定を保存したら、この画面に戻ってリンク先にしたがって認証を完了してください。

スクリーンショット (123).png

[Save Changes ] を押したら出てきたリンクを押せば、認証が実行されます。

スクリーンショット (124).png

DropBox の認証画面で、アカウントを選択します。

スクリーンショット (125).png

Complete Setup をクリックします。

スクリーンショット (126).png

Wordpress にログインします。

スクリーンショット (127).png

Authentication with DropBox
(You are already authenticated) になっていることが確認できます。

スクリーンショット (128).png

バックアップしてみる

Backup / Restore タブより、"Backup Now" ( いますぐバックアップ ) をクリック。

スクリーンショット (129).png

[Perform a backup] ウィンドウで、Take a new backup > Backup Now をクリックし実行。

スクリーンショット (130).png

バックアップが完了。(Existing backups に新しいレコードが追加されています。)

スクリーンショット (133).png

Dropbox (デスクトップ) に「アプリ/UpdraftPlus.Com」が追加され、

スクリーンショット (134).png

その中にバックアップが gz、zip形式で作成されていました。

スクリーンショット (135).png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?