Drupal 8

1. Information

<h1><a href="http://vbox.shoklo-unit.com/resources/covid-19-awareness">COVID-19 Awareness</a></h1> NO
<h1><a href="/resources/covid-19-awareness">COVID-19 Awareness</a></h1>                            YES
<h1><a href="/node/1333">COVID-19 Awareness</a></h1>                                               NO
<h1><a href="node/1333">COVID-19 Awareness</a></h1>                                                NO

2. Linux

2.2. Uninstallation

psql --list
dropdb drupal
sudo a2dissite shoklo-unit.com.conf
sudo systemctl restart apache2
sudo rm /etc/apache2/sites-available/shoklo-unit.com.conf
sudo rm -rf /var/www/html/shoklo-unit.com

2.3. Installation

cd /var/www/html
sudo mkdir -p shoklo-unit.com/public
sudo mkdir -p shoklo-unit.com/log
cd /var/www/html/shoklo-unit.com
sudo wget http://ftp.drupal.org/files/projects/drupal-8.1.8.tar.gz
sudo tar -zxf drupal-8.1.8.tar.gz --directory public --strip-components=1
sudo rm drupal-8.1.8.tar.gz
sudo apt-get install php5-gd

2.4. Configuration of Apache for shoklo-unit.com virtual host:

cd /etc/apache2/sites-available
sudo cp -a 000-default.conf shoklo-unit.com.conf
  • Important settings in the /etc/apache2/sites-available/shoklo-unit.com.conf file.

ServerName shoklo-unit.com
ServerAlias intranet intranet.shoklo-unit.com
DocumentRoot /var/www/html/shoklo-unit.com/public
ErrorLog  /var/www/html/shoklo-unit.com/log/error.log
CustomLog /var/www/html/shoklo-unit.com/log/access.log combined
sudo a2ensite shoklo-unit.com.conf
sudo a2enmod rewrite
sudo systemctl restart apache2

2.5. Configuration of Apache for clean URLs

  • Add the following lines to the /etc/apache2/sites-available/shoklo-unit.com.conf file.

<Directory /var/www/html/shoklo-unit.com/public>
  Options Indexes FollowSymLinks
  AllowOverride All
  Require all granted
  RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !=/favicon.ico
    RewriteRule ^ index.php [L]
</Directory>
sudo systemctl restart apache2

2.6. Configuration of PHP for trusted host names

  • Add the following lines to the Trusted Host Configuration section in the /var/www/html/shoklo-unit.com/public/sites/default/settings.php file.

$settings['trusted_host_patterns'] = array(
  '^intranet$',
  '^intranet\.shoklo-unit\.com$',
);

2.7. Configuration

cd /var/www/html/shoklo-unit.com/public/sites/default
sudo cp -a default.settings.php settings.php
sudo cp -a default.services.yml services.yml
cd /var/www/html/shoklo-unit.com
sudo chown -R www-data:www-data public

2.8. Installation

Browsing to http://intranet fails if the intranet server is unknown. Add the following line to the C:\Windows\System32\drivers\etc\hosts file.

10.10.1.2       intranet
  • Browse to http://intranet.

  • Select English.

  • Click Save and continue.

  • Choose Standard.

  • Click Save and continue.

Database name:                  drupal
Database username:              smru
Database password:              <level 2 password>
  • Click Save and continue.

  • Wait.

Site name:                      SMRU Intranet
Site email address:             drupal@shoklo-unit.com / smru-it@shoklo-unit.com / root@localhost / webmaster@localhost
Username:                       smru
Password:                       <level 2 password>
Confirm password:               <level 2 password>
Email address:                  smru@localhost / smru-it@shoklo-unit.com / root@localhost / webmaster@localhost
Default Country:                Thailand
Default time zone:              Asia/Bangkok

■ Check for updates automatically
■ Receive email notifications
  • Click Save and continue.

  • Select Log out.

Note: Browsing to "http://intranet" fails if the "intranet" server is unknown. Add the following line to the C:\Windows\System32\drivers\etc\hosts file.

10.10.1.2       intranet
Username:               smru
Password:               <level 2 password>
  • Click Log in.

  • Select Manage > Content.

  • Select Manage > Configuration.

  • Select smru > Log out.

