Brief Details of DRUPAL:

Drupal  is among the most famous CMS as of now accessible and is the favoured decision for government offices, enormous affiliations, not-for-profits, and numerous Fortune 500 organisations. Straightforward for editors, strong for chairmen, secure, and available for everybody, Drupal  is an all inclusive resource for all of your site needs.

Drupal is free,open source CMS used for Build and Maintain Simple for complex Websites.

Drupal provide free module/plugin,  Scalability, Security to support.


Below are the steps to setup/install DRUPAL in Ubuntu.

Step 1: Download and setup Ubuntu in the desired system

          link: https://ubuntu.com/

Step 2: Update and upgrade the system

            sudo apt update && apt upgrade -y

Step 3: Enable root login into the system, to avoid typing sudo everytime and restart ssh service or sytem

            sudo nano /etc/ssh/sshd_config

                    change this line or add the line

                            #PermtRootLogin no

                                        to

                               PermitRootLogin yes

            sudo systemctl restart ssh

Step 4: Install apache

            sudo apt install apache2

Note: This commands can be used to check status, start, stop, enable apache2 services as per the requirements

            sudo systemctl status apache2.service

            sudo systemctl start apache2.service

            sudo systemctl stop apache2.service

            sudo systemctl enable apache2.service

Step 5: Install a Database which is required for DRUPAL. Here we are installing Maria DB, SQL also be installed instead of Mariadb.

            sudo apt install mariadb-server

            sudo apt install mariadb-cilent

Note: This commands can be used to check status, start, stop, enable mariadb services as per the requirements

            sudo systemctl status mariadb.service

            sudo systemctl start mariadb.service

            sudo systemctl stop mariadb.service

            sudo systemctl enable mariadb.service

Step 6: After installing Mariadb, run this command for secure the database with root password

            sudo mysql_secure_installation

Note: When Text Prompt appear, use this options, as per your requirement(or change accordingly)

            Enter current password for root (enter for none): PRESS ENTER

            Switch to unix_socket authentication [Y/n] n

            Change the root password? [Y/n] n

            Remove anonymous users? [Y/n] y

            Disallow root login remotely? [Y/n] y

            Remove test database and access to it? [Y/n] y

            Reload privilege tables now? [Y/n] y

            All done!

Note: To verify the settings use this command

            sudo mysql -u root -p

Step 7 : Install PHP

                7.1 Install software properties 

                        sudo apt-get install software-properties-common

                7.2 Add the third partie repository to install latest php

                        sudo add-apt-repository ppa:ondrej/php

                7.3 update the system

                        sudo apt update

                7.4 Install PHP along the required modules/packages.

                     sudo apt install php8.0 php8.0-common php8.0-mysql php8.0-gmp php8.0-curl php8.0-intl                      php8.0-mbstring php8.0-xmlrpc php8.0-gd php8.0-xml php8.0-cli php8.0-zip

Step 8: Now, we need to change/add some configurations settings that will drupal work great.

                sudo nano /etc/php/8.0/apache2/php.ini

Now, change/add lines as shown below(or as per your requirement)

                file_uploads = On

                allow_url_fopen = On

                short_open_tag = On

                memory_limit = 512M

                cgi.fix_pathinfo = 0

                upload_max_filesize = 150M

                max_execution_time = 360

               date.timezone = Asia/Kolkata

Step 9: Now we need to create Database for DRUPAL, run commands as follows

            sudo mysql -u root -p

Create a database for drupal(i.e like drupaldb or someting else)

                CREATE DATABASE drupaldb;

Create a user and set password

                CREATE USER 'drupaluser'@'localhost' IDENTIFIED BY 'new_password_here';

Grant user full access to database

                GRANT ALL ON drupaldb.* TO 'drupaldbuser'@'localhost' WITH GRANT OPTION;

                FLUSH PRIVILEGES;

                EXIT;

Step 10: Download Drupal

First we need to install composer to get latest drupal release 

                sudo apt install curl git

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer


Step 11: Download stable/latest version from the website in cd /var/www location and install

                cd /var/www/

                sudo git clone --branch 9.2.5 https://git.drupal.org/project/drupal.git

                cd /var/www/drupal

                sudo composer install

Website: https://www.drupal.org/project/drupal/releases/

Run the below commands for user to own drupal directory

                sudo chown -R www-data:www-data /var/www/drupal/

                sudo chmod -R 755 /var/www/drupal/


Step 12: Confiuring Apcahe for DRUPAL

                sudo nano /etc/apache2/sites-available/drupal.conf

copy and paste the content below into the file

               <VirtualHost *:80>

              ServerName example.com 

              ServerAlias www.example.com 


              Redirect permanent / https://example.com/

            </VirtualHost>


            <VirtualHost *:443>

              ServerName example.com 

              ServerAlias www.example.com

              DocumentRoot /var/www/drupal


              Protocols h2 http:/1.1


              <If "%{HTTP_HOST} == 'www.example.com'"> 

                Redirect permanent / https://example.com/

              </If>

  

              ErrorLog ${APACHE_LOG_DIR}/example.com-error.log

              CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined


              SSLEngine On

              SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem

              SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem

              SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"

  

              SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-                     SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-                                 SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-                                 POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384


              SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1

              SSLCompression off

              SSLUseStapling on

 

              Header always set Strict-Transport-Security "max-age=63072000"


              <Directory /var/www/drupal/>

                       Options FollowSymlinks

                       AllowOverride All

                       Require all granted

              </Directory>

 

                </VirtualHost>


#NOTE:change example.com and www.example to IP-ADDR to run locally(Every Where)

and then, save & exit

Step 13: Subsequent to saving the document above, run the orders underneath to empower the new record that contains our Drupal server block. Restart Apache after that.

                sudo a2ensite drupal.conf

                sudo systemctl reload apache2


Step 14: Open Browser & Enter IP-ADDR