Amazon.co.uk Widgets

Log in

X
Joomla 5.0.3 successfully installed on Ubuntu 24.04
Joomla 5.0.3 successfully installed on Ubuntu 24.04

Joomla 5.x, on Ubuntu 24.04, with PHP 8.3

Two years after installing Ubuntu 22.04 a third party software update completely broke my Joomla site development computer. Yeah I should have known better! So, nows the time to rebuild. I've chosen to use Ubuntu 24.04 desktop, which is about to be released, and is in the very final stages of work, and pretty much finished, so that I can find our whats new, and if anything I care about is broken and hopefully then remain as updated as I dare for the forseeable future.

What will be installed

  • Apache 2, MySQL, and PHP
  • Joomla 5.x in multiple virtual sites
  • ddclient for auto updating DNS host IP addresses, because this is a laptop
  • certbot for Let's Encrypt SSL certificates

TL:DR — This is always an interesting exercise because it makes you think about all the first principles for running a content management system like Joomla. Where and how your databases will be set up, how exactly are you going to set up the web server, will your network support Let's Encrypt certificate renewal. It can be challenging to hold it all in your head, so I tend to write everything down these days and take screenshots. It becomes self documenting. I hope it is helpful to someone.

Getting ready

  1. On your freshly installed Ubuntu Desktop system run $ sudo apt update && sudo apt upgrade to get your system to the perfect state of updatedness.
  2. Theres a command called tasksel in Linux which provides an interface to allow configuration of Linux systems for particular tasks. You don't need to install it however, as tasks can be installed through apt in Ubuntu by adding a caret(^) to the end of the task package. So, to add all the ingredients of a LAMP server (Apache, MySQL and PHP) you can use the task lamp-server just run $ sudo apt install lamp-server^ which will install almost all the required dependencies for Joomla! and the defaults for this new Ubuntu 24.04 release.
  3. There is quite a list of dependencies in the lamp-server task. The important ones to note are apache2, mysql-server-8.0, and php8.3 as these are new defaults for Ubuntu Linux 24.04 LTS so they will be important baselines for years. Using the lamp-server task sudo apt install lamp-server^ ensures that all the dependencies installed are the Ubuntu 24.04 defaults and that they install in the way expected, which is cleaner than introducing other source repositories, and likely to be more maintainable in the long term.
    $ sudo apt install lamp-server^
    [sudo] password for username: 
    Reading package lists... Done
    Building dependency tree... Done
    Reading state information... Done
    Note, selecting 'libevent-pthreads-2.1-7' for task 'lamp-server'
    Note, selecting 'libperl5.38' for task 'lamp-server'
    Note, selecting 'libcurl4' for task 'lamp-server'
    Note, selecting 'libtimedate-perl' for task 'lamp-server'
    Note, selecting 'libhtml-tagset-perl' for task 'lamp-server'
    Note, selecting 'libgdbm-compat4' for task 'lamp-server'
    Note, selecting 'libssh-4' for task 'lamp-server'
    Note, selecting 'libldap2' for task 'lamp-server'
    Note, selecting 'ssl-cert' for task 'lamp-server'
    Note, selecting 'libfcgi-perl' for task 'lamp-server'
    Note, selecting 'perl' for task 'lamp-server'
    Note, selecting 'libldap-common' for task 'lamp-server'
    Note, selecting 'libaio1' for task 'lamp-server'
    Note, selecting 'libaprutil1-dbd-sqlite3' for task 'lamp-server'
    Note, selecting 'mysql-server-8.0' for task 'lamp-server'
    Note, selecting 'libapr1' for task 'lamp-server'
    Note, selecting 'php8.3-common' for task 'lamp-server'
    Note, selecting 'libsasl2-modules' for task 'lamp-server'
    Note, selecting 'mysql-client-8.0' for task 'lamp-server'
    Note, selecting 'libsasl2-2' for task 'lamp-server'
    Note, selecting 'mysql-common' for task 'lamp-server'
    Note, selecting 'libapache2-mod-php' for task 'lamp-server'
    Note, selecting 'php-common' for task 'lamp-server'
    Note, selecting 'php8.3-readline' for task 'lamp-server'
    Note, selecting 'libencode-locale-perl' for task 'lamp-server'
    Note, selecting 'librtmp1' for task 'lamp-server'
    Note, selecting 'liblua5.4-0' for task 'lamp-server'
    Note, selecting 'php8.3-opcache' for task 'lamp-server'
    Note, selecting 'libapache2-mod-php8.3' for task 'lamp-server'
    Note, selecting 'liblwp-mediatypes-perl' for task 'lamp-server'
    Note, selecting 'libsasl2-modules-db' for task 'lamp-server'
    Note, selecting 'libprotobuf-lite32' for task 'lamp-server'
    Note, selecting 'apache2-data' for task 'lamp-server'
    Note, selecting 'libhtml-template-perl' for task 'lamp-server'
    Note, selecting 'apache2-bin' for task 'lamp-server'
    Note, selecting 'liburi-perl' for task 'lamp-server'
    Note, selecting 'libfcgi0ldbl' for task 'lamp-server'
    Note, selecting 'libsodium23' for task 'lamp-server'
    Note, selecting 'libio-html-perl' for task 'lamp-server'
    Note, selecting 'mecab-ipadic-utf8' for task 'lamp-server'
    Note, selecting 'mecab-ipadic' for task 'lamp-server'
    Note, selecting 'libaprutil1' for task 'lamp-server'
    Note, selecting 'libhttp-date-perl' for task 'lamp-server'
    Note, selecting 'libmecab2' for task 'lamp-server'
    Note, selecting 'php-mysql' for task 'lamp-server'
    Note, selecting 'libhtml-parser-perl' for task 'lamp-server'
    Note, selecting 'libcgi-fast-perl' for task 'lamp-server'
    Note, selecting 'mysql-server' for task 'lamp-server'
    Note, selecting 'php8.3-mysql' for task 'lamp-server'
    Note, selecting 'mysql-server-core-8.0' for task 'lamp-server'
    Note, selecting 'apache2-utils' for task 'lamp-server'
    Note, selecting 'libbrotli1' for task 'lamp-server'
    Note, selecting 'mecab-utils' for task 'lamp-server'
    Note, selecting 'libevent-core-2.1-7' for task 'lamp-server'
    Note, selecting 'apache2' for task 'lamp-server'
    Note, selecting 'libclone-perl' for task 'lamp-server'
    Note, selecting 'mysql-client-core-8.0' for task 'lamp-server'
    Note, selecting 'libhttp-message-perl' for task 'lamp-server'
    Note, selecting 'perl-modules-5.38' for task 'lamp-server'
    Note, selecting 'libcgi-pm-perl' for task 'lamp-server'
    Note, selecting 'php8.3-cli' for task 'lamp-server'
    Note, selecting 'libaprutil1-ldap' for task 'lamp-server'
    libldap2 is already the newest version (2.6.7+dfsg-1~exp1ubuntu1).
    libldap2 set to manually installed.
    perl is already the newest version (5.38.2-3).
    perl set to manually installed.
    ssl-cert is already the newest version (1.1.2ubuntu1).
    ssl-cert set to manually installed.
    libbrotli1 is already the newest version (1.1.0-2).
    libbrotli1 set to manually installed.
    libcurl4 is already the newest version (8.5.0-2ubuntu2).
    libcurl4 set to manually installed.
    liblua5.4-0 is already the newest version (5.4.6-3).
    liblua5.4-0 set to manually installed.
    liburi-perl is already the newest version (5.27-1).
    liburi-perl set to manually installed.
    libencode-locale-perl is already the newest version (1.05-3).
    libencode-locale-perl set to manually installed.
    libtimedate-perl is already the newest version (2.3300-2).
    libtimedate-perl set to manually installed.
    libsodium23 is already the newest version (1.0.18-1build2).
    libsodium23 set to manually installed.
    libperl5.38 is already the newest version (5.38.2-3).
    libperl5.38 set to manually installed.
    libsasl2-2 is already the newest version (2.1.28+dfsg1-4).
    libsasl2-2 set to manually installed.
    libsasl2-modules is already the newest version (2.1.28+dfsg1-4).
    libsasl2-modules set to manually installed.
    libhtml-parser-perl is already the newest version (3.81-1build1).
    libhtml-parser-perl set to manually installed.
    libclone-perl is already the newest version (0.46-1build1).
    libclone-perl set to manually installed.
    librtmp1 is already the newest version (2.4+20151223.gitfa8646d.1-2build4).
    librtmp1 set to manually installed.
    libssh-4 is already the newest version (0.10.6-2).
    libssh-4 set to manually installed.
    libhttp-date-perl is already the newest version (6.06-1).
    libhttp-date-perl set to manually installed.
    libgdbm-compat4 is already the newest version (1.23-5).
    libgdbm-compat4 set to manually installed.
    libhttp-message-perl is already the newest version (6.45-1ubuntu1).
    libhttp-message-perl set to manually installed.
    libhtml-tagset-perl is already the newest version (3.20-6).
    libhtml-tagset-perl set to manually installed.
    liblwp-mediatypes-perl is already the newest version (6.04-2).
    liblwp-mediatypes-perl set to manually installed.
    libio-html-perl is already the newest version (1.004-3).
    libio-html-perl set to manually installed.
    libldap-common is already the newest version (2.6.7+dfsg-1~exp1ubuntu1).
    libldap-common set to manually installed.
    perl-modules-5.38 is already the newest version (5.38.2-3).
    perl-modules-5.38 set to manually installed.
    libsasl2-modules-db is already the newest version (2.1.28+dfsg1-4).
    libsasl2-modules-db set to manually installed.
    Suggested packages:
      apache2-doc apache2-suexec-pristine | apache2-suexec-custom php-pear
      libipc-sharedcache-perl mailx tinyca
    Recommended packages:
      libfcgi-bin
    The following NEW packages will be installed:
      apache2 apache2-bin apache2-data apache2-utils libaio1 libapache2-mod-php
      libapache2-mod-php8.3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3
      libaprutil1-ldap libcgi-fast-perl libcgi-pm-perl libevent-core-2.1-7
      libevent-pthreads-2.1-7 libfcgi-perl libfcgi0ldbl libhtml-template-perl
      libmecab2 libprotobuf-lite32 mecab-ipadic mecab-ipadic-utf8 mecab-utils
      mysql-client-8.0 mysql-client-core-8.0 mysql-common mysql-server
      mysql-server-8.0 mysql-server-core-8.0 php-common php-mysql php8.3-cli
      php8.3-common php8.3-mysql php8.3-opcache php8.3-readline
    0 upgraded, 36 newly installed, 0 to remove and 0 not upgraded.
    Need to get 36.2 MB of archives.
    After this operation, 273 MB of additional disk space will be used.
    
  4. Now you have a website. Take a look in /var/www/html
    $ ls -al /var/www/html
    total 20
    drwxr-xr-x 2 root root  4096 Mar 22 08:14 .
    drwxr-xr-x 3 root root  4096 Mar 22 08:14 ..
    -rw-r--r-- 1 root root 10671 Mar 22 08:14 index.html
    
  5. And you can run it through your browser now. Enter http://localhost in your Firefox browser on the desktop machine itself. It may not seem like much but its self documenting of the configuration layout for an Apache2 web server installation on Ubuntu systems so you should read it. It also represents a first test that you have installed Apache2 correctly.
    Screenshot of Apache2 Web Server installed by the lamp-server^ task in Ubuntu 24.04
    Screenshot of Apache2 Web Server installed by the lamp-server^ task in Ubuntu 24.04
  6. I'm going to use a really helpful tool which helps you understand whether your system can support Joomla. It's called the forum post assistant. You an find out more about it from https://forumpostassistant.github.io/docs/ and it helps you explain your environment if asking questions on the official Joomla Forum. Installing it is as simple as placing the downloaded file from https://github.com/ForumPostAssistant/FPA/zipball/en-GB in /var/www/html. Normally you'd install it on a fully working site to diagnose problems, but it will be instructive in explaining how near or far the default lamp-server task gets us to a working environment. Just download it and copy or move it into /var/www/html for example $ sudo cp ~/Downloads/fpa-en.php /var/www/html. You need sudo because the html folder is owned by root, I'm not changing that as I believe in leaving things on their defaults as much as possible. Now in your browser go to http://localhost/fpa-en.php and you'll get an incredibly detailed snapshot of your machine and its readiness for Joomla.
    Just lamp-server Screenshot Forum Post Assistant v1.6.6 en-GB
    Just lamp-server Screenshot Forum Post Assistant v1.6.6 en-GB

