This is an old revision of the document!
Drupal 9
Fresh minimal Drupal 9 installation.
We need unzip.
# apt install unzip
Prepare folders and permissions (user = server manager; www-data = user nginx running as).
# sudo chown user /var/www/ # mkdir /var/www/.cache # mkdir /var/www/html # sudo chown -R user:www-data /var/www/.cache /var/www/html
Install Drupal 9 (currently 9.1.4 version) by composer (executed as user).
$ composer create-project drupal/recommended-project /var/www/html
Securing installation before continue to install by standard web interface.
$ cd /var/www/html/web $ sudo chown -R user:www-data . $ find . -type d -exec chmod u=rwx,g=rx,o= '{}' \; $ find . -type f -exec chmod u=rw,g=r,o= '{}' \; $ sudo chgrp -R www-data /var/www/html/vendor $ sudo chgrp www-data /var/www/html $ sudo chmod 770 sites/default $ chmod -R 660 sites/default/* $ mkdir sites/default/files $ sudo chown -R user:www-data sites/default/files $ cp -a sites/default/default.settings.php sites/default/settings.php $ sudo chgrp www-data sites/default/settings.php
Browse to https://dbopen.ba.cnr.it to complete installation.
- Language: English
- Select an installation profile: Minimal Build a custom site without pre-configured functionality. Suitable for advanced users.
- Database configuration (all defaults)
- Configure site
- Site name: DBOpen
- Site email address: dbopen@ba.cnr.it
- Email address: dbopen@ba.cnr.it
- Check for updates automatically: YES
- Receive email notifications: NO
Some more secure permissions.
$ sudo chmod 750 sites/default $ sudo chmod 640 sites/default/*.php $ sudo chmod 640 sites/default/*.yml
First useful UI settings:
- BROWSE admin/appearance and install&set admin theme (Seven) and default theme (Bartik) and uninstall Stark
- BROWSE admin/config/people/accounts and select the the “Only site administrators can create new user accounts” option
Install Drush
$ cd /var/www/html/ $ composer require drush/drush:^10 $ vendor/bin/drush --version Drush Commandline Tool 10.4.0
Composer.json at this step:
{
"name": "drupal/recommended-project",
"description": "Project template for Drupal 9 projects with a relocated document root",
"type": "project",
"license": "GPL-2.0-or-later",
"homepage": "https://www.drupal.org/project/drupal",
"support": {
"docs": "https://www.drupal.org/docs/user_guide/en/index.html",
"chat": "https://www.drupal.org/node/314178"
},
"repositories": [
{
"type": "composer",
"url": "https://packages.drupal.org/8"
}
],
"require": {
"composer/installers": "^1.9",
"drupal/core-composer-scaffold": "^9.1",
"drupal/core-project-message": "^9.1",
"drupal/core-recommended": "^9.1",
"drush/drush": "^10"
},
"conflict": {
"drupal/drupal": "*"
},
"minimum-stability": "stable",
"prefer-stable": true,
"config": {
"sort-packages": true
},
"extra": {
"drupal-scaffold": {
"locations": {
"web-root": "web/"
}
},
"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/contrib/{$name}": [
"type:drupal-drush"
],
"web/modules/custom/{$name}": [
"type:drupal-custom-module"
],
"web/profiles/custom/{$name}": [
"type:drupal-custom-profile"
],
"web/themes/custom/{$name}": [
"type:drupal-custom-theme"
]
},
"drupal-core-project-message": {
"include-keys": [
"homepage",
"support"
],
"post-create-project-cmd-message": [
"<bg=blue;fg=white> </>",
"<bg=blue;fg=white> Congratulations, you’ve installed the Drupal codebase </>",
"<bg=blue;fg=white> from the drupal/recommended-project template! </>",
"<bg=blue;fg=white> </>",
"",
"<bg=yellow;fg=black>Next steps</>:",
" * Install the site: https://www.drupal.org/docs/8/install",
" * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
" * Get support: https://www.drupal.org/support",
" * Get involved with the Drupal community:",
" https://www.drupal.org/getting-involved",
" * Remove the plugin that prints this message:",
" composer remove drupal/core-project-message"
]
}
}
}
Change composer.json to enable dev module version.
nano -w composer.json "minimum-stability": "dev"
Basic configuration
Trust host pattern
$ nano -w web/sites/default/settings.php $settings['trusted_host_patterns'] = [ '^dbopen\.ba\.cnr\.it$', ];
Cron
$ sudo -u www-data crontab -e */15 * * * * wget -O - -q -t 1 https://dbopen.ba.cnr.it/cron/******************
Import/export config
Enable import/export from UI
$ vendor/bin/drush en config
Or import/export configuration by drush
config:export --destination=/home/user/backup config:import --partial --source=/home/user/upload
Private filesystem
$ mkdir /var/www/html/private $ sudo chgrp -R www-data /var/www/html/private $ nano -w web/sites/default/settings.php $settings['file_private_path'] = '/var/www/html/private'; $ vendor/bin/drush cr
S3fs and connect to Minio
Your PHP must be configured with allow_url_fopen = On in your php.ini file. Otherwise, PHP will be unable to open files that are in your S3 bucket.
$ grep -R allow_url_fopen /etc/php/* /etc/php/7.4/fpm/php.ini:allow_url_fopen = On /etc/php/7.4/cli/php.ini:allow_url_fopen = On
In addition, you need the php5-curl library installed for the SDK to be able to communicate with S3. Most hosts will already have this library installed, but some don't.
$ php -m |grep curl curl
Install s3fs module
$ cd /var/www/html $ composer require 'drupal/s3fs:3.x-dev@dev' - Installing mtdowling/jmespath.php (2.6.0): Extracting archive - Installing aws/aws-sdk-php (3.173.22): Extracting archive - Installing drupal/s3fs (dev-3.x 012cdc2): Cloning 012cdc22d5 from cache $ vendor/bin/drush en s3fs $ vendor/bin/drush cr
Configure settings.php
$ nano -w web/sites/default/settings.php
/** * Minio S3 credentials */ $settings['s3fs.access_key'] = 'my_access_key'; $settings['s3fs.secret_key'] = 'my_secret_key'; $config['s3fs.settings']['bucket'] = 'archipelago';
Browse UI at admin/config/media/s3fs
Custom Host Settings Hostname => localhost:9000 Use path-style endpoint => YES
Theme
Install Barrio with subtheme
$ cd /var/www/html $ composer require drupal/bootstrap_barrio
Using version ^5.1 for drupal/bootstrap_barrio Lock file operations: 2 installs, 0 updates, 0 removals - Locking drupal/bootstrap_barrio (5.1.4) - Locking twbs/bootstrap (v4.6.0) Package operations: 2 installs, 0 updates, 0 removals - Installing twbs/bootstrap (v4.6.0): Extracting archive - Installing drupal/bootstrap_barrio (5.1.4): Extracting archive
cd web/themes/contrib/bootstrap_barrio/ chmod +x scripts/create_subtheme.sh ./scripts/create_subtheme.sh
Browse UI at admin/appearance
Install and set default Archipelago DBOpen theme (subtheme)
For administration UI
$ vendor/bin/drush en toolbar
Twig and Display suite modules
Install with composer and enable by drush.
$ composer require 'drupal/twig_field:^1.1' 'drupal/bamboo_twig:^5.0@alpha' 'drupal/twig_tweak:^3.0' - Installing drupal/bamboo_twig (5.0.0-alpha1): Extracting archive - Installing drupal/codemirror_editor (1.7.0): Extracting archive - Installing drupal/twig_field (1.1.0): Extracting archive - Installing drupal/twig_tweak (3.0.0): Extracting archive $ vendor/bin/drush en twig_field The following module(s) will be enabled: twig_field, codemirror_editor, editor $ vendor/bin/drush en twig_tweak
$ composer require 'drupal/ds:^3.10' - Installing drupal/ds (3.10.0): Extracting archive $ vendor/bin/drush en ds ds_extras ds_switch_view_mode The following module(s) will be enabled: ds, ds_extras, ds_switch_view_mode, layout_discovery $ composer require 'drupal/display_field_copy:^2.0' - Installing drupal/display_field_copy (2.0.0): Extracting archive $ vendor/bin/drush en display_field_copy
Search API and Search API Solr
Install modules.
$ composer require 'drupal/search_api:^1.19' - Installing drupal/search_api (1.19.0): Extracting archive $ vendor/bin/drush en search_api $ composer require 'drupal/search_api_autocomplete:^1.4' 'drupal/search_api_attachments:^1.0@beta' - Installing drupal/search_api_attachments (1.0.0-beta17): Extracting archive - Installing drupal/search_api_autocomplete (1.4.0): Extracting archive $ vendor/bin/drush en search_api_autocomplete search_api_attachments $ composer require 'drupal/search_api_solr:^4.1' - Installing psr/http-client (1.0.1): Extracting archive - Installing psr/event-dispatcher (1.0.0): Extracting archive - Installing solarium/solarium (6.1.1): Extracting archive - Installing myclabs/php-enum (1.8.0): Extracting archive - Installing maennchen/zipstream-php (2.1.0): Extracting archive - Installing drupal/search_api_solr (4.1.11): Extracting archive $ vendor/bin/drush en search_api_solr The following module(s) will be enabled: search_api_solr, language
Browse UI to admin/config/search/search-api/add-server to add and configure Solr server
Solr Connector: Standard Advanced: Retrieve result data from Solr = YES Advanced: Retrieve highlighted snippets = YES Advanced: Fallback to multiValued field types = YES
We have to add Language Undefined Text OCR Field with Coordinate highlight in Solr server Custom Field Type
Open https://github.com/esmero/archipelago-deployment/blob/1.0.0-RC2D9/config/sync/search_api_solr.solr_field_type.text_ocr_und_7_0_0.yml
Then browse UI at admin/config/development/configuration/single/import, select Solr Field type and paste yml above.
Add index browsing UI at admin/config/search/search-api/add-index
Name = [machine name] drupal_content_to_solr_8 Datasources Content = YES File = YES Server = Solr DBOpen
Then SAVE (→ 1 doc on queue from datasource Content, so index, result = OK)
Set index Processors browsing UI at admin/config/search/search-api/index/drupal_content_to_solr_8/processors
Enable: Content access, Entity status, Highlight, HTML filter, Reverse entity references Processor settings: Highlight and HTML filter
[we need to come back here after Strawberryfield installed]