How to Install TYPO3 CMS on Debian 12

TYPO3 is a free and open-source Enterprise-grade content management system. It provides enterprise-level features such as a scalable CMS with multisite support, multilingual installations, strong security implementation, blazingly fast, and can be run anywhere.

Using TYPO3 CMS allows you to build flexible and reliable websites. The TYPO3 CMS is backend a vibrant professional community. By design, the TYPO3 CMS is a pluggable content management system with adaptable and decoupled architecture.

This tutorial shows you how to install the TYPO3 CMS on a Debian 12 server on a LAMP Stack (Apache2, MariaDB, and PHP).

Prerequisites

Before you proceed with this guide, ensure you have:

  • A Debian 12 server.
  • A non-root user with sudo administrator privileges.
  • A domain name pointed to your server IP address.

Installing Dependencies

TYPO3 is an open-source content management system written in PHP and supports the MySQL/MariaDB database server. The TYPO3 CMS can be installed via Composer PHP Dependency Manager and can be run with Apache2 or Nginx web server.

In this guide, you will run TYPO3 CMS with the LAMP Stack (Apache2, MariaDB, and PHP) and Composer, which can be installed easily via APT from the official Debian repository. Complete the following steps to install those dependencies for TYPO3 CMS.

First, update and refresh your Debian repository using the command below.

sudo apt update

update repoi

Now install package dependencies for TYPO3 CMS using the apt install command below. With this command, you will install the LAMP Stack (Apache2, MariaDB, PHP) with additional PHP extensions and the Composer as a PHP dependency manager.

sudo apt install apache2 mariadb-server composer php php-common php-mysql libapache2-mod-php php-gd php-curl php-json php-xmlrpc php-intl php-bcmath php-zip php-apcu php-mbstring php-fileinfo php-xml php-soap

Type yo to confirm and proceed with the installation.

install deps

After dependencies are installed, you must verify each dependency to ensure that the installation is successful.

Execute the following command to ensure the apache2 service is running and enabled.

sudo systemctl is-enabled apache2
sudo systemctl status apache2

The following output indicates that apache2 service is running and enabled.

check apache2

Now verify the mariadb service using the command below.

sudo systemctl is-enabled mariadb
sudo systemctl status mariadb

Similar to the apache2 service, the output enabled confirms that the mariadb is enabled. And the output active (running) confirms that the mariadb is running.

check mariadb

Next, verify your PHP version and extensions using the following command.

php -v
php -m

You should see that PHP 8.2 is installed with some extensions enabled, such as apcu, curl, fileinfo, and gd.

check php

Lastly, execute the following command to ensure that the COmposer is installed. Then, verify the Composer version.

which composer
sudo -u www-data composer -v

An output below shows you that Composer 2.5 is installed at /usr/bin/composer.

check composer

Configuring PHP

After installing the LAMP Stack and Composer, you will configure your PHP installation. The TYPO3 CMS requires some specific PHP settings to run, now you will modify the php.ini configuration as needed for TYPO3 CMS installation.

Open the default PHP configuration /etc/php/8.2/apache2/php.ini using the following nano editor command.

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

Change the default PHP configuration like this and be sure to adjust the memory_limit and date.timezone options with your server environment.

memory_limit = 512M
max_execution_time = 240
max_input_vars = 1500

date.timezone = Europe/Amsterdam

post_max_filesize = 50M
upload_max_filesize = 50M

Save and exit the file when you're finished.

Now run the following systemctl command to restart the apache2 service and apply the changes to your PHP installation.

sudo systemctl restart apache2

Then, create a new PHPINFO file /var/www/html/info.php by executing the command below. This will ensure that your PHP installation is working.

echo "<?php phpinfo(); ?>" > /var/www/html/info.php

Lastly, open your web browser and visit the server IP address followed by the PHPINFO file path, such as http://192.168.10.15/info.php. If everything goes well, you should see detailed information about your PHP installation.

phpinfo

Configuring MariaDB Server

In the following section, you will secure the MariaDB server via the mariadb-secure-installation utility and create a new database and user that will be used by TYPO3 CMS via the mariadb client.

Execute the mariadb-secure-installation command below to secure your MariaDB server installation.

sudo mariadb-secure-installation

During the process, you will be asked to change some of the default MariaDB configurations. Input Y to apply the changes, or n for No to reject it.

Below are some of the MariaDB server configurations you will be asked for:

  • Switch to unix_socket authentication?. Input n and press ENTER. The default MariaDB root user is already protected. optionally, you can also enable it by typing y for yes.
  • Change the root password? Input y to confirm and set up your new MariaDB root password.
  • Remove anonymous user? Input y to confirm.
  • Disallow root login remotely? Input y to confirm. Only local connection will be allowed if you are using the MariaDB root user.
  • Remove test database and access to it? Input y to confirm and remove the default database 'test'.
  • Lastly, input y again to reload all tables privileges on your MariaDB server and apply new changes.

After securing the MariaDB server, you will create a new database and user that will be used by TYPO3 CMS. To create those, you must log in to the MariaDB server via the mariadb client command.

Log in to the MariaDB server via the mariadb command below. Input your MariaDB root password when prompted.

sudo mariadb -u root -p

Once logged in, run the following queries to create a new database typo3db and user typo3. Be sure to change the password in the following queries.

CREATE DATABASE typo3db;
GRANT ALL PRIVILEGES ON typo3db.* to typo3@localhost IDENTIFIED BY 'typo3password';
FLUSH PRIVILEGES;

create database

Next, run the following query to ensure that the user typo3 can access the database typo3db.

SHOW GRANTS FOR typo3@localhost;

An output below confirms that the MariaDB user typo3 can access the database typo3db.

verify database user

Type quit to exit from the MariaDB server.

Downloading TYPO3 CMS via Composer

In this guide, you will install TYPO3 CMS version 12, which can be downloaded via Composer. In the following steps, you will set up the web root directory and download the TYPO3 CMS source, You will also configure proper permission and ownership for the TYPO3 CMS web root directory.

Create a new web root directory /var/www/typo3 and additional directories /var/www/{.cache,.config} using the following command. The directory /var/www/typo3 will be used as the web root directory for your TYPO3 CMS installation.

mkdir -p /var/www/{.cache,.config,typo3}

Now run the command below to change the ownership of the /var/www/typo3 directory to the user www-data. Then, enable read and write access for the owner of the /var/www/typo3 directory.

sudo chown -R www-data:www-data /var/www/{.cache,.config,typo3}
sudo chmod u+rw /var/www/typo3

Next, go to the /var/www/typo3 directory and download the TYPO3 CMS source via the composer command below. In this example, you will be downloading the TYPO3 CMS 12.

cd /var/www/typo3
sudo -u www-data composer create-project typo3/cms-base-distribution:^12 .

The following output will be shown during the process:

install typo3 cms

When finished, below is the output you should get:

installation finished

After the TYPO3 CMS source code is downloaded, execute the ls command below to list the source code.

ls

You should see the list of TYPO3 CMS source code like the following:

list files source code

Setting Up Apache2 Virtual Host

In the following section, you will create a new Apache2 virtual host configuration that will be used to run the TYPO3 CMS. So before going further, ensure that you have a domain name pointed to your server IP address.

First, enter the following command to enable modules rewrite and headers.

sudo a2enmod rewrite headers

Now create a new virtual host configuration /etc/apache2/sites-available/typo3.conf using the following nano editor command.

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

Insert the following configuration and be sure to change the domain name of your TYPO3 CMS installation.

<VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/typo3/public
    ServerName hwdomain.io

     <Directory /var/www/typo3/public/>
          Options FollowSymlinks
          AllowOverride All
          Require all granted
     </Directory>

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined
    
     <Directory /var/www/typo3/public/>
            RewriteEngine on
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^(.*) index.php [PT,L]
    </Directory>
</VirtualHost>

Save the file and exit the editor when you're done.

Next, run the command below to activate the new virtual host file typo3.conf and verify your Apache2 syntax.

sudo a2ensite typo3.conf
sudo apachectl configtest

When you've proper Apache2 syntax, you should get an output Syntax OK.

configure apache2

Lastly, enter the command below to restart the apache2 service and apply the changes that you've made.

sudo systemctl restart apache2

Securing TYPO3 CMS with Certbot

After configuring the virtual host, you will secure your TYPO3 CMS installation by enabling secure HTTPS with SSL/TLS certificates from Letsencrypt. You will be using Certbot and Certbot Apache plugin for generating Letsencrypt certificates.

Install Certbot and Certbot Apache plugin using the following apt command.

sudo apt install certbot python3-certbot-apache

Type y to proceed with the installation.

install certbot

Once installation is finished, run the certbot command below to generate new SSL/TLS certificates for your TYPO3 CMS installation. Be sure to change the domain name and the email address with your information.

sudo certbot --apache --agree-tos --no-eff-email  --redirect --hsts --staple-ocsp --email [email protected] -d hwdomain.io

Your SSL/TLS certificates will be available at /etc/letsencrypt/live/domain.com directory. And the virtual host file typo3.conf will automatically configured with HTTPS, which is done via the Certbot Apache plugin.

Installing TYPO3 CMS via Web Installer

First, run the following command to create a new file /var/www//typo3/public/FIRST_INSTALL. The TYPO3 web installer will not be available unless the file /var/www/typo3/public/FIRST_INSTALL is available.

sudo -u www-data touch /var/www//typo3/public/FIRST_INSTALL

Now open your web browser and visit your TYPO3 CMS domain name, such as https://hwdomain.io/. You will be redirected to the TYPO3 web installer.

Ensure your system environment is ready, then click No problems detected, and continue with the installation.

install typo3

Input details of MariaDB database user, password, and host, then click Continue.

db settings

Select the option Use existing empty database and select the database typo3db. Then, click Continue again.

select database

Next, input the new admin user, password, and email address for your TYPO3 CMS installation. Click Continue to confirm.

create admin user

Once the installation is finished, you should get the following page.

installation finished

Click the Open the TYPO3 Backend to access the TYPO3 administration dashboard.

You should get the TYPO3 login page. Input your username and password, then click Login.

login typo3

When login is successful, you should see the TYPO3 administration dashboard like the following:

backend administration dashboard

On the top right menu, click the information menu and you should get detailed information about your TYPO3 CMS installation. In the following screenshot, you should see that TYPO3 CMS 12 is installed with PHP 8.2, the MariaDB server 10.11, and the Apache2 web server 2.4.

system info

Conclusion

In conclusion, you have successfully installed TYPO3 CMS on the Debian 12 server with the LAMP Stack (Apache2, MariaDB, and PHP) and Composer PHP package manager. You've also secured your TYPO3 CMS installation with SSL/TLS certificates generated from Letsencrypt using Certbot and Certbot Apache plugin. You can now use TYPO3 CMS to manage your content, record management, set up additional language for multilingual sites, and many more.

Share this page:

0 Comment(s)