PHP modules recommended by Joomla

  1. Joomla recommend PHP 8.2, but lets persevere with 8.3 as its going to be in this Ubuntu 24.04 LTS release for years. Joomla also recommend various PHP modules so its worth documenting them.
    Comparison of PHP modules recommended by Joomla with those installed by lamp-server task
    #Recommended by JoomlaIn lamp-server install
    1 json Yes
    2 simplexml No
    3 dom No
    4 zlib Yes
    5 gd No
    5 one of mysqlnd, or pdo_mysql, or pdo_pgsql Yes pdo_mysql
  2. Install any missing php modules as advised by the Forum Post Assistant $ sudo apt install php-{simplexml,dom,gd,zip,curl,mbstring}
  3. Joomla needs Apache mod_rewrite in order to support SEO friendly URL's.Forum post assistant also notes that mod_expires and mod_ssl are also potentially missing.
  4. These are all easy to enable using $ sudo a2enmod rewrite expires ssl.

Php Info for Ubuntu 24.04

You can get more information about PHP by creating a phpinfo file in /var/www/html, it just needs to contain <?php phpinfo(); ?>, then you can navigate to http://localhost/phpinfo.php and get a very detailed report.

Screenshot of 8.3.0-1ubuntu1
Screenshot of 8.3.0-1ubuntu1