3. Windows

3.2. Installation

  • Install Apache.

  • Install PHP.

  • Install PostgreSQL.

  • Start Windows Explorer.

  • Create the C:\Program Files\Drupal folder.

  • Close Windows Explorer.

  • Start 7-Zip File Manager with administrative privileges.

  • Open the drupal-8.1.8.zip archive.

  • Double-click the drupal-8.1.8 folder.

  • Click Extract.

  • Click the …​ button.

  • Select the C:\Program Files\Drupal folder.

  • Click OK.

  • Close 7-Zip File Manager.

3.3. Configuration

127.0.0.1  localhost
127.0.0.1  localdrupal
  • Enter the following commands at a Command Prompt with administrative privileges.

cd C:\Program Files\Apache\conf\extra
  • Comment out any existing entries in the httpd-vhosts.conf file.

  • Append the following lines to the httpd-vhosts.conf file.

<VirtualHost *:80>
    DocumentRoot "C:/Program Files/Apache/htdocs"
    ServerName localhost
    ErrorLog "logs/localhost.error.log"
    CustomLog "logs/localhost.access.log" common
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot "C:/Program Files/Drupal"
    ServerName localdrupal
    ErrorLog "logs/localdrupal.error.log"
    CustomLog "logs/localdrupal.access.log" common
</VirtualHost>
  • Enter the following commands at a Command Prompt with administrative privileges.

cd C:\Program Files\Apache\conf
  • Prepend the following lines to the httpd.conf file.

#AddHandler application/x-httpd-php .php
AddType application/x-httpd-php .php .html
#LoadModule php7_module "C:/Program Files/PHP7/php7apache2_4.dll"
PHPIniDir "C:/Program Files/PHP7"
diff-w -y httpd.conf.org httpd.conf | grep -E '>TAB|<TAB|\|TAB'
                                                                  > #AddHandler application/x-httpd-php .php
                                                                  > AddType application/x-httpd-php .php .html
                                                                  > #LoadModule php7_module "C:/Program Files/PHP7/php7apache2_4.
                                                                  > PHPIniDir "C:/Program Files/PHP7"
                                                                  >
    ServerRoot "c:/Apache24"                                      | ServerRoot "C:/Program Files/Apache"
    #LoadModule rewrite_module modules/mod_rewrite.so             | LoadModule rewrite_module modules/mod_rewrite.so
    #LoadModule vhost_alias_module modules/mod_vhost_alias.s      | LoadModule vhost_alias_module modules/mod_vhost_alias.so
                                                                  > LoadModule php7_module "C:/Program Files/PHP7/php7apache2_4.d
                                                                  > AddHandler application/x-httpd-php .php
                                                                  > ServerName localhost
                                                                  > <Directory "C:/Program Files/Drupal">
                                                                  >     #AllowOverride none
                                                                  >     # Needed for clean URLs.
                                                                  >     AllowOverride All
                                                                  >     #Require all denied
                                                                  >     Require all granted
                                                                  > </Directory>
                                                                  >
    DocumentRoot "c:/Apache24/htdocs"                             | DocumentRoot "C:/Program Files/Apache/htdocs"
    <Directory "c:/Apache24/htdocs">                              | <Directory "C:/Program Files/Apache/htdocs">
        DirectoryIndex index.html                                 |     DirectoryIndex index.html index.php
        ScriptAlias /cgi-bin/ "c:/Apache24/cgi-bin/"              |     ScriptAlias /cgi-bin/ "C:/Program Files/Apache/cgi-bin/"
    # "c:/Apache24/cgi-bin" should be changed to whatever yo      | # "C:/Program Files/Apache/cgi-bin" should be changed to what
    <Directory "c:/Apache24/cgi-bin">                             | <Directory "C:/Program Files/Apache/cgi-bin">
    #Include conf/extra/httpd-vhosts.conf                         | Include conf/extra/httpd-vhosts.conf
  • Enter the following commands at a Command Prompt with administrative privileges.

httpd.exe -k restart            # Restart the Apache2.4 service

3.4. Configuration of Trusted Host Settings

