bookmark_borderInstalling Drupal on Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install Drupal on Ubuntu 23.10

Drupal is a Content Management System (CMS) to maintain and publish an internet website. It’s an open-source content management system (CMS) with a large, supportive community. It’s used by millions of people and organizations around the globe to build and maintain their websites.

Update the System

Let us update the system packages to the latest by running the below commands,

apt update -y 

apt upgrade -y

Install MariaDB Server

Next is to install MariaDB or MySQL. I will be using MariaDB for this process. So let’s install MariaDB with the following command.

apt install -y mariadb-server mariadb-client

Secure your database server by setting a root password, disabling root remote logins, and removing test databases.

mysql_secure_installation

Output:

root@server:~# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password or using the unix_socket ensures that nobody
can log into the MariaDB root user without the proper authorisation.

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Check that you can log in to the database as a root user with a password set.

mysql -u root -p

Now that we are able to log in as regular users, we can now create a Drupal database that Drupal can use once we installed it into our system. To create one using the following command.

Create Database for Drupal

mysql -u root -p
CREATE DATABASE drupal;
CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON drupal.* to drupal_user@'localhost';
FLUSH PRIVILEGES;
\q

Output:

root@server:~# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 41
Server version: 10.11.2-MariaDB-1 Ubuntu 23.10

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 drupal;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> CREATE USER 'drupal_user'@'localhost' IDENTIFIED BY 'Strong_Password';
Query OK, 0 rows affected (0.006 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON drupal.* to drupal_user@'localhost';
Query OK, 0 rows affected (0.005 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.002 sec)

MariaDB [(none)]> \q
Bye

Note: Replace the Strong_Password with actual strong password

Install PHP

By default, Ubuntu 23.10 comes with PHP version 8.2. We will install PHP and other necessary modules required to run Drupal.

apt install php php-{cli,fpm,json,common,mysql,zip,gd,intl,mbstring,curl,xml,pear,tidy,soap,bcmath,xmlrpc}

Output:

root@server:~# apt install php php-{cli,fpm,json,common,mysql,zip,gd,intl,mbstring,curl,xml,pear,tidy,soap,bcmath,xmlrpc}
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core libapache2-mod-php8.2 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  liblerc4 liblua5.3-0 libtidy5deb1 libtiff6 libwebp7 libxmlrpc-epi0 libxpm4 libzip4 php8.2 php8.2-bcmath php8.2-cli
  php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-intl php8.2-mbstring php8.2-mysql php8.2-opcache php8.2-readline
  php8.2-soap php8.2-tidy php8.2-xml php8.2-xmlrpc php8.2-zip ssl-cert
Suggested packages:
  apache2-doc apache2-suexec-pristine | apache2-suexec-custom www-browser libgd-tools
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core libapache2-mod-php8.2 libapr1
  libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8 libjpeg8
  liblerc4 liblua5.3-0 libtidy5deb1 libtiff6 libwebp7 libxmlrpc-epi0 libxpm4 libzip4 php php-bcmath php-cli php-common
  php-curl php-fpm php-gd php-intl php-json php-mbstring php-mysql php-pear php-soap php-tidy php-xml php-xmlrpc php-zip
  php8.2 php8.2-bcmath php8.2-cli php8.2-common php8.2-curl php8.2-fpm php8.2-gd php8.2-intl php8.2-mbstring php8.2-mysql
  php8.2-opcache php8.2-readline php8.2-soap php8.2-tidy php8.2-xml php8.2-xmlrpc php8.2-zip ssl-cert

Install Apache Web Server

As for the Web Server, we will use Apache as it is easy to configure and use.

To install, run the below commands

apt install apache2 libapache2-mod-php

Output:


root@server:~# apt install apache2 libapache2-mod-php
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apache2 is already the newest version (2.4.55-1ubuntu2).
apache2 set to manually installed.
The following NEW packages will be installed:
  libapache2-mod-php
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.

Update PHP Timezone and Memory Limit.

Enter the TimeZone you want Drupal to use as default.

nano /etc/php/*/apache2/php.ini
memory_limit = 256
date.timezone = UTC

Download the Latest Version of Drupal and extract it on Ubuntu 23.10.

wget https://www.drupal.org/download-latest/tar.gz -O drupal.tar.gz
tar xvf drupal.tar.gz
mv drupal-*/  /var/www/html/drupal

Update ownership for a drupal directory to Apache user and group.

chown -R www-data:www-data /var/www/html/
chmod -R 755 /var/www/html/

Configure Apache Web Server for Drupal

Create a configuration file for Drupal.

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

Add the following content,

Replace drupal.domainhere.info with your actual domain name.

<VirtualHost *:80>
     ServerName drupal.domainhere.info
     ServerAdmin admin@drupal.domainhere.info
     DocumentRoot /var/www/html/drupal/

     CustomLog ${APACHE_LOG_DIR}/access.log combined
     ErrorLog ${APACHE_LOG_DIR}/error.log

      <Directory /var/www/html/drupal>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
   </Directory>
</VirtualHost>

Configure and Enable the Website using the below commands,

apachectl -t
a2dismod mpm_event
a2enmod mpm_prefork
a2enmod php8.2
a2enmod rewrite
a2ensite drupal.conf
systemctl restart apache2

Install Certbot

Certbot is a tool that simplifies the process of obtaining and renewing Let’s Encrypt SSL certificates,

apt install certbot python3-certbot-apache

Generate SSL Certificate,

certbot --apache -d drupal.domainhere.info

Note: Replace drupal.domainhere.info with actual domain name

Output:

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/drupal.domainhere.info/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/drupal.domainhere.info/privkey.pem
This certificate expires on 2024-01-16.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for drupal.domainhere.info to /etc/apache2/sites-enabled/drupal.domainhere.info-le-ssl.conf
Your existing certificate has been successfully renewed, and the new certificate has been installed.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Access Drupal

Access the Drupal configuration page by using http://drupal.domainhere.info

Replace drupal.domainhere.info with your actual domain.

images

Select an installation profile.

images

Set Database Configure for Drupal.

images

Wait for the installation to complete,

images

Configure your site,

images

You’ll get to the Drupal dashboard in a few,

images
images

Done.

bookmark_borderInstalling PhpMyAdmin in Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install PhpMyAdmin in Ubuntu 23.10

In this guide, we will demonstrate how PhpMyAdmin is installed on a Ubuntu 23.04 system. PhpMyAdmin requires a standalone Database or as part of the LEMP stack, installed and running on the system beforehand.

Prerequisites:

Server with Nginx, PHP, and MariaDB. You can find our LEMP Installation guide here.

Installing PhpMyAdmin

apt install phpmyadmin

Output:

root@ubuntu23:~# apt install phpmyadmin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
   apache2 apache2-bin apache2-data apache2-utils dbconfig-common
   dbconfig-mysql default-mysql-client fontconfig-config fonts-noto-core
   fonts-noto-mono icc-profiles-free javascript-common libapache2-mod-php
   libapache2-mod-php8.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
   libaprutil1-ldap libdeflate0 libfontconfig1 libgd3 libjbig0 libjpeg-turbo8
   libjpeg8 libjs-codemirror libjs-jquery libjs-jquery-metadata
   libjs-jquery-mousewheel libjs-jquery-tablesorter libjs-jquery-timepicker
   libjs-jquery-ui libjs-sphinxdoc libjs-underscore liblerc4 liblua5.4-0
   libmcrypt4 libtiff6 libwebp7 libxpm4 libzip4 mysql-client-8.0
   mysql-client-core-8.0 mysql-common php-bz2 php-cli php-common
   php-composer-ca-bundle php-curl php-fig-http-message-util php-gd
   php-getallheaders php-google-recaptcha php-mariadb-mysql-kbs php-mbstring
   php-mcrypt php-mysql php-nikic-fast-route php-phpmyadmin-motranslator
   php-phpmyadmin-shapefile php-phpmyadmin-sql-parser php-psr-cache
   php-psr-container php-psr-http-factory php-psr-http-message php-psr-log
   php-slim-psr7 php-symfony-cache php-symfony-cache-contracts
   php-symfony-config php-symfony-dependency-injection
   php-symfony-deprecation-contracts php-symfony-expression-language
   php-symfony-filesystem php-symfony-polyfill-php80
   php-symfony-service-contracts php-symfony-var-exporter php-tcpdf php-twig
   php-twig-i18n-extension php-webmozart-assert php-xml php-zip php8.2-bz2
   php8.2-cli php8.2-common php8.2-curl php8.2-gd php8.2-mbstring php8.2-mcrypt
   php8.2-mysql php8.2-opcache php8.2-readline php8.2-xml php8.2-zip ssl-cert

Create Symbolic Link

Create a symbolic link from the installation files to Nginx’s document root directory.

sudo ln -s  /usr/share/phpmyadmin /var/www/html/phpmyadmin

Enter it into your browser’s address bar to check that phpmyadmin is installed. http://yourserver-ip-address/phpmyadmin/. You should see a page similar to the below one.

images

Done!

bookmark_borderInstalling Joomla on Ubuntu 23.10

Hello,

In this week’s feature highlight, we look at How to Install Joomla on Ubuntu 23.10

Joomla is a free and open-source content management system for publishing web content on websites. Web content applications include discussion forums, photo galleries, e-Commerce, and user communities, and numerous other web-based applications.

Update the System,

apt update

apt upgrade

LAMP Stack Configuration

Joomla like any other CMS application, will require a web server with Database running on the system to support it. And since Joomla is built on PHP, we will need to install PHP as well.

Install Apache and PHP

We will now install Apache and PHP and other supporting packages by running the below command,

apt install apache2 libapache2-mod-php openssl php-imagick php-gd php-imap php-intl php-json php-ldap php-mbstring php-mysql php-pgsql php-smbclient php-ssh2 php-sqlite3 php-xml php-zip

Verify apache version using below command,

apache2 -version

Output:

root@ubuntu23:~# apache2 -version
Server version: Apache/2.4.57 (Ubuntu)
Server built:   2023-07-21T21:17:42

Now start and enable the Apache Web server,

systemctl start apache2 
systemctl enable apache2

Verify Apache is up and running using below command,

systemctl status apache2

Output:

root@ubuntu23:~# systemctl status apache2
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; preset: enab>
     Active: active (running) since Fri 2023-10-20 08:14:53 UTC; 6min ago
       Docs: https://httpd.apache.org/docs/2.4/
   Main PID: 15570 (apache2)
      Tasks: 6 (limit: 2226)
     Memory: 20.0M
        CPU: 347ms
     CGroup: /system.slice/apache2.service
             ├─15570 /usr/sbin/apache2 -k start
             ├─15573 /usr/sbin/apache2 -k start
             ├─15574 /usr/sbin/apache2 -k start
             ├─15575 /usr/sbin/apache2 -k start
             ├─15576 /usr/sbin/apache2 -k start
             └─15577 /usr/sbin/apache2 -k start

Oct 20 08:14:53 ubuntu23 systemd[1]: Starting apache2.service - The Apache HTTP>
Oct 20 08:14:53 ubuntu23 apachectl[15569]: AH00558: apache2: Could not reliably>
Oct 20 08:14:53 ubuntu23 systemd[1]: Started apache2.service - The Apache HTTP >

Open server IP address on your browser(http://Server_Ip) to see default Apache page.

Note: Replace “Server_Ip” with actual Ip address of the server.

images

Verify PHP using below command

php -v  

Output:

  root@ubuntu23:~# php -v
  PHP 8.2.10-2ubuntu1 (cli) (built: Sep  5 2023 14:37:47) (NTS)
  Copyright (c) The PHP Group
  Zend Engine v4.2.10, Copyright (c) Zend Technologies
      with Zend OPcache v8.2.10-2ubuntu1, Copyright (c), by Zend Technologies

Install MariaDB

Let us install MariaDB on the server now with the following command,

apt install mariadb-server

MariaDB is not secured by default, As a precaution, we are secure the database engine using below command.

mysql_secure_installation

Create a Joomla Database

Login to MariaDB using the command

mysql -u root -p

Let us configure the Database so Joomla can connect to it and store the data.

For this, we will create a Database, create a User and grant certain Privileges to the User. Refer the below commands for the usecase.

CREATE DATABASE joomla;

GRANT ALL PRIVILEGES ON joomla.* TO 'joomla_user'@'localhost' IDENTIFIED BY  'StrongPassword';

FLUSH PRIVILEGES;

EXIT;

Download and Extract Joomla

Note: At the time of writing this article, Joomla 5 had just been released.

We will now download the latest version of Joomla from the Official site.

Download Joomla in Ubuntu using below command,

wget https://github.com/joomla/joomla-cms/releases/download/5.0.0/Joomla_5.0.0-Stable-Full_Package.zip

Once the download is complete. We need to unzip this to the /var/www/html/ directory. Make the directory called Joomla.

apt install unzip 

mkdir /var/www/html/joomla

Unzip the zipped Joomla file to ‘Joomla’ directory created above.

unzip Joomla_5.0.0-Stable-Full_Package.zip -d /var/www/html/joomla

After unzip, Set the directory ownership of the directory to Apache user and change the permissions using below command,

chown -R www-data:www-data /var/www/html/joomla
chmod -R 755 /var/www/html/joomla

Restart Apache Web server using following command,

systemctl restart apache2 

Configuring Apache for Joomla

Configure the Apache webserver to serve Joomla webpages. For this create a virtual host’s file for Joomla and name it joomla.conf,

nano /etc/apache2/sites-available/joomla.conf

Add the following content into the file

<VirtualHost *:80>
 ServerAdmin admin@dev.domainhere.info
 DocumentRoot /var/www/html/joomla/
 ServerName dev.domainhere.info
 ServerAlias www.dev.domainhere.info

 ErrorLog ${APACHE_LOG_DIR}/error.log
 CustomLog ${APACHE_LOG_DIR}/access.log combined

 <Directory /var/www/html/joomla/>
        Options FollowSymlinks
        AllowOverride All
        Require all granted
 </Directory>
</VirtualHost>

Save and exit the file,

Replace dev.domainhere.info with your actual domain name.

Enable the virtual host file,

a2ensite joomla.conf
a2enmod rewrite

After this Restart Apache Webserver using below command,

systemctl restart apache2

Open your browser to load the site, http://dev.domainhere.info.

Install SSL Certificate

Let us install the SSL Certificate from Let’s Encrypt. For this, you will need to install certbot via snapd.

Installing snapd,

apt install snapd

Check the snapd for updates,

snap install core; sudo snap refresh core

Install Certbot

snap install --classic certbot

ln -s /snap/bin/certbot /usr/bin/certbot

Since we’re using Apache web server, run the below command to get the certificate,

certbot --apache

The Certbot will take care of your renewal automatically before they expire, you would have to run the certbot again only if you make changes to your configuration. You can perform a test run with below command,

certbot renew --dry-run

Next, reload the page on the browser and it should then redirect and load the HTTPS site https://dev.domainhere.info.

Joomla Configuration

On the browser, we will configure the remaining aspects of getting our Joomla CMS up and running

Upon loading the domain, you will be prompted with setting up Language and Site Name

images

Enter the required details such as Username, User Account, Super User Password, and Email Address, and click on Setup Database Connection button

images

Enter the Database information that was configured earlier,

images

Enter the username and password which was set earlier,

images

View of the Dashboard after loggin in,

images

Done! This concludes the topic of installing latest version of Joomla on Ubuntu 23.10.