drupal9-guifi-networks
drupal networks install
Setup & install a development drupal environment of the guifi·net network website (drupal 9) for Fedora (FC34) or Ubuntu (20.04)
Assumptions:
-
Local development environment with domain name "net9ldev.guifi.net" (so entry at /etc/hosts for that domain, pointing to 127.0.0.1)
-
Fedora 34 or Ubuntu 20.04
1. Platform preparation
1.1. LAMP
Install LAMP platform (Linux server + Apache + MySql/MariaDB + PHP)
1.2. Install composer
1.3. Install drush
composer require drush/drush
1.4. Create database
At the mariadb/mysql prompt:
create database net9 charset utf8mb4 collate utf8mb4_unicode_ci;
create user net9@localhost identified by 'development';
grant all privileges on net9.* to net9@localhost;
flush privileges;
1.5. Prepare drupal 9
cd /var/www/html
sudo mkdir net9ldev
chmod myuser:myuser net9ldev
composer create-project drupal/recommended-project:^9 net9ldev
1.6. Prepare apache
Fedora
sudo vim /etc/httpd/conf.d/net9ldev.guifi.net.conf
Alias /net9ldev /var/www/net9ldev/web
<Directory /var/www/net9ldev/web>
AllowOverride all
</Directory>
<VirtualHost *:80>
ServerAdmin myemail@guifi.net
ServerName net9ldev.guifi.net
DocumentRoot /var/www/html/net9ldev/web
<Directory /var/www/html/net9ldev/web>
Allowoverride all
</Directory>
</VirtualHost>
Ubuntu
sudo vim /etc/apache2/sites-available/net9ldev.guifi.net.conf
Alias /net9ldev /var/www/net9ldev/web
<Directory /var/www/net9ldev/web>
AllowOverride all
</Directory>
<VirtualHost *:80>
ServerAdmin myemail@domain.tld
DocumentRoot /var/www/net9ldev/web/
ServerName net9ldev.guifi.net
RewriteEngine On
RewriteOptions inherit
CustomLog /var/log/apache2/net9ldev.guifi.net.log combined
</VirtualHost>
sudo a2ensite net9ldev.guifi.net
1.7. phpMyAdmin
Fedora
sudo yum install phpmyadmin
Ubuntu
sudo apt-get install phpmyadmin
1.8. Restart apache
Fedora
sudo service httpd restart
Ubuntu
sudo service apache2 restart
2. Install drupal
2.1. Initial drupal install
cd /var/www/html/net9ldev/web/sites/default
chmod a+rw settings.php
mkdir files
chmod a+rw files
mkdir files/styles
chmod a+rw files/styles
Drupal install (manual)
Visit http://net9ldev.guifi.netProceed with the install:
- form #1
- Language -> Your language
- from #2
- Database type -> MySQL, MariaDB, Percona Server, or equivalent
- Database name -> net9
- Database username -> net9
- form #3
- Site name: guifi·net Network (local dev)
- Site email address -> youremail@domain.tld
- Username-> webmestre
- Password ->
- Email address -> youremail@domain.tld
- Default country -> your country
- Default time zone -> Your TZ
drush install
drush site:install
Database name [drupal]:
> net9ldev
Database driver [mysql]:
>
Database username [drupal]:
> net9ldev
Database password [drupal]:
> <your_password>
Database host [127.0.0.1]:
>
Database port [3306]:
>
You are about to:
* Create a sites/default/settings.php file
* DROP all tables in your 'net9ldev' database.
Do you want to continue? (yes/no) [yes]:
>
[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] Performed install task: install_finished
[success] Installation complete. User name: admin User password: yMiunkTXDk
Note that an admin user has been created with a default password provided at the very last line. Change or rename that to whatever your want.
2.2. Enable system core modules
Manual enable via web browser (the classic way)
Point your browser to http://net9ldev.guifi.net/admin/modules- CORE
- Actions
- Activity tracker
- Inline form errors
- Layout Builder
- Layout Discovery
- Media
- Media Library
- Statistics
- FIELD TYPES
- Telephone
- MULTILINGUAL
- Configuration Translation
- Content Translation
- WEB SERVICES
- HTTP Basic Authentication
- JSON:API
- RESTFul Web Services
- Serialization
.... or enable with drush (terminal command line)
drush pm:enable action tracker inline_form_errors layout_builder layout_builder media media_library statistics telephone config_translation content_translation basic_auth jsonapi rest serialization
2.3. Localization / Multilanguage
2.3.1. Install languages
Install translation languages of your choice, for example:
drush language-add ast
drush language-add eu
drush language-add ca
drush language-add fr
drush language-add gl
drush language-add de
drush language-add el
drush language-add it
drush language-add pt-pt
drush language-add es
2.4. Install contrib modules
2.4.1. composer dev environment
Eventually, set dev as "minimum-stability" at composer.json
vim composer.json
... and replace:
"minimum-stability": "stable",
with:
"minimum-stability": "dev",
2.4.2. Download theme & modules
composer require drupal/bootstrap5
composer require drupal/admin_toolbar drupal/webform_remote_select drupal/webform_rest drupal/field_group drupal/field_permissions drupal/field_validation drupal/popup_field_group
composer require drupal/geocoder geocoder-php/nominatim-provider drupal/leaflet drupal/geofield drupal/geofield_map drupal/views_bulk_operations drupal/bulk_update_fields drupal/views_data_export drupal/views_conditional
composer require drupal/address drupal/tzfield drupal/conditional_fields drupal/calendar
composer require drupal/eva drupal/prepopulate drupal/phone_international drupal/taxonomy_manager drupal/auto_entitylabel drupal/inline_entity_form drupal/ief_popup drupal/token drupal/devel
composer require drupal/css_editor drupal/date_popup drupal/easy_breadcrumb drupal/eck drupal/external_entities drupal/keycloak drupal/openid_connect drupal/smtp drupal/taxonomy_term_revision drupal/views_dates drupal/views_ef_fieldset drupal/views_summarize drupal/views_timestamp_to_date drupal/view_custom_table drupal/views_autocomplete_filters drupal/views_aggregator drupal/pdf_serialization drupal/entity_extra_field --yes
composer require drupal/hacked drupal/coder drupal/security_review --yes
2.4.3. Enable theme & modules
drush theme:enable bootstrap5
drush pm:enable admin_toolbar webform_remote_select webform_rest webform_ui field_group field_permissions field_validation popup_field_group
drush pm:enable geocoder leaflet leaflet_markercluster leaflet_views geofield geofield_map views_bulk_operations bulk_update_fields views_data_export views_conditional --yes
drush pm:enable address field_layout tzfield geocoder_field geocoder_address geocoder_geofield conditional_fields calendar --yes
drush pm:enable eva prepopulate phone_international taxonomy_manager auto_entitylabel inline_entity_form ief_popup token devel --yes
drush pm:enable css_editor date_popup easy_breadcrumb eck external_entities keycloak openid_connect smtp taxonomy_term_revision views_dates views_ef_fieldset views_summarize views_timestamp_to_date view_custom_table views_autocomplete_filters views_aggregator pdf_serialization entity_extra_field entity_extra_field_ui --yes
drush en hacked coder security_review --yes
3. Install guifi·net modules
3.1. Download repository
Clone this project repository (drupal9-guifi-networks) at web/modules/contrib directory:
cd web/modules
mkdir custom
cd custom
git clone http://gitlab.guifi.net/ramon.roca/drupal9-guifi-networks.git guifi
...and enable it
drush pm:enable guifi
[eof]
arreglem files & trusted hosts $settings['file_private_path'] = 'sites/default/files/private'; (...) $settings['trusted_host_patterns'] = [ '^192.168.69.14$', '^drops.guifi.net$', '^network.guifi.net$', ];
creem sites/default/files/private .htacces al nou directori:
Deny all requests from Apache 2.4+.
Require all denied
Deny all requests from Apache 2.0-2.2.
<IfModule !mod_authz_core.c> Deny from all
Turn off all options we don't need.
Options -Indexes -ExecCGI -Includes -MultiViews
Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006 <Files *>
Override the handler again if we're run later in the evaluation list.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
If we know how to do it safely, disable the PHP engine entirely.
php_flag engine off