【LANDO】公開済みのDRUPALサイトをローカル環境に復元する

この記事は現役ウェブディベロッパーがわかりやすさにこだわって作成しました

This tutorial explains how to install an existing Drupal 9 website locally with Lando.

DRUPAL用の仮想環境を構築する

reciepeにDRUPAL9をドキュメントルートにwebフォルダを設定してDRUPAL用の仮想サーバー環境を構築する

LANDOの場合

lando init --source cwd --recipe drupal9 --webroot web --name stefvanlooveren

手動でCOMPOSER INSTALLを後の工程で行うため、 –no-install オプションをつける

lando start

DRUSHの場合

 composer create-project --no-install -n drupal/recommended-project:9.3.16 academy

リポジトリからソースコードを展開する

公開済みDRUPALのソースコードを仮想環境に展開する

git clone <my-repository>

COMPOSERを実行する

必要なパッケージ等をここでインストールする

composer install

DRUSHをインストールする

composer require drush/drush

 Drupal新規サイトを構築する

仮想環境が構築できたら次にDRUPALアプリをインストールする。

lando drush si --db-url=mysql://drupal9:drupal9@database/drupal9 --account-pass=content -y

If drush was not working at this stage, do the command below and after this the command above again:

lando rebuild

Output should now look as this:

 [notice] Starting Drupal installation. This takes a while.
 [notice] Performed install task: install_select_language
 [notice] Performed install task: install_select_profile
 [notice] Performed install task: install_load_profile
 [notice] Performed install task: install_verify_requirements
 [notice] Performed install task: install_settings_form
 [notice] Performed install task: install_verify_database_ready
 [notice] Performed install task: install_base_system
 [notice] Performed install task: install_bootstrap_full
 [notice] Performed install task: install_profile_modules
 [notice] Performed install task: install_profile_themes
 [notice] Performed install task: install_install_profile
 [notice] Performed install task: install_configure_form
 [notice] Cron run completed.
 [notice] Performed install task: install_finished
 [success] Installation complete.

I have a default installation available at myproject.lndo.site !

データベースを復元する

データベースをインポートしてデータを復元する。

LANDOの場合

lando db-import backup.mysql

DRUSHの場合

drush sql-cli < backup.sql

sitesフォルダの権限を変更する

web/sitesフォルダの権限を変更する

これをしないと、起動時にスタイルシートが読み込めないので必ず行うこと。

デバッグ設定を行う

最後にエラーが発生したときにエラー内容を表示するように設定を変更する

参考

こちらの記事を参考にさせていただきました

How to: install an existing Drupal site on Lando | Stef Van Looveren
This tutorial explains how to install an existing Drupal 9 website locally with Lando.
PHP/Javascript/WORDPRESS案件全般承ります

この記事についてのご質問またはお困りのことがございましたら、お気軽にお問い合わせください。

タイトルとURLをコピーしました