Does Joomla run out of the box?

  1. Being curious, I wonder if Joomla will 'just run' as is. Lets find out. Load https://downloads.joomla.org/ and go ahead and download the latest full version. At the time of writing this was 5.0.3.
    Screenshot of Joomla Downloads page
    Screenshot of Joomla Downloads page
  2. Guess not. Theres still work to do! If you see this daunting looking error it is almost certainly permissions.
    • 500 error on installation Joomla 5.0.3
      500 error on installation Joomla 5.0.3
  3. Remember that Ubuntu Apache2 uses www-data as the Apache user. This is a development machine, so the developer user needs to be able to control all the files and the Apache web server user needs to be able to serve them. The last step below, of enabling members of the www-data group to write to the folder and files is the key!
    • Change into the webservers folder % cd /var/www
    • Make the current user the owner, but leave www-data as the group % sudo chown -R $USER:www-data /var/www/ *
    • Make sure your permissions are good. www-data needs to be able to write to install and run Joomla $ chmod +R g+w *!
  4. And now you can run setup and proceed
    Joomla 5.0.3 installation, language and site picker
    Joomla 5.0.3 installation, language and site picker

Setting up your MySQL users for Joomla and installing Joomla

  1. You'll need some MySQL setup to continue with the database configuration. Joomla doesn't create database users. It never has.
  2. First find the login, and password for your newly installed MySQL server which is in the /etc/mysql/debian.cnf file $ sudo cat /etc/mysql/debian.cnf
  3. Now you can use that password for mysql $ mysql -u debian-sys-maint -p thepasswordyoufoundinthecnf
  4. Create a database user for Joomla
    USE mysql
    CREATE USER 'joomla'@'localhost' IDENTIFIED BY 'yourpassword';
    GRANT ALL PRIVILEGES ON *.* TO 'joomla'@'localhost' WITH GRANT OPTION;
    FLUSH PRIVILEGES;

    Use the joomla user and password you just created in the install screen and set of change the database and table names.
    Joomla 5.0.3 installation. Database settings
    Joomla 5.0.3 installation. Database settings
  5. Your setup is complete.
    Joomla 5.0.3 installation - completed!
    Joomla 5.0.3 installation - completed!
  6. Setting up SSL certificate using Let's Encrypt is pretty well covered in my other article How to set up secure virtual hosts using Let's Encrypt with Apache2 on Ubuntu 24.04 LTS
  7. Once you've finished setting up SSL don't forget to move the htaccess.txt file to dot htaccess in your web folder root in order to use rewritten URLs properly.

Default Joomla site ready to be put to work

Your Joomla development playground awaits. Why not back it up now, as it is completely empty, you never know when you'll need it!

Joomla 5.0.3 Default Template - Cassiopeia
Joomla 5.0.3 Default Template - Cassiopeia
Joomla 5.0.3 Default Admin Template - Atum
Joomla 5.0.3 Default Admin Template - Atum

 

See also

Item – https://stackoverflow.com/questions/42421585/default-password-of-mysql-in-ubuntu