Contao¶
License: LGPL 3.0
This guide is tested with Contao 5.7.5 on Uberspace 8.0.75. We can't guarantee it to work with newer versions.
Contao is a free, open-source Content Management System (CMS) written in PHP. Contao is used to build and manage professional websites of different types and size ranges that are easy to maintain.
It is based on Symfony, a popular high performance PHP framework for web development. Contao has been designed as a Symfony bundle, which can be used to add CMS functionality to any Symfony application.
Contao (formerly TYPOlight) was released for the first time in 2006 by Leo Feyer. Since then it has been continuously developed and it is actively maintained by the Contao Core Development Workgroup and other contributors.
Prerequisites¶
We're using PHP in version 8.4:
[isabell@moondust ~]$ uberspace tool version set php 8.4
OK: Set version of php to 8.4
Create Database¶
Contao saves your data in a MariaDB database. Create a database for your Contao installation:
[isabell@moondust ~]$ mariadb -e "CREATE DATABASE ${USER}_contao"
Document Root Preparation¶
Since Contao uses the subdirectory public/ as web root of your website you should not install Contao in your default Uberspace DocumentRoot. Instead, we install it next to that and use a symlink to make it accessible to the web:
[isabell@moondust ~]$ cd /var/www/virtual/$USER/
[isabell@moondust isabell]$ rm -r html
[isabell@moondust isabell]$ mkdir -p contao/public
[isabell@moondust isabell]$ ln -s contao/public html
Installation¶
Download the Contao Manager to your web root:
[isabell@moondust ~]$ cd /var/www/virtual/$USER/contao/public
[isabell@moondust public]$ wget "https://download.contao.org/contao-manager.phar.php"
Configuration¶
To complete the installation, you need to run the Contao Manager, which will guide you through the installation process.
Point your web browser to your website URL and append contao-manager.phar.php (e.g. https://isabell.uber.space/contao-manager.phar.php) to start the Contao configuration.
-
Manager Account: When you run the Contao install tool for the first time, the web-based installer will prompt you to choose a new username and offers to create a passkey you can save in your password manager. If you prefer to use a password, click on the arrow and choose
Use password for loginbefore you click onCreate Account. -
You can enable 2FA to provide additional protection for your account, which is recommended, but you also have the option to skip it for now.
-
Warning
Please skip the crossed-out part until this issue is fixed.
The
System Checkwill now evaluate whether all requirements are fulfilled.Next toServer Configurationyou can click onChangeand uncheck the settingUse the Composer Resolver Cloudif you want. For an average installation, your Asteroid provides enough resources to run Composer and this will prevent problems, if the Composer Cloud is not available. ClickSave. -
Theyou can click onSystem Checkwill run again, andSetup, followed byGet started. On theWebserver Setuppage, you can click onContinuebecause we've already made sure that the directory structure is correct. Now, select a version. If you have no special needs, it's a good idea to go with an LTS version. ClickInstalland wait until the installation completes. -
Database Configuration: To configure your database connection, you need to enter the MariaDB database credentials. The following command will show you your
usernameandpassword:[isabell@moondust ~]$ my_print_defaults client --user=isabell --password=MySuperSecretPasswordThe other settings are:
Click
Save. In the next step, clickCheck databaseand once the process has finished, clickExecute. After everything is complete, clickConfirm & Close. -
Your database schema should now be up to date, so that you can click
Continue. -
Backend Account: Create a Contao backend administrator account.
You have successfully installed the Contao CMS!
Contao Backend¶
Point your web browser to your website URL and append /contao to open the Contao backend login page (e.g. https://isabell.uber.space/contao)
Log in to the Contao backend by entering the credentials of your backend account.
Tuning¶
Backend search¶
Contao has a backend search that makes it easy to find any kind of content. For technical reasons, this requires a cron job that runs every minute. Fortunately, your Asteroid lets you set this up, so if you want to use it, follow the next steps.
Install Search Engine¶
First, you'll need a search engine; several are supported. If you don't have specific requirements, Loupe is the best choice, since it only requires an additional SQLite database. Launch the Contao Manager and search for contao/loupe-bridge. Now install Loupe Bridge by clicking Add and then start the installation under PACKAGES by clicking Apply Changes. No further configuration is required after you've clicked Confirm & Close.
Add Cron Job¶
Open your cron table:
[isabell@moondust ~]$ crontab -e
Add the following lines (without deleting existing content):
MAILTO=""
* * * * * /usr/bin/php /var/www/virtual/isabell/contao/vendor/bin/contao-console contao:cron
Press Ctrl+O, then Enter, and finally Ctrl+X to save and exit.
Rebuild Search Index¶
Log in to the backend, navigate to the Maintenance page, and click Rebuild index under Back end search.
Updates¶
Note
Check the update feed regularly.
To update an existing Contao installation, start the Contao Manager again (e.g., by visiting https://isabell.uber.space/contao-manager.phar.php). If a new version of the Contao Manager is available, the System Check may prevent you from continuing. In this case, update the Contao Manager first by clicking Run Self-Update.
From time to time (and if you change the PHP version), you should run a full package update. To do this, click Update Packages under PACKAGES. Instead of confirming with Apply Changes, click the arrow next to it and select the Update all packages option.
Warning
The Contao Managed Edition and especially additional bundles and modules are not updated automatically, so make sure to regularly install security and maintenance updates.
Useful Links¶
- Contao News: official announcements
- Contao Academy Tutorials: useful tutorials on Contao topics (in German)
- trakked.io Blog: new version announcements as well as helpful tips for updates