はじめに
drupal8の新規インストールについて記載します。
すでにdrupal6やdrupal7のサイトを運営していて、drupal8へアップグレードする場合であっても、別途、drupal8の新規インストールが必要です。
ここでは以下の環境にインストールしています。
OS | CentOS 7.5.1804 |
---|---|
WebServer | Nginx 1.15.0 + PHP-FPM |
PHP | 7.1.7 |
Database | MariaDB 10.2.15 |
情報収集
drupal8の現状はまだまだ開発中の機能が多く、コアに含める計画だった機能も実際は段階的に実装といった状況のものもあります。そのため、コアとコア以外のモジュールのバージョンが依存しているものが多々あります。インストールするコアバージョンを選択する場合、通常は最新の安定版をインストールするのがセオリーですが、サイトでどんなことをしたいのか?で必ず最新版が好ましいとは限りません。
必ず、使用していたモジュールの状況把握のため情報収集が必要です。
また、脆弱性が発見されたコアのバージョンは避けるべきです。
2018年6月現在でインストールするのであれば、8.5.3以降になると思います。
しかし、情報検索でヒットする情報はほとんどが8.1前後のものが多く、現在はあまり参考になりません。
コアやcontribモジュール以外にもdrushやdrupal consoleの情報も必要です。
drushに関して
drupal8に対応したdrushはdrush8とdrush9です。
drush9はcomposerからのみインストール可能です。
コア8.4以降はdrush9を使用しないといけないように記載がありますが、drush8でも問題なく動作していましたので、すでにdrush8を使っているなら理由もなくdrush9にする必要はないと思います。composerを使うと非常に遅いのでcomposerを使っていない環境であればdrush8のままがおすすめです。drush9になるとdrush8の「drush dl モジュール名」でダウンロードできません。他にもいろいろコマンドがなくなっていてcomposerで対応しているものもあればできなくなっていることもあるので厄介です。
drushとcomposerを使い分けるのが面倒です。
composerで不要になったモジュールを削除すると依存関係のあるモジュールも削除されてしまう場合がありますが、そのモジュールはdrupalシステムからまだアンインストール(drush pmu モジュール名)していないので、当然、drupalシステムでエラーが発生します。
アップグレードの場合は最新版がおすすめ
アップグレードの場合は、アップグレードモジュールがまだ完全ではなく日々進化していっていますのでなるべく最新のものがよいと思います。Web UIを使ったアップグレードモジュールはコアに含まれていますので最新版のコアが成果物が盛り込まれていておすすめです。
アップグレード前に実際に使ってみる
アップグレードの場合には、アップグレード先としてインストールウィザードを終えたdrupal8のサイトが必要です。この状態のバックアップを保存しておけば、アップグレードするときにリストアすれば準備が整います。コア以外の各contribモジュールではd6/d7からのアップグレードパスはほとんど用意されていませんので同じ名称のプロジェクトでもコアバージョンが異なれば全く異なる可能性があります。すぐにアップグレードをせずにまずdrupal8を実際に使ってモジュールの状況など把握してからでも遅くないと思います。
簡単になったインストール方法
サーバ要件を満たしていれば、簡単にインストールが可能です。
composerを使えばdrushやdrupal consoleまで含めたインストールが可能になりました。
インストール方法は従来通りの方法、drushを使った方法、composerを使った方法があります。
composerを使ってdrupalサイトの依存関係を管理するのであれば、OptionA/B/Cの方法があります。
drushやdrupal consoleを含んでいるのはOptionA/B(OptionC以外)です。
おすすめはAですが、プロジェクトを/var/www/html/drupal8にすると、ドキュメントルートは/var/www/html/drupal8/webになりますので注意が必要です。
Option Cはcomposerでコアのアップグレードができないのはデメリットです。
以下は、composerを使ったOption Aの方法です。
composerなど事前に必要なツールは導入済みです。
インストール情報
以下の内容でdrupal8をインストールする前提で説明します。
※説明用ですので実際には適切に環境に合わせて変更してください。
プロジェクトパス | /var/www/sites/drupal8 |
---|---|
ドキュメントルート | /var/www/sites/drupal8/web |
データベース名 | drupal8 |
データベース管理ユーザ名 | admin |
データベース管理ユーザパスワード | Zaq12wsx |
データベースホスト名 | localhost |
データベース接続ポート番号 | 3306 |
テーブル名プリフィックス | なし(デフォルト) |
言語の選択 | 日本語 |
プロファイルの選択 | 標準 |
サイト名 | TEST SITE |
サイトのメールアドレス | postmaster@example.com |
サイトメンテナンスのアカウント ユーザ名 |
drupal_admin |
サイトメンテナンスのアカウント パスワード |
Xsw23edc |
デフォルトの国 | 日本 |
デフォルトのタイムゾーン | Asia/Tokyo |
※テーブルプリフィックスは、最近では少ないと思いますがレンタルサーバなどで1データベースまでの制限がある場合に利用すればよいと思います。
drupal8のインストール
プロジェクトの作成とコアのダウンロード
最初にcomposer自身を最新版にしておきます。
$ composer self-update
You are already using composer version 1.6.5 (stable channel).
$ cd /var/www/sites
$ composer create-project drupal-composer/drupal-project:8.x-dev drupal8 --stability dev --no-interaction
Installing drupal-composer/drupal-project (8.x-dev 04138e374bdeeb838020c2a1c4b0591118686d45)
- Installing drupal-composer/drupal-project (8.x-dev 04138e3): Cloning 04138e374b
Created project in drupal8
> DrupalProjectcomposerScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 123 installs, 0 updates, 0 removals
- Installing cweagans/composer-patches (1.6.5): Loading from cache
- Installing composer/installers (v1.5.0): Loading from cache
- Installing composer/semver (1.4.2): Loading from cache
- Installing drupal-composer/drupal-scaffold (2.5.2): Loading from cache
- Installing symfony/polyfill-ctype (v1.8.0): Loading from cache
- Installing symfony/finder (v3.4.11): Loading from cache
- Installing symfony/yaml (v3.4.11): Loading from cache
- Installing drupal/console-extend-plugin (0.9.2): Loading from cache
- Installing paragonie/random_compat (v2.0.15): Loading from cache
- Installing symfony/polyfill-php70 (v1.8.0): Loading from cache
- Installing symfony/polyfill-mbstring (v1.8.0): Loading from cache
- Installing symfony/http-foundation (v3.4.11): Loading from cache
- Installing symfony/dom-crawler (v3.4.11): Loading from cache
- Installing symfony/css-selector (v3.4.11): Loading from cache
- Installing symfony/var-dumper (v3.4.11): Loading from cache
- Installing psr/log (1.0.2): Loading from cache
- Installing symfony/debug (v3.4.11): Loading from cache
- Installing symfony/console (v3.4.11): Loading from cache
- Installing nikic/php-parser (v4.0.2): Loading from cache
- Installing jakub-onderka/php-console-color (0.1): Loading from cache
- Installing jakub-onderka/php-console-highlighter (v0.3.2): Loading from cache
- Installing dnoegel/php-xdg-base-dir (0.1): Loading from cache
- Installing psy/psysh (v0.9.6): Loading from cache
- Installing psr/http-message (1.0.1): Loading from cache
- Installing guzzlehttp/psr7 (1.4.2): Loading from cache
- Installing guzzlehttp/promises (v1.3.1): Loading from cache
- Installing guzzlehttp/guzzle (6.3.3): Loading from cache
- Installing webmozart/assert (1.3.0): Loading from cache
- Installing webmozart/path-util (2.3.0): Loading from cache
- Installing webflo/drupal-finder (1.1.0): Loading from cache
- Installing twig/twig (v1.35.3): Loading from cache
- Installing symfony/translation (v3.4.11): Loading from cache
- Installing symfony/process (v3.4.11): Loading from cache
- Installing symfony/filesystem (v3.4.11): Loading from cache
- Installing symfony/event-dispatcher (v3.4.11): Loading from cache
- Installing psr/container (1.0.0): Loading from cache
- Installing symfony/dependency-injection (v3.4.11): Loading from cache
- Installing symfony/config (v3.4.11): Loading from cache
- Installing stecman/symfony-console-completion (0.8.0): Loading from cache
- Installing drupal/console-en (1.8.0): Loading from cache
- Installing dflydev/placeholder-resolver (v1.0.2): Loading from cache
- Installing dflydev/dot-access-data (v1.1.0): Loading from cache
- Installing dflydev/dot-access-configuration (v1.0.2): Loading from cache
- Installing drupal/console-core (1.8.0): Loading from cache
- Installing doctrine/collections (v1.5.0): Loading from cache
- Installing doctrine/lexer (v1.0.1): Loading from cache
- Installing doctrine/annotations (v1.6.0): Loading from cache
- Installing alchemy/zippy (0.4.3): Loading from cache
- Installing drupal/console (1.8.0): Loading from cache
- Installing symfony/phpunit-bridge (v3.4.11): Loading from cache
- Installing sebastian/recursion-context (3.0.0): Loading from cache
- Installing doctrine/instantiator (1.1.0): Loading from cache
- Installing sebastian/exporter (3.1.0): Loading from cache
- Installing sebastian/diff (2.0.1): Loading from cache
- Installing sebastian/comparator (2.1.3): Loading from cache
- Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
- Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
- Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
- Installing phpspec/prophecy (1.7.6): Loading from cache
- Installing sebastian/version (2.0.1): Loading from cache
- Installing sebastian/resource-operations (1.0.0): Loading from cache
- Installing sebastian/object-reflector (1.1.1): Loading from cache
- Installing sebastian/object-enumerator (3.0.3): Loading from cache
- Installing sebastian/global-state (2.0.0): Loading from cache
- Installing sebastian/environment (3.1.0): Loading from cache
- Installing phpunit/php-text-template (1.2.1): Loading from cache
- Installing phpunit/phpunit-mock-objects (5.0.7): Loading from cache
- Installing phpunit/php-timer (1.0.9): Loading from cache
- Installing phpunit/php-file-iterator (1.4.5): Loading from cache
- Installing theseer/tokenizer (1.1.0): Loading from cache
- Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
- Installing phpunit/php-token-stream (2.0.2): Loading from cache
- Installing phpunit/php-code-coverage (5.3.2): Loading from cache
- Installing phar-io/version (1.0.1): Loading from cache
- Installing phar-io/manifest (1.0.1): Loading from cache
- Installing myclabs/deep-copy (1.8.1): Loading from cache
- Installing phpunit/phpunit (6.5.8): Loading from cache
- Installing mikey179/vfsstream (v1.6.5): Loading from cache
- Installing jcalderonzumba/gastonjs (v1.2.0): Loading from cache
- Installing behat/mink (dev-master d5ee350): Cloning d5ee350c40
- Installing jcalderonzumba/mink-phantomjs-driver (v0.3.3): Loading from cache
- Installing squizlabs/php_codesniffer (2.9.1): Loading from cache
- Installing drupal/coder (8.2.12): Cloning 984c54a7b1
- Installing instaclick/php-webdriver (1.4.5): Loading from cache
- Installing behat/mink-selenium2-driver (dev-master 93474c6): Cloning 93474c65a2
- Installing symfony/browser-kit (v4.1.0): Loading from cache
- Installing fabpot/goutte (v3.2.2): Loading from cache
- Installing behat/mink-browserkit-driver (1.3.3): Loading from cache
- Installing behat/mink-goutte-driver (v1.2.1): Loading from cache
- Installing zendframework/zend-stdlib (3.2.0): Loading from cache
- Installing zendframework/zend-escaper (2.6.0): Loading from cache
- Installing zendframework/zend-feed (2.10.2): Loading from cache
- Installing zendframework/zend-diactoros (1.7.2): Loading from cache
- Installing symfony/validator (v3.4.11): Loading from cache
- Installing symfony/serializer (v3.4.11): Loading from cache
- Installing symfony/routing (v3.4.11): Loading from cache
- Installing symfony/psr-http-message-bridge (v1.0.2): Loading from cache
- Installing symfony/polyfill-iconv (v1.8.0): Loading from cache
- Installing symfony/http-kernel (v3.4.11): Loading from cache
- Installing symfony/class-loader (v3.4.11): Loading from cache
- Installing symfony-cmf/routing (1.4.1): Loading from cache
- Installing stack/builder (v1.0.5): Loading from cache
- Installing masterminds/html5 (2.3.0): Loading from cache
- Installing egulias/email-validator (1.2.14): Loading from cache
- Installing easyrdf/easyrdf (0.9.1): Loading from cache
- Installing doctrine/inflector (v1.3.0): Loading from cache
- Installing doctrine/cache (v1.7.1): Loading from cache
- Installing doctrine/common (v2.8.1): Loading from cache
- Installing asm89/stack-cors (1.2.0): Loading from cache
- Installing drupal/core (8.5.4): Loading from cache
- Installing container-interop/container-interop (1.2.0): Loading from cache
- Installing league/container (2.4.1): Loading from cache
- Installing grasmash/yaml-expander (1.4.0): Loading from cache
- Installing consolidation/output-formatters (3.2.1): Loading from cache
- Installing consolidation/log (1.0.6): Loading from cache
- Installing consolidation/annotated-command (2.8.4): Loading from cache
- Installing grasmash/expander (1.0.0): Loading from cache
- Installing consolidation/config (1.0.11): Loading from cache
- Installing consolidation/robo (1.3.0): Loading from cache
- Installing chi-teck/drupal-code-generator (1.25.1): Loading from cache
- Installing drush/drush (9.3.0): Loading from cache
- Installing vlucas/phpdotenv (v2.4.0): Loading from cache
paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)
symfony/var-dumper suggests installing ext-symfony_debug ()
symfony/console suggests installing symfony/lock ()
psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)
psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load them)
alchemy/zippy suggests installing ext-zip (To use the ZipExtensionAdapter)
alchemy/zippy suggests installing guzzle/guzzle (To use the GuzzleTeleporter with Guzzle 3)
drupal/console suggests installing symfony/thanks (Thank your favorite PHP projects on Github using the CLI!)
symfony/phpunit-bridge suggests installing ext-zip (Zip support is required when using bin/simple-phpunit)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.5)
phpunit/phpunit suggests installing phpunit/php-invoker (^1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
behat/mink suggests installing behat/mink-zombie-driver (fast and JS-enabled headless driver for any app (requires node.js))
behat/mink suggests installing dmore/chrome-mink-driver (fast and JS-enabled driver for any app (requires chromium or google chrome))
zendframework/zend-feed suggests installing zendframework/zend-cache (ZendCache component, for optionally caching feeds between requests)
zendframework/zend-feed suggests installing zendframework/zend-db (ZendDb component, for use with PubSubHubbub)
zendframework/zend-feed suggests installing zendframework/zend-http (ZendHttp for PubSubHubbub, and optionally for use with ZendFeedReader)
zendframework/zend-feed suggests installing zendframework/zend-servicemanager (ZendServiceManager component, for easily extending ExtensionManager implementations)
zendframework/zend-feed suggests installing zendframework/zend-validator (ZendValidator component, for validating email addresses used in Atom feeds and entries when using the Writer subcomponent)
symfony/validator suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/validator suggests installing symfony/expression-language (For using the Expression validator)
symfony/validator suggests installing symfony/intl ()
symfony/validator suggests installing symfony/property-access (For accessing properties within comparison constraints)
symfony/serializer suggests installing psr/cache-implementation (For using the metadata cache.)
symfony/serializer suggests installing symfony/property-access (For using the ObjectNormalizer.)
symfony/serializer suggests installing symfony/property-info (To deserialize relations.)
symfony/routing suggests installing symfony/expression-language (For using expression matching)
symfony/class-loader suggests installing symfony/polyfill-apcu (For using ApcClassLoader on HHVM)
easyrdf/easyrdf suggests installing ml/json-ld (~1.0)
doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use legacy MongoDB driver)
consolidation/robo suggests installing henrikbjorn/lurker (For monitoring filesystem changes in taskWatch)
consolidation/robo suggests installing natxet/CssMin (For minifying CSS files in taskMinify)
consolidation/robo suggests installing patchwork/jsqueeze (For minifying JS files in taskMinify)
consolidation/robo suggests installing pear/archive_tar (Allows tar archives to be created and extracted in taskPack and taskExtract, respectively.)
Writing lock file
Generating autoload files
- .csslintrc (https://cgit.drupalcode.org/drupal/plain/.csslintrc?h=8.5.4): Downloading (100%)
- .editorconfig (https://cgit.drupalcode.org/drupal/plain/.editorconfig?h=8.5.4): Downloading (100%)
- .eslintignore (https://cgit.drupalcode.org/drupal/plain/.eslintignore?h=8.5.4): Downloading (100%)
- .eslintrc.json (https://cgit.drupalcode.org/drupal/plain/.eslintrc.json?h=8.5.4): Downloading (100%)
- .gitattributes (https://cgit.drupalcode.org/drupal/plain/.gitattributes?h=8.5.4): Downloading (100%)
- .ht.router.php (https://cgit.drupalcode.org/drupal/plain/.ht.router.php?h=8.5.4): Downloading (100%)
- .htaccess (https://cgit.drupalcode.org/drupal/plain/.htaccess?h=8.5.4): Downloading (100%)
- index.php (https://cgit.drupalcode.org/drupal/plain/index.php?h=8.5.4): Downloading (100%)
- robots.txt (https://cgit.drupalcode.org/drupal/plain/robots.txt?h=8.5.4): Downloading (100%)
- sites/default/default.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/default/default.services.yml?h=8.5.4): Downloading (100%)
- sites/default/default.settings.php (https://cgit.drupalcode.org/drupal/plain/sites/default/default.settings.php?h=8.5.4): Downloading (100%)
- sites/development.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/development.services.yml?h=8.5.4): Downloading (100%)
- sites/example.settings.local.php (https://cgit.drupalcode.org/drupal/plain/sites/example.settings.local.php?h=8.5.4): Downloading (100%)
- sites/example.sites.php (https://cgit.drupalcode.org/drupal/plain/sites/example.sites.php?h=8.5.4): Downloading (100%)
- update.php (https://cgit.drupalcode.org/drupal/plain/update.php?h=8.5.4): Downloading (100%)
- web.config (https://cgit.drupalcode.org/drupal/plain/web.config?h=8.5.4): Downloading (100%)
> DrupalProjectcomposerScriptHandler::createRequiredFiles
Create a sites/default/settings.php file with chmod 0666
Create a sites/default/files directory with chmod 0777
※プロジェクトdrupla8ディレクトリはコマンドを実行すれば作成してくれます。
※drupal 8.5.4、drush 9.3 、drupal console 1.8.0がインストールされました。
※web以下にコアが展開されています。
次は/var/www/sites/drupal8/composer.jsonです。
{
"name": "drupal-composer/drupal-project",
"description": "Project template for Drupal 8 projects with composer",
"type": "project",
"license": "GPL-2.0-or-later",
"authors": [
{
"name": "",
"role": ""
}
],
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6",
"drupal-composer/drupal-scaffold": "^2.5",
"drupal/console": "^1.0.2",
"drupal/core": "~8.5.3",
"drush/drush": "^9.0.0",
"vlucas/phpdotenv": "^2.4",
"webflo/drupal-finder": "^1.0.0",
"webmozart/path-util": "^2.3"
},
"require-dev": {
"webflo/drupal-core-require-dev": "~8.5.3"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"autoload": {
"classmap": [
"scripts/composer/ScriptHandler.php"
],
"files": ["load.environment.php"]
},
"scripts": {
"pre-install-cmd": [
"DrupalProject\composer\ScriptHandler::checkComposerVersion"
],
"pre-update-cmd": [
"DrupalProject\composer\ScriptHandler::checkComposerVersion"
],
"post-install-cmd": [
"DrupalProject\composer\ScriptHandler::createRequiredFiles"
],
"post-update-cmd": [
"DrupalProject\composer\ScriptHandler::createRequiredFiles"
]
},
"extra": {
"installer-paths": {
"web/core": ["type:drupal-core"],
"web/libraries/{$name}": ["type:drupal-library"],
"web/modules/contrib/{$name}": ["type:drupal-module"],
"web/profiles/contrib/{$name}": ["type:drupal-profile"],
"web/themes/contrib/{$name}": ["type:drupal-theme"],
"drush/Commands/{$name}": ["type:drupal-drush"]
}
}
}
データベースの作成
$ mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 10443
Server version: 10.2.15-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.
MariaDB [(none)]> create database drupal8 character set utf8mb4 collate utf8mb4_general_ci;
Query OK, 1 row affected (0.37 sec)
MariaDB [(none)]> grant all privileges on drupal8.* to 'admin'@'localhost' identified by 'Zaq12wsx';
Query OK, 0 rows affected (0.53 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> quit
Bye
※データベース管理ユーザ(root)でログインして作業しています。
インストール前の最終チェック
あとは、WEBブラウザーからdrupalサイトへアクセスすればインストーラが起動してインストールウィザードが開始されます。
これにはWEBさーんの設定が正しくできていないといけませんので最終チェックをしておいた方が吉です。
たとえば、ドキュメントルートが変わる場合はその変更をしてWEBサーバに設定を反映させる作業が必要です。
ドキュメントルートを/var/www/sites/drupal8/webに設定しました。
ここで一旦、データベースとディレクトリのバックアップを取っておけば、後でやり直すときに便利です。
どんなときにやりなおすかというと、次のインストールウィザードでエラーで中断した場合、再度実行する際に何だか気持ち悪いなーとか悩むならさくっとリストアしてしまえばすっきりです。
他にはプロファイルです。
今回は標準プロファイルでインストールしていますが、カスタムプロファイルを使ったインストールもあります。プロジェクトで用意されているものもありますし、動画サイトやショッピングサイト用の用途別プロファイルがあったりします。そういったプロファイルからのインストールを試すにはこのタイミングのバックアップがあると便利です。
インストールウィザードの開始
WEBブラウザからサイトへアクセスしてインストールを開始します。
※データベースが構成されsettings.phpがあるとインストーラは起動しない(d7のとき)ので再度やり直す場合はデータベースを空にしてsettings.phpを削除すればよいと思います。
操作はdrupal7と同じですのでインストーラの実行を参照してください。
※リンク先の7番でデフォルトの国を設定するかどうか?私は日本を選択しました。
おそらく日本を選択するとフィールドの言語設定が'ja'になり、しないと'und'になるんだとおもいます。この違いで問題になるモジュールやカスタムテンプレートがあるかもしれません。
以上でコアのインストールは完了です。
インストール自体はdrupal6やdrupal7から大きく変わったところはありませんので、それよりはサーバ要件にあう環境を構築する方が大変だと思います。
PATH変数への追加
drushやdrupalコマンドが使えるように~/.bashrcや~/.bash_profileなどログインシェル環境で$PATH変数に追加されるように「vendor/bin」パスを追記します。
export PATH="$HOME/drupal8/vendor/bin:$PATH"
ユーザのホームディレクトリを使った方が何かと便利だと思ったので、一般ユーザのユーザディレクトリ以下に導入しています。
$HOMEにしている理由は、/var/www/sites/drupal8は$HOME/drupal8へのシンボリックリンクです。
オーナーは一般ユーザになっています。
WinSCPのようなファイル転送ツールを使う場合も一般ユーザのディレクトリが扱いやすいです。
パーミッションの話
ここでは説明のため一般ユーザを「d8user」としておきます。
$HOME変数は/home/d8userになります。
CentOS7の場合、ホームディレクトリのパーミッションはユーザ、グループともにd8userになります。
このままではnginxやphp-fpmからアクセスできません。
そのため、グループ「webadmin」を作成してそのグループに「d8user」と「nginx」を加えています。
ディレクトリやファイルのオーナーはユーザ「d8user」、グループ「webadmin」にしてあります。
php-fpmはユーザ「d8user」、グループ「webadmin」で実行するようになっています。
バックアップ
いろいろカスタマイズする前に、インストール直後のバックアップを取得しておいてください。
今後の作業でやり直すときにこのバックアップが使えます。
drupal 8.6.x-devにアップグレード
drupal 8.5.4は現在の最新の安定版です。
現在のcoreの情報表示
$ composer info drupal/core
name : drupal/core
descrip. : Drupal is an open source content management platform powering millions of websites and applications.
keywords :
versions : * 8.5.4
type : drupal-core
license : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
source : [git] https://github.com/drupal/core.git 6b4dc1cf3347761f63152a31786b4680b8ac7781
dist : [zip] https://api.github.com/repos/drupal/core/zipball/6b4dc1cf3347761f63152a31786b4680b8ac7781 6b4dc1cf3347761f63152a31786b4680b8ac7781
names : drupal/core, drupal/action, drupal/aggregator, drupal/automated_cron, drupal/ban, drupal/bartik, drupal/basic_auth, drupal/big_pipe, drupal/block, drupal/block_content, drupal/block_place, drupal/book, drupal/breakpoint, drupal/ckeditor, drupal/classy, drupal/color, drupal/comment, drupal/config, drupal/config_translation, drupal/contact, drupal/content_moderation, drupal/content_translation, drupal/contextual, drupal/core-annotation, drupal/core-assertion, drupal/core-bridge, drupal/core-class-finder, drupal/core-datetime, drupal/core-dependency-injection, drupal/core-diff, drupal/core-discovery, drupal/core-event-dispatcher, drupal/core-file-cache, drupal/core-filesystem, drupal/core-gettext, drupal/core-graph, drupal/core-http-foundation, drupal/core-php-storage, drupal/core-plugin, drupal/core-proxy-builder, drupal/core-render, drupal/core-serialization, drupal/core-transliteration, drupal/core-utility, drupal/core-uuid, drupal/datetime, drupal/datetime_range, drupal/dblog, drupal/dynamic_page_cache, drupal/editor, drupal/entity_reference, drupal/field, drupal/field_layout, drupal/field_ui, drupal/file, drupal/filter, drupal/forum, drupal/hal, drupal/help, drupal/history, drupal/image, drupal/inline_form_errors, drupal/language, drupal/layout_builder, drupal/layout_discovery, drupal/link, drupal/locale, drupal/media, drupal/menu_link_content, drupal/menu_ui, drupal/migrate, drupal/migrate_drupal, drupal/migrate_drupal_ui, drupal/minimal, drupal/node, drupal/options, drupal/page_cache, drupal/path, drupal/quickedit, drupal/rdf, drupal/responsive_image, drupal/rest, drupal/search, drupal/serialization, drupal/settings_tray, drupal/seven, drupal/shortcut, drupal/simpletest, drupal/standard, drupal/stark, drupal/statistics, drupal/syslog, drupal/system, drupal/taxonomy, drupal/telephone, drupal/text, drupal/toolbar, drupal/tour, drupal/tracker, drupal/update, drupal/user, drupal/views, drupal/views_ui, drupal/workflows
autoload
psr-4
DrupalCore => lib/Drupal/Core
DrupalComponent => lib/Drupal/Component
DrupalDriver => ../drivers/lib/Drupal/Driver
classmap
lib/Drupal.php, lib/Drupal/Component/Utility/Timer.php, lib/Drupal/Component/Utility/Unicode.php, lib/Drupal/Core/Database/Database.php, lib/Drupal/Core/DrupalKernel.php, lib/Drupal/Core/DrupalKernelInterface.php, lib/Drupal/Core/Site/Settings.php
requires
asm89/stack-cors ^1.1
composer/semver ^1.0
doctrine/annotations ^1.2
doctrine/common ^2.5
easyrdf/easyrdf ^0.9
egulias/email-validator ^1.2
ext-date *
ext-dom *
ext-filter *
ext-gd *
ext-hash *
ext-json *
ext-pcre *
ext-pdo *
ext-session *
ext-simplexml *
ext-spl *
ext-tokenizer *
ext-xml *
guzzlehttp/guzzle ^6.2.1
masterminds/html5 ^2.1
paragonie/random_compat ^1.0|^2.0
php ^5.5.9|>=7.0.8
stack/builder ^1.0
symfony-cmf/routing ^1.4
symfony/class-loader ~3.4.0
symfony/console ~3.4.0
symfony/dependency-injection ~3.4.0
symfony/event-dispatcher ~3.4.0
symfony/http-foundation ~3.4.0
symfony/http-kernel ~3.4.0
symfony/polyfill-iconv ^1.0
symfony/process ~3.4.0
symfony/psr-http-message-bridge ^1.0
symfony/routing ~3.4.0
symfony/serializer ~3.4.0
symfony/translation ~3.4.0
symfony/validator ~3.4.0
symfony/yaml ~3.4.5
twig/twig ^1.35.0
zendframework/zend-diactoros ^1.1
zendframework/zend-feed ^2.4
requires (dev)
behat/mink 1.7.x-dev
behat/mink-goutte-driver ^1.2
behat/mink-selenium2-driver 1.3.x-dev
drupal/coder ^8.2.12
jcalderonzumba/gastonjs ^1.0.2
jcalderonzumba/mink-phantomjs-driver ^0.3.1
mikey179/vfsstream ^1.2
phpspec/prophecy ^1.4
phpunit/phpunit ^4.8.35 || ^6.1
symfony/css-selector ^3.4.0
symfony/debug ^3.4.0
symfony/phpunit-bridge ^3.4.3
conflicts
drush/drush <8.1.10
replaces
drupal/action self.version
drupal/aggregator self.version
drupal/automated_cron self.version
drupal/ban self.version
drupal/bartik self.version
drupal/basic_auth self.version
drupal/big_pipe self.version
drupal/block self.version
drupal/block_content self.version
drupal/block_place self.version
drupal/book self.version
drupal/breakpoint self.version
drupal/ckeditor self.version
drupal/classy self.version
drupal/color self.version
drupal/comment self.version
drupal/config self.version
drupal/config_translation self.version
drupal/contact self.version
drupal/content_moderation self.version
drupal/content_translation self.version
drupal/contextual self.version
drupal/core-annotation self.version
drupal/core-assertion self.version
drupal/core-bridge self.version
drupal/core-class-finder self.version
drupal/core-datetime self.version
drupal/core-dependency-injection self.version
drupal/core-diff self.version
drupal/core-discovery self.version
drupal/core-event-dispatcher self.version
drupal/core-file-cache self.version
drupal/core-filesystem self.version
drupal/core-gettext self.version
drupal/core-graph self.version
drupal/core-http-foundation self.version
drupal/core-php-storage self.version
drupal/core-plugin self.version
drupal/core-proxy-builder self.version
drupal/core-render self.version
drupal/core-serialization self.version
drupal/core-transliteration self.version
drupal/core-utility self.version
drupal/core-uuid self.version
drupal/datetime self.version
drupal/datetime_range self.version
drupal/dblog self.version
drupal/dynamic_page_cache self.version
drupal/editor self.version
drupal/entity_reference self.version
drupal/field self.version
drupal/field_layout self.version
drupal/field_ui self.version
drupal/file self.version
drupal/filter self.version
drupal/forum self.version
drupal/hal self.version
drupal/help self.version
drupal/history self.version
drupal/image self.version
drupal/inline_form_errors self.version
drupal/language self.version
drupal/layout_builder self.version
drupal/layout_discovery self.version
drupal/link self.version
drupal/locale self.version
drupal/media self.version
drupal/menu_link_content self.version
drupal/menu_ui self.version
drupal/migrate self.version
drupal/migrate_drupal self.version
drupal/migrate_drupal_ui self.version
drupal/minimal self.version
drupal/node self.version
drupal/options self.version
drupal/page_cache self.version
drupal/path self.version
drupal/quickedit self.version
drupal/rdf self.version
drupal/responsive_image self.version
drupal/rest self.version
drupal/search self.version
drupal/serialization self.version
drupal/settings_tray self.version
drupal/seven self.version
drupal/shortcut self.version
drupal/simpletest self.version
drupal/standard self.version
drupal/stark self.version
drupal/statistics self.version
drupal/syslog self.version
drupal/system self.version
drupal/taxonomy self.version
drupal/telephone self.version
drupal/text self.version
drupal/toolbar self.version
drupal/tour self.version
drupal/tracker self.version
drupal/update self.version
drupal/user self.version
drupal/views self.version
drupal/views_ui self.version
drupal/workflows self.version
試しにコアを8.6.x-devにアップグレードしてみる(失敗)
$ composer require drupal/core:8.6.x-dev
./composer.json has been updated
> DrupalProjectcomposerScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- webflo/drupal-core-require-dev 8.5.4 requires drupal/core 8.5.4 -> satisfiable by drupal/core[8.5.4] but these conflict with your requirements or minimum-stability.
- webflo/drupal-core-require-dev 8.5.4 requires drupal/core 8.5.4 -> satisfiable by drupal/core[8.5.4] but these conflict with your requirements or minimum-stability.
- webflo/drupal-core-require-dev 8.5.4 requires drupal/core 8.5.4 -> satisfiable by drupal/core[8.5.4] but these conflict with your requirements or minimum-stability.
- Installation request for webflo/drupal-core-require-dev (locked at 8.5.4, required as ~8.5.3) -> satisfiable by webflo/drupal-core-require-dev[8.5.4].
Installation failed, reverting ./composer.json to its original content.
require-devを削除すれば可能
※drupal 8.6.xから'taxonomy_term_hierarchy'テーブルがありません。drupal 8.5.xに戻すとエラーのためタクソノミーおよびそれを使ったノードの編集ができなくなります。Do not use removed 'taxonomy_term_hierarchy' table
$ composer remove webflo/drupal-core-require-dev --dev
> DrupalProjectcomposerScriptHandler::checkComposerVersion
Dependency "drupal/core" is also a root requirement, but is not explicitly whitelisted. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 0 updates, 40 removals
- Removing theseer/tokenizer (1.1.0)
- Removing symfony/phpunit-bridge (v3.4.11)
- Removing symfony/browser-kit (v4.1.0)
- Removing squizlabs/php_codesniffer (2.9.1)
- Removing sebastian/resource-operations (1.0.0)
- Removing sebastian/recursion-context (3.0.0)
- Removing sebastian/object-reflector (1.1.1)
- Removing sebastian/object-enumerator (3.0.3)
- Removing sebastian/global-state (2.0.0)
- Removing sebastian/exporter (3.1.0)
- Removing sebastian/environment (3.1.0)
- Removing sebastian/diff (2.0.1)
- Removing sebastian/comparator (2.1.3)
- Removing sebastian/code-unit-reverse-lookup (1.0.1)
- Removing phpunit/phpunit-mock-objects (5.0.7)
- Removing phpunit/phpunit (6.5.8)
- Removing phpunit/php-token-stream (2.0.2)
- Removing phpunit/php-timer (1.0.9)
- Removing phpunit/php-text-template (1.2.1)
- Removing phpunit/php-file-iterator (1.4.5)
- Removing phpunit/php-code-coverage (5.3.2)
- Removing phpspec/prophecy (1.7.6)
- Removing phpdocumentor/type-resolver (0.4.0)
- Removing phpdocumentor/reflection-docblock (4.3.0)
- Removing phpdocumentor/reflection-common (1.0.1)
- Removing phar-io/version (1.0.1)
- Removing phar-io/manifest (1.0.1)
- Removing myclabs/deep-copy (1.8.1)
- Removing mikey179/vfsstream (v1.6.5)
- Removing jcalderonzumba/mink-phantomjs-driver (v0.3.3)
- Removing jcalderonzumba/gastonjs (v1.2.0)
- Removing instaclick/php-webdriver (1.4.5)
- Removing fabpot/goutte (v3.2.2)
- Removing drupal/coder (8.2.12)
- Removing doctrine/instantiator (1.1.0)
- Removing behat/mink-selenium2-driver (dev-master)
- Removing behat/mink-goutte-driver (v1.2.1)
- Removing behat/mink-browserkit-driver (1.3.3)
- Removing behat/mink (dev-master)
Writing lock file
Generating autoload files
> DrupalProjectcomposerScriptHandler::createRequiredFiles
coreを8.6.x-devにアップグレード
$ composer require drupal/core:8.6.x-dev
./composer.json has been updated
> DrupalProjectcomposerScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 1 update, 0 removals
- Removing drupal/core (8.5.4)
- Installing drupal/core (8.6.x-dev 23b82d8): Cloning 23b82d865f
Writing lock file
Generating autoload files
- .csslintrc (https://cgit.drupalcode.org/drupal/plain/.csslintrc?h=8.6.x): Downloading (100%)
- .editorconfig (https://cgit.drupalcode.org/drupal/plain/.editorconfig?h=8.6.x): Downloading (100%)
- .eslintignore (https://cgit.drupalcode.org/drupal/plain/.eslintignore?h=8.6.x): Downloading (100%)
- .eslintrc.json (https://cgit.drupalcode.org/drupal/plain/.eslintrc.json?h=8.6.x): Downloading (100%)
- .gitattributes (https://cgit.drupalcode.org/drupal/plain/.gitattributes?h=8.6.x): Downloading (100%)
- .ht.router.php (https://cgit.drupalcode.org/drupal/plain/.ht.router.php?h=8.6.x): Downloading (100%)
- .htaccess (https://cgit.drupalcode.org/drupal/plain/.htaccess?h=8.6.x): Downloading (100%)
- index.php (https://cgit.drupalcode.org/drupal/plain/index.php?h=8.6.x): Downloading (100%)
- robots.txt (https://cgit.drupalcode.org/drupal/plain/robots.txt?h=8.6.x): Downloading (100%)
- sites/default/default.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/default/default.services.yml?h=8.6.x): Downloading (100%)
- sites/default/default.settings.php (https://cgit.drupalcode.org/drupal/plain/sites/default/default.settings.php?h=8.6.x): Downloading (100%)
- sites/development.services.yml (https://cgit.drupalcode.org/drupal/plain/sites/development.services.yml?h=8.6.x): Downloading (100%)
- sites/example.settings.local.php (https://cgit.drupalcode.org/drupal/plain/sites/example.settings.local.php?h=8.6.x): Downloading (100%)
- sites/example.sites.php (https://cgit.drupalcode.org/drupal/plain/sites/example.sites.php?h=8.6.x): Downloading (100%)
- update.php (https://cgit.drupalcode.org/drupal/plain/update.php?h=8.6.x): Downloading (100%)
- web.config (https://cgit.drupalcode.org/drupal/plain/web.config?h=8.6.x): Downloading (100%)
> DrupalProjectcomposerScriptHandler::createRequiredFiles
アップグレード後のcoreの情報表示
$ composer info drupal/core
name : drupal/core
descrip. : Drupal is an open source content management platform powering millions of websites and applications.
keywords :
versions : * 8.6.x-dev
type : drupal-core
license : GNU General Public License v2.0 or later (GPL-2.0-or-later) (OSI approved) https://spdx.org/licenses/GPL-2.0-or-later.html#licenseText
source : [git] https://github.com/drupal/core.git 23b82d865f048c9313075cffe7f2daaadba3f128
dist : [zip] https://api.github.com/repos/drupal/core/zipball/23b82d865f048c9313075cffe7f2daaadba3f128 23b82d865f048c9313075cffe7f2daaadba3f128
names : drupal/core, drupal/action, drupal/aggregator, drupal/automated_cron, drupal/ban, drupal/bartik, drupal/basic_auth, drupal/big_pipe, drupal/block, drupal/block_content, drupal/block_place, drupal/book, drupal/breakpoint, drupal/ckeditor, drupal/classy, drupal/color, drupal/comment, drupal/config, drupal/config_translation, drupal/contact, drupal/content_moderation, drupal/content_translation, drupal/contextual, drupal/core-annotation, drupal/core-assertion, drupal/core-bridge, drupal/core-class-finder, drupal/core-datetime, drupal/core-dependency-injection, drupal/core-diff, drupal/core-discovery, drupal/core-event-dispatcher, drupal/core-file-cache, drupal/core-filesystem, drupal/core-gettext, drupal/core-graph, drupal/core-http-foundation, drupal/core-php-storage, drupal/core-plugin, drupal/core-proxy-builder, drupal/core-render, drupal/core-serialization, drupal/core-transliteration, drupal/core-utility, drupal/core-uuid, drupal/datetime, drupal/datetime_range, drupal/dblog, drupal/dynamic_page_cache, drupal/editor, drupal/entity_reference, drupal/field, drupal/field_layout, drupal/field_ui, drupal/file, drupal/filter, drupal/forum, drupal/hal, drupal/help, drupal/history, drupal/image, drupal/inline_form_errors, drupal/language, drupal/layout_builder, drupal/layout_discovery, drupal/link, drupal/locale, drupal/media, drupal/media_library, drupal/menu_link_content, drupal/menu_ui, drupal/migrate, drupal/migrate_drupal, drupal/migrate_drupal_ui, drupal/minimal, drupal/node, drupal/options, drupal/page_cache, drupal/path, drupal/quickedit, drupal/rdf, drupal/responsive_image, drupal/rest, drupal/search, drupal/serialization, drupal/settings_tray, drupal/seven, drupal/shortcut, drupal/simpletest, drupal/standard, drupal/stark, drupal/statistics, drupal/syslog, drupal/system, drupal/taxonomy, drupal/telephone, drupal/text, drupal/toolbar, drupal/tour, drupal/tracker, drupal/update, drupal/user, drupal/views, drupal/views_ui, drupal/workflows, drupal/workspace
autoload
psr-4
DrupalCore => lib/Drupal/Core
DrupalComponent => lib/Drupal/Component
DrupalDriver => ../drivers/lib/Drupal/Driver
classmap
lib/Drupal.php, lib/Drupal/Component/Utility/Timer.php, lib/Drupal/Component/Utility/Unicode.php, lib/Drupal/Core/Database/Database.php, lib/Drupal/Core/DrupalKernel.php, lib/Drupal/Core/DrupalKernelInterface.php, lib/Drupal/Core/Site/Settings.php
requires
asm89/stack-cors ^1.1
composer/semver ^1.0
doctrine/annotations ^1.2
doctrine/common ^2.5
easyrdf/easyrdf ^0.9
egulias/email-validator ^1.2
ext-date *
ext-dom *
ext-filter *
ext-gd *
ext-hash *
ext-json *
ext-pcre *
ext-pdo *
ext-session *
ext-simplexml *
ext-spl *
ext-tokenizer *
ext-xml *
guzzlehttp/guzzle ^6.2.1
masterminds/html5 ^2.1
paragonie/random_compat ^1.0|^2.0
php ^5.5.9|>=7.0.8
stack/builder ^1.0
symfony-cmf/routing ^1.4
symfony/class-loader ~3.4.0
symfony/console ~3.4.0
symfony/dependency-injection ~3.4.0
symfony/event-dispatcher ~3.4.0
symfony/http-foundation ~3.4.0
symfony/http-kernel ~3.4.0
symfony/polyfill-iconv ^1.0
symfony/process ~3.4.0
symfony/psr-http-message-bridge ^1.0
symfony/routing ~3.4.0
symfony/serializer ~3.4.0
symfony/translation ~3.4.0
symfony/validator ~3.4.0
symfony/yaml ~3.4.5
twig/twig ^1.35.0
zendframework/zend-diactoros ^1.1
zendframework/zend-feed ^2.4
requires (dev)
behat/mink 1.7.x-dev
behat/mink-goutte-driver ^1.2
behat/mink-selenium2-driver 1.3.x-dev
drupal/coder ^8.2.12
jcalderonzumba/gastonjs ^1.0.2
jcalderonzumba/mink-phantomjs-driver ^0.3.1
mikey179/vfsstream ^1.2
phpspec/prophecy ^1.4
phpunit/phpunit ^4.8.35 || ^6.5
symfony/css-selector ^3.4.0
symfony/debug ^3.4.0
symfony/phpunit-bridge ^3.4.3
conflicts
drush/drush <8.1.10
replaces
drupal/action self.version
drupal/aggregator self.version
drupal/automated_cron self.version
drupal/ban self.version
drupal/bartik self.version
drupal/basic_auth self.version
drupal/big_pipe self.version
drupal/block self.version
drupal/block_content self.version
drupal/block_place self.version
drupal/book self.version
drupal/breakpoint self.version
drupal/ckeditor self.version
drupal/classy self.version
drupal/color self.version
drupal/comment self.version
drupal/config self.version
drupal/config_translation self.version
drupal/contact self.version
drupal/content_moderation self.version
drupal/content_translation self.version
drupal/contextual self.version
drupal/core-annotation self.version
drupal/core-assertion self.version
drupal/core-bridge self.version
drupal/core-class-finder self.version
drupal/core-datetime self.version
drupal/core-dependency-injection self.version
drupal/core-diff self.version
drupal/core-discovery self.version
drupal/core-event-dispatcher self.version
drupal/core-file-cache self.version
drupal/core-filesystem self.version
drupal/core-gettext self.version
drupal/core-graph self.version
drupal/core-http-foundation self.version
drupal/core-php-storage self.version
drupal/core-plugin self.version
drupal/core-proxy-builder self.version
drupal/core-render self.version
drupal/core-serialization self.version
drupal/core-transliteration self.version
drupal/core-utility self.version
drupal/core-uuid self.version
drupal/datetime self.version
drupal/datetime_range self.version
drupal/dblog self.version
drupal/dynamic_page_cache self.version
drupal/editor self.version
drupal/entity_reference self.version
drupal/field self.version
drupal/field_layout self.version
drupal/field_ui self.version
drupal/file self.version
drupal/filter self.version
drupal/forum self.version
drupal/hal self.version
drupal/help self.version
drupal/history self.version
drupal/image self.version
drupal/inline_form_errors self.version
drupal/language self.version
drupal/layout_builder self.version
drupal/layout_discovery self.version
drupal/link self.version
drupal/locale self.version
drupal/media self.version
drupal/media_library self.version
drupal/menu_link_content self.version
drupal/menu_ui self.version
drupal/migrate self.version
drupal/migrate_drupal self.version
drupal/migrate_drupal_ui self.version
drupal/minimal self.version
drupal/node self.version
drupal/options self.version
drupal/page_cache self.version
drupal/path self.version
drupal/quickedit self.version
drupal/rdf self.version
drupal/responsive_image self.version
drupal/rest self.version
drupal/search self.version
drupal/serialization self.version
drupal/settings_tray self.version
drupal/seven self.version
drupal/shortcut self.version
drupal/simpletest self.version
drupal/standard self.version
drupal/stark self.version
drupal/statistics self.version
drupal/syslog self.version
drupal/system self.version
drupal/taxonomy self.version
drupal/telephone self.version
drupal/text self.version
drupal/toolbar self.version
drupal/tour self.version
drupal/tracker self.version
drupal/update self.version
drupal/user self.version
drupal/views self.version
drupal/views_ui self.version
drupal/workflows self.version
drupal/workspace self.version
感想
composerで管理できるのは便利ですが、遅さ/重さは耐えられません。
プラグインやミラーサイトで何とか対応してもdrushコマンドだけで運用していた人には苦痛です。
そういう方は、composerを使わずコアを手動でダウンロードして所定の場所に解凍してdrupalコアをインストールし、drush8を使って運用すればよいでしょう。