0
1

More than 3 years have passed since last update.

DrushコマンドでDrupalをインストールして起動する

Posted at

ComposerでDrupalをダウンロード

composerでdrupalプロジェクトを作成し、プロジェクトルートに移動します。

$ composer create-project drupal/recommended-project drupal-demo
$ cd drupal-demo

デフォルトではDrushは入っていないので、別途composerでダウンロードします。

$ composer require drush/drush

インストール

DrushでDrupalのインストールを行います。

例では $ ./vendor/bin/drush で作成したDrupalプロジェクトのDrushを指定していますが、Drush Launcherをインストールしている方は $ drush コマンドで実行できます。

$ ./vendor/bin/drush site:install standard --db-url=sqlite://sites/default/files/.ht.sqlite

...省略...
[notice] Performed install task: install_finished
[success] Installation complete.  User name: admin  User password: R75E6JeDfJ

コマンドの第一引数でインストールプロファイルを指定しています。デフォルト値は standard です。初期インストールでは、データベースURLを指定するための --db-url オプションが必須です。今回はSQLiteを使用します。

ユーザー名とパスワードは入力がなければDrush側で自動的に発行して、標準出力してくれます。

起動

ポート番号を指定してWebサーバーを立ち上げます。下のコマンドでは、8080ポートで起動する例です。

$ ./vendor/bin/drush runserver 8080
0
1
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
1