To prevent the Trusted Host Settings not enabled error message in the Manage > Configuration section.

  • Add the following lines to the Trusted Host Configuration section in the C:\Program Files\Drupal\sites\default\settings.php file.

$settings['trusted_host_patterns'] = array(
  '^localdrupal$',
);

3.5. Creation of drupal database

psql --username postgres --list
psql --username postgres
\l
DROP DATABASE "drupal";
CREATE DATABASE "drupal" OWNER smru;
\l
\q and press Enter.

3.6. Installation

  • Browse to http://localdrupal.

  • Select English.

  • Click Save and continue.

  • Choose Standard.

  • Click Save and continue.

  • Ignore the PHP OPcode caching not enabled message.

  • Select continue anyway.

Database name:                  drupal
Database username:              smru
Database password:              <level 2 password>
  • Click Save and continue.

Database drupal not found.
The server reports the following message when attempting to create the database:
SQLSTATE[42809]: Wrong object type: 7 ERROR: invalid locale name: "en_US.utf8".
  • Wait.

Site name:                      The Power of Pi
Site email address:             smru.jnk@gmail.com
Username:                       smru
Password:                       <level 2 password>
Confirm password:               <level 2 password>
Email address:                  smru.jnk@gmail.com
Default Country:                Thailand
Default time zone:              Asia/Bangkok

■ Check for updates automatically
■ Receive email notifications
  • Click Save and continue.

  • Select Log out.

C:\Program Files\Drupal\sites\default\settings.php
C:\Program Files\Apache\logs\error.log
C:\Program Files\Apache\logs\localdrupal.error.log

3.7. Configuration

Username:               smru
Password:               <level 2 password>
  • Click Log in.

  • Select Manage > Content.

The website encountered an unexpected error. Please try again later.
  • Select Manage > Configuration.

One or more problems were detected with your Drupal installation.
  • Select status report.

PHP OPcode caching              Not enabled

PHP OPcode caching can improve your site's performance considerably.
It is highly recommended to have OPcache installed on your server.
  • Select smru > Log out.

4. Drupal

4.1. Drush

4.3. Creation of multi-language site

  • See https://www.ostraining.com/blog/drupal/d8-multi-lingual.

  • Log in to Drupal.

  • Expand Manage > Extend > Multilingual.

    • Check Configuration Translation.

    • Check Content Translation.

    • Check Interface Translation.

    • Check Language.

    • Click Install.

  • Select Manage > Configuration > Regional and language > Languages.

    • Click Add language.

    • Select Spanish.

    • Click Add language.

    • Click Save configuration.

    • Select Spanish > <nr of translations done>/<nr of translations> (<percentage done>).

  • Select Manage > Structure > Content types.

  • Select Manage > Configuration > Regional and language > Content language and translation.

    • Check Content.

    • Check Article > Show language selector on create and edit pages.

    • Click Save configuration.

  • Select Manage > Structure > Block layout.

    • Click Sidebar first > Place block.

    • Click Language switcher > System > Place block.

    • Click Save block.

    • Click Save blocks.

Some paragragh

  • Click Sidebar first > Place block.

  • Click Language switcher > System > Place block.

  • Click Save block.

  • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

    • Click Save blocks.

    • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

  • Click Save blocks.

5. Backup of the websites

  • Log in as smru to the virtual machine using PuTTY.

  • Enter the following commands at a Command Line with root privileges.

    cd /var/www/html
    
    tar cfz lonex-shoklo-unit.com.tgz shoklo-unit.com                       # Back up the file system.
    tar cfz lonex-bhf-th.org.tgz bhf-th.org                                 # Back up the file system.
    mysqldump -p shokloun_ei  -u shokloun_ei  > lonex-shokloun_ei.sql       # Back up the database.
    mysqldump -p shokloun_ei1 -u shokloun_ei1 > lonex-shokloun_ei1.sql      # Back up the database.
    
    scp -p lonex-* /media/Windows/Tmp/Backups/Media\ Group/

6. Restore of the websites

Platform        Website         Apache  Drupal  MySQL   PHP
--------        --------------- ------  ------  -----   ---
Lonex           shoklo-unit.com         7.60    5.5.68  5.4.45          mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
Lonex           bhf-th.org              7.65    5.5.68  5.4.45          mysql  Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1
Debian 11 tst   shoklo-unit.com 2.4.56  7.60    5.7.42  7.2.34          mysql  Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using  EditLine wrapper
Debian 11 tst   bhf-th.org      2.4.56  7.65    5.7.42  7.2.34          mysql  Ver 14.14 Distrib 5.7.42, for Linux (x86_64) using  EditLine wrapper
Debian 11 vm    shoklo-unit.com 2.4.56  7.60    10.5.19 7.2.34          mysql  Ver 15.1 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
Debian 11 vm    bhf-th.org      2.4.56  7.65    10.5.19 7.2.34          mysql  Ver 15.1 Distrib 10.5.19-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
  • Create a VirtualBox virtual machine with two network adapters, the first one attached to NAT and the second one attached to Host-only Adapter | VirtualBox Host-Only Ethernet Adapter.

  • Install Debian 11 Bullseye (Debian 12 Bookworm is not yet supported by MySQL).

  • Contents of the /etc/network/interfaces file.

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).
    
    source /etc/network/interfaces.d/*
    
    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # The primary network interface
    allow-hotplug enp0s3
    auto enp0s3
    iface enp0s3 inet dhcp
    
    # The secondary network interface
    allow-hotplug enp0s8
    auto enp0s8
    iface enp0s8 inet static
        address 192.168.56.90
        netmask 255.255.255.0
        network 192.168.56.0
  • Enter the following commands at a Command Line with root privileges.

    # Get latest stable Delta Linux Tools.
    scp -p smru@10.10.1.2:/media/Windows/Software/_Delta/delta-linux-tools-#.#.#-1-all.deb /tmp
    dpkg -i /tmp/delta-linux-tools-#.#.#-1-all.deb
    
    smru config apt 10.10.1.170:8080                # Configure apt repositories with proxy server.
    export http_proxy=http://10.10.1.170:8080       # Set http_proxy variable in current shell.
    export https_proxy=http://10.10.1.170:8080      # Set https_proxy variable in current shell.
    smru config bash 10.10.1.170:8080               # Configure bash shell with proxy server for each user.
    smru config cron                                # Configure cron jobs.
    smru config editor                              # Set default editor to vim.tiny for each user.
    #smru config kernel net.ifnames=0               # Disable consistent network device names.
    smru config locale                              # Configure locale settings.
    
    #smru setup inventory                           # Install and configure inventory.
    smru setup openssh                              # Install and configure openssh server.
    smru setup sudo                                 # Install and configure sudo for each user.
    smru setup timezone                             # Install and configure time zone.
    sudo smru setup vim                             # Install and configure vim editor for each user.
    
    sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get dist-upgrade
    sudo apt-get autoremove
    sudo apt-get autoclean
  • Enter the following commands at a Command Line.

    sudo smru setup apache
    sudo smru setup php
    sudo smru setup mariadb
    
    # Set MariaDB root password.
    sudo mariadb -p -u root
    # Use level 1 password.
    ALTER USER 'root'@'localhost' IDENTIFIED BY '********';
    exit
    
    sudo apache2 -v         # 2.4.56
    mariadb --version       # 10.5.19
    php --version           # 7.2.34
    
    sudo apt-get install p7zip-full
    scp -p smru@10.10.1.2:"/media/Archive/T/IT/Backups/Lonex\ websites/2023/2023-08-10-shoklo-unit.com.zip" /tmp
    scp -p smru@10.10.1.2:"/media/Archive/T/IT/Backups/Lonex\ websites/2023/2023-08-10-bhf-th.org.zip" /tmp
    scp -p smru@10.10.1.2:"/media/Archive/T/IT/Backups/Lonex\ websites/2023/2023-08-10-mysqlbackup.zip" /tmp
    
    sudo 7za x -o/var/www/html /tmp/2023-08-10-shoklo-unit.com.zip
    sudo 7za x -o/var/www/html /tmp/2023-08-10-bhf-th.org.zip
    ls -al /var/www/html
    
    # Show Drupal versions.
    grep -i '^define.*version' /var/www/html/shoklo-unit.com/includes/bootstrap.inc         # 7.60
    grep -i '^define.*version' /var/www/html/bhf-th.org/includes/bootstrap.inc              # 7.65
    
    
    # Enable https connections.
    sudo a2enmod rewrite
    sudo a2enmod ssl
    sudo mkdir -p /etc/apache2/certs
    cd /etc/apache2/certs
    sudo openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out apache.crt -keyout apache.key
    # Enter "TH" for the Country Name.
    # Enter "Tak" for the State or Province Name.
    # Enter "" for the City or Locality Name.
    # Enter "SMRU" for the Organization Name.
    # Enter "" for the Organizational Unit Name.
    # Enter the hostname or ip address for the Common Name.
    # Enter "" for the Email Address.
    cd -
    
    7za x /tmp/2023-08-10-mysqlbackup.zip
    7za x mysqlbackup/shokloun_ei.zip
    7za x mysqlbackup/shokloun_ei1.zip
    ls -al shokloun_ei*
    
    mariadb -p -u root
    SHOW DATABASES;
    SELECT User, Host, Update_priv FROM mysql.user;
    
    # Use "Lonex MySQL Database SMRU - shokloun_ei" password in KeePass Password Manager.
    CREATE USER 'shokloun_ei'@'localhost' IDENTIFIED BY '********';
    # Use "Lonex MySQL Database TBHF - shokloun_ei1" password in KeePass Password Manager.
    CREATE USER 'shokloun_ei1'@'localhost' IDENTIFIED BY '********';
    GRANT ALL PRIVILEGES ON *.* TO 'shokloun_ei'@'localhost';
    GRANT ALL PRIVILEGES ON *.* TO 'shokloun_ei1'@'localhost';
    FLUSH PRIVILEGES;
    SELECT User, Host, Update_priv FROM mysql.user;
    SHOW DATABASES;
    CREATE DATABASE shokloun_ei;
    CREATE DATABASE shokloun_ei1;
    SHOW DATABASES;
    exit
    
    mariadb -p -u shokloun_ei  shokloun_ei  < shokloun_ei.sql
    mariadb -p -u shokloun_ei1 shokloun_ei1 < shokloun_ei1.sql
    
    FILE="/etc/apache2/apache2.conf"
    # Back up original file if backup file is missing.
    if [ -f "${FILE}" ] && [ ! -f "${FILE}.org" ]; then cp -a "${FILE}" "${FILE}.org"; fi
    FILE="/etc/apache2/sites-available/000-default.conf"
    # Back up original file if backup file is missing.
    if [ -f "${FILE}" ] && [ ! -f "${FILE}.org" ]; then cp -a "${FILE}" "${FILE}.org"; fi
    
    sudo cp -a /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/shoklo-unit.com.conf
    sudo cp -a /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/bhf-th.org.conf
  • Add the following lines after the <Directory /var/www/> section to the /etc/apache2/apache2.conf file to fix broken links.

    <Directory /var/www/html/shoklo-unit.com>
         AllowOverride All
    </Directory>
    
    <Directory /var/www/html/bhf-th.org>
         AllowOverride All
    </Directory>
  • Delete any DocumentRoot and ServerName lines in the /etc/apache2/sites-available/shoklo-unit.com.conf file.

  • Add the following lines after the ServerAdmin line to the /etc/apache2/sites-available/shoklo-unit.com.conf file.

        ServerName vbox.shoklo-unit.com
        DocumentRoot /var/www/html/shoklo-unit.com
  • Add the following lines to the /etc/apache2/sites-available/shoklo-unit.com.conf file to enable https connections.

    <VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName vbox.shoklo-unit.com
        DocumentRoot /var/www/html/shoklo-unit.com
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/apache2/certs/apache.crt
        SSLCertificateKeyFile /etc/apache2/certs/apache.key
    </VirtualHost>
  • Delete any DocumentRoot and ServerName lines in the /etc/apache2/sites-available/bhf-th.org.conf file.

  • Add the following lines after the ServerAdmin line to the /etc/apache2/sites-available/bhf-th.org.conf file.

        ServerName vbox.bhf-th.org
        DocumentRoot /var/www/html/bhf-th.org
  • Add the following lines to the /etc/apache2/sites-available/bhf-th.org.conf file to enable https connections.

    <VirtualHost *:443>
        ServerAdmin webmaster@localhost
        ServerName vbox.bhf-th.org
        DocumentRoot /var/www/html/bhf-th.org
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
        SSLEngine on
        SSLCertificateFile /etc/apache2/certs/apache.crt
        SSLCertificateKeyFile /etc/apache2/certs/apache.key
    </VirtualHost>
  • Enter the following commands at a Command Line.

    sudo a2dissite 000-default.conf
    sudo a2ensite shoklo-unit.com.conf
    sudo a2ensite bhf-th.org.conf
    
    sudo systemctl restart apache2
  • Add the following entries to the C:\Windows\System32\drivers\etc\hosts file.

  • [note]*Note: This may already have been done by Delta Windows Tools.

    10.10.1.5       test.bhf-th.org
    10.10.1.5       test.shoklo-unit.com
    192.168.56.90   vbox.bhf-th.org
    192.168.56.90   vbox.shoklo-unit.com
  • Append the following entries to Internet Properties | Connections | LAN settings | Advanced |Exceptions.

  • [note]*Note: This may already have been done by Delta Windows Tools.

    ;test.*
    ;vbox.*

7. FTP Server

sudo apt install vsftpd

sudo systemctl status vsftpd

sudo systemctl start vsftpd
sudo systemctl enable vsftpd

sudo adduser vftp
# Type the level 2 password and press Enter.
# Type the level 2 password and press Enter.
# Type "FTP User" and press Enter for the Full Name.
# Type "" and press Enter for the Room Number.
# Type "" and press Enter for the Work Phone.
# Type "" and press Enter for the Home Phone.
# Type "" and press Enter for Other.
# Type "y" and press Enter to confirm.
echo "vftp" | sudo tee -a /etc/vsftpd.userlist

sudo mkdir -p /home/vftp/ftp_dir/upload
sudo chmod 550 /home/vftp/ftp_dir
sudo chmod -R 750 /home/vftp/ftp_dir/upload
sudo chown -R vftp: /home/vftp/ftp_dir

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem
# Type "TH" and press Enter for the Country Name.
# Type "Tak" and press Enter for the State or Province Name.
# Type "" and press Enter for the City or Locality Name.
# Type "SMRU" and press Enter for the Organization Name.
# Type "" and press Enter for the Organizational Unit Name.
# Type the hostname or ip address and press Enter for the Common Name.
# Type "" and press Enter for the Email Address.

etc/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO

rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
ssl_enable=YES
user_sub_token=$USER
local_root=/home/$USER/ftp
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
sudo systemctl restart vsftpd
sudo systemctl status vsftpd

8. Drupal 7 to 8 Migration

PHP versions recommended for Drupal 7.94        PHP 5.6, 7.0-7.4, 8.0-8.2
PHP versions recommended for Drupal 8           PHP 8.0-8.2
Debian 8.11     Default PHP installed   5       ???
Debian 9.13     Default PHP installed   7.0     Verified
Debian 10.8     Default PHP installed   7.3     Verified
Debian 11.3     Default PHP installed   7.4     Verified
Debian 11.7     Default PHP installed   7.4     ???/Verified
Debian 12.0     Default PHP installed   8.2     Verified
Debian 12.1     Default PHP installed   8.2     Verified

8.1. SMRU Website

8.2. TBHF Website

# See https://forums.raspberrypi.com/viewtopic.php?t=155067
ls -al /var/www/html
sudo chown -R smru:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod u+rxw,g+rx-w,o+rx-w '{}' \;
sudo find /var/www/html -type f -exec chmod u+rw,g+r-xw,o+r-xw '{}' \;
# Any new file or directory created belongs to group www-data.
sudo find /var/www/html -type d -exec chmod g+s '{}' \;
sudo adduser smru www-data
ls -al /var/www/html


sudo apt-get install composer
dpkg -l | grep -i php

cd /var/www/html
wget https://ftp.drupal.org/files/projects/drupal-8.9.8.tar.gz
tar xfz drupal-8.9.8.tar.gz

composer create-project drupal/recommended-project:~8.9.8 new_bhf-th.org
# Fix ownerships and permissions.
sudo chown -R smru:www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+s '{}' \;

# See https://www.drupal.org/forum/support/post-installation/2022-02-09/problem-upgrading-using-drush
composer require --dev drush/drush              # FAILS
composer require --dev drush/drush ^11          # FAILS
composer require --dev drush/drush ^10          # OK
composer require --dev drush/drush ^9           # OK
vendor/bin/drush status
vendor/bin/drush --version

composer require drupal/migrate_upgrade         # FAILS
composer require drupal/migrate_upgrade "^3"    # OK
composer require drupal/migrate_plus            # FAILS
composer require drupal/migrate_plus "^5"       # OK
vendor/bin/drush install migrate migrate_drupal migrate_upgrade migrate_plus    # FAILS

mkdir -p new_bhf-th.org/web/libraries
mkdir -p new_bhf-th.org/web/modules/custom
mkdir -p new_bhf-th.org/web/themes/custom

cp -a bhf-th.org/sites/all/libraries/* new_bhf-th.org/web/libraries
rm -f new_bhf-th.org/web/libraries/README.txt
ls -al new_bhf-th.org/web/libraries

cp -a bhf-th.org/modules/* new_bhf-th.org/web/modules/custom
cp -a bhf-th.org/sites/all/modules/* new_bhf-th.org/web/modules/custom
rm -f new_bhf-th.org/web/modules/custom/README.txt
ls -al new_bhf-th.org/web/modules/custom

cp -a bhf-th.org/themes/bartik new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/themes/engines new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/themes/garland new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/themes/seven new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/themes/stark new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/sites/all/themes/nexus new_bhf-th.org/web/themes/custom
cp -a bhf-th.org/sites/all/themes/responsive_green new_bhf-th.org/web/themes/custom
ls -al new_bhf-th.org/web/themes/custom

cp -a bhf-th.org/sites/default/files new_bhf-th.org/web/sites/default
ls -al new_bhf-th.org/web/sites/default/files



cp -a new_bhf-th.org/web/sites/default/default.settings.php new_bhf-th.org/web/sites/default/settings.php
diff  new_bhf-th.org/web/sites/default/default.settings.php new_bhf-th.org/web/sites/default/settings.php

cd new_bhf-th.org
cp -a composer.json composer.json.org

composer require drupal/admin_menu
#composer require drupal/block
#composer require drupal/captcha
#composer require drupal/ckeditor
#composer require drupal/color
#composer require drupal/comment
#composer require drupal/contextual
#composer require drupal/ctools
composer require drupal/dashboard
#composer require drupal/dblog
composer require drupal/entityreference
#composer require drupal/field
#composer require drupal/field_ui
#composer require drupal/file
composer require drupal/filefield_sources
#composer require drupal/filefield_sources_plupload
#composer require drupal/filter
#composer require drupal/help
#composer require drupal/image
#composer require drupal/imce
#composer require drupal/imce_plupload
#composer require drupal/jquery_update
composer require drupal/juicebox
composer require drupal/libraries
#composer require drupal/menu
#composer require drupal/module_filter
#composer require drupal/node
#composer require drupal/overlay
#composer require drupal/panels
#composer require drupal/path
#composer require drupal/pathauto
#composer require drupal/plupload
#composer require drupal/profile
composer require drupal/quicktabs
#composer require drupal/rdf
#composer require drupal/search
#composer require drupal/shortcut
#composer require drupal/statistics
#composer require drupal/system
#composer require drupal/taxonomy
#composer require drupal/token
#composer require drupal/tracker
composer require drupal/translation
#composer require drupal/update
#composer require drupal/user
#composer require drupal/user_dashboard
#composer require drupal/views
#composer require drupal/views_slideshow

diff composer.json.org composer.json

composer install

vendor/bin/drush updatedb               # ???
vendor/bin/drush cr                     # ???
In BootstrapHook.php line 32:

  Bootstrap failed. Run your command with -vvv for more information.
2023-09-08 12:33:46 smru@vbox-debian /var/www/html/new_bhf-th.org$ vendor/bin/drush updatedb -vvv
 [preflight] Config paths: /var/www/html/new_bhf-th.org/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /var/www/html/new_bhf-th.org/web/drush/sites,/var/www/html/new_bhf-th.org/drush/sites
 [preflight] Commandfile search paths: /var/www/html/new_bhf-th.org/vendor/drush/drush/src
 [bootstrap] Starting bootstrap to full [0.04 sec, 8.67 MB]
 [bootstrap] Drush bootstrap phase 5 [0.04 sec, 8.67 MB]
 [bootstrap] Try to validate bootstrap phase 5 [0.04 sec, 8.67 MB]
 [bootstrap] Try to validate bootstrap phase 5 [0.04 sec, 8.67 MB]
 [bootstrap] Try to bootstrap at phase 5 [0.04 sec, 8.67 MB]
 [bootstrap] Drush bootstrap phase: bootstrapDrupalRoot() [0.04 sec, 8.67 MB]
 [bootstrap] Change working directory to /var/www/html/new_bhf-th.org/web [0.04 sec, 8.67 MB]
 [bootstrap] Initialized Drupal 8.9.20-dev root directory at /var/www/html/new_bhf-th.org/web [0.04 sec, 8.8 MB]
 [bootstrap] Try to validate bootstrap phase 5 [0.04 sec, 8.8 MB]
 [bootstrap] Try to bootstrap at phase 5 [0.04 sec, 9.16 MB]
 [bootstrap] Drush bootstrap phase: bootstrapDrupalSite() [0.04 sec, 9.16 MB]
 [bootstrap] Initialized Drupal site default at sites/default [0.04 sec, 9.33 MB]
 [bootstrap] Try to validate bootstrap phase 5 [0.04 sec, 9.33 MB]
 [bootstrap] Try to bootstrap at phase 5 [0.04 sec, 9.33 MB]
 [bootstrap] Drush bootstrap phase: bootstrapDrupalConfiguration() [0.04 sec, 9.33 MB]
 [debug] Add service modifier [0.04 sec, 9.53 MB]
 [bootstrap] Try to validate bootstrap phase 5 [0.04 sec, 9.54 MB]
 [bootstrap] key_value table not found. Database may be empty. [0.05 sec, 9.99 MB]
 [bootstrap] Could not bootstrap at phase 5 [0.05 sec, 9.99 MB]

In BootstrapHook.php line 32:

  [Exception]
  Bootstrap failed. Run your command with -vvv for more information.


Exception trace:
  at /var/www/html/new_bhf-th.org/vendor/drush/drush/src/Boot/BootstrapHook.php:32
 Drush\Boot\BootstrapHook->initialize() at /var/www/html/new_bhf-th.org/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:34
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/www/html/new_bhf-th.org/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:27
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/www/html/new_bhf-th.org/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/www/html/new_bhf-th.org/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:289
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/www/html/new_bhf-th.org/vendor/symfony/console/Command/Command.php:221
 Symfony\Component\Console\Command\Command->run() at /var/www/html/new_bhf-th.org/vendor/symfony/console/Application.php:1005
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/new_bhf-th.org/vendor/symfony/console/Application.php:255
 Symfony\Component\Console\Application->doRun() at /var/www/html/new_bhf-th.org/vendor/symfony/console/Application.php:148
 Symfony\Component\Console\Application->run() at /var/www/html/new_bhf-th.org/vendor/drush/drush/src/Runtime/Runtime.php:118
 Drush\Runtime\Runtime->doRun() at /var/www/html/new_bhf-th.org/vendor/drush/drush/src/Runtime/Runtime.php:49
 Drush\Runtime\Runtime->run() at /var/www/html/new_bhf-th.org/vendor/drush/drush/drush.php:72
 require() at /var/www/html/new_bhf-th.org/vendor/drush/drush/drush:4

updatedb [--cache-clear [CACHE-CLEAR]] [--entity-updates] [--post-updates [POST-UPDATES]] [--no-cache-clear] [--no-post-updates] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--xh-link XH-LINK] [--notify] [--druplicon] [--] <command>