Operating System CentOS

How to Install TestLink on AlmaLinux 9 or Rocky Linux 9

Set up the TestLink test management system on AlmaLinux 9 or Rocky Linux 9 with Apache, MariaDB and PHP 8.3, from the maintained 1.9.20 branch.

This guide installs TestLink, the open source test management system, on AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with Apache, MariaDB and PHP 8.3. At the end you will have a working TestLink site with its log and upload directories stored outside the web root, SELinux left in enforcing mode, and the installer removed. CentOS 7 reached end of life in June 2024 and its PHP 5.4 cannot run current TestLink code, so a RHEL 9 compatible system replaces it here.

Project status: which TestLink code to install

TestLink 1.9.20 ("Raijin") is the last numbered release, and the project states that it is the final version of the 1.9.x line. That release archive was written for PHP 7 and does not run cleanly on PHP 8. Maintenance continues in the testlink_1_9_20_fixed branch of the official GitHub repository, which received PHP 8 compatibility work and security fixes through 2025 (the most recent commits at the time of writing are from December 2025). A 2.x version with a new interface has been announced but not released.

In practice this means you install from the Git branch rather than from a release archive. Development is slow and carried by a very small team, so weigh that before adopting TestLink for a new project. The branch already contains its PHP dependencies in the vendor directory, so Composer is not needed.

Requirements

  • A server running AlmaLinux 9, Rocky Linux 9 or CentOS Stream 9 with at least 1 GB of RAM.
  • A user with sudo rights (the examples use deploy).
  • A host name such as testlink.example.com pointing to the server.

Update the system first:

sudo dnf -y update

Install Apache, MariaDB and PHP 8.3

The default PHP in RHEL 9 compatible systems is 8.0, which no longer receives upstream fixes. Switch the AppStream module to the 8.3 stream before installing. On these systems Apache runs PHP through PHP-FPM, which is installed automatically with the php package.

sudo dnf -y module reset php
sudo dnf -y module enable php:8.3
sudo dnf -y install httpd mariadb-server git policycoreutils-python-utils \
  php php-mysqlnd php-gd php-mbstring php-xml php-curl php-ldap

The installer checks for the mysqli, gd, json, curl and ldap extensions. GD is used for charts, cURL for issue tracker integration and LDAP only if you authenticate against a directory. JSON is built into PHP 8.

TestLink warns about several PHP limits. Large test plans submit more form fields than the default max_input_vars allows, and XML imports can exceed the default memory limit. Create /etc/php.d/99-testlink.ini:

max_input_vars = 10000
memory_limit = 256M
max_execution_time = 120

Start the services and open the firewall:

sudo systemctl enable --now mariadb php-fpm httpd
sudo firewall-cmd --permanent --add-service=http --add-service=https
sudo firewall-cmd --reload

Prepare MariaDB

TestLink creates a stored function, and its README requires the log_bin_trust_function_creators option for MySQL and MariaDB. Create /etc/my.cnf.d/testlink.cnf:

[mysqld]
log_bin_trust_function_creators = 1

Restart MariaDB and run the hardening script:

sudo systemctl restart mariadb
sudo mariadb-secure-installation

The web installer creates the TestLink database and its user itself, but it needs an account that is allowed to do so. The MariaDB root account on these systems logs in through the local socket only, so create a temporary administrator for the installer and remove it afterwards:

sudo mariadb
CREATE USER 'tladmin'@'localhost' IDENTIFIED BY 'temporary-admin-password';
GRANT ALL PRIVILEGES ON *.* TO 'tladmin'@'localhost' WITH GRANT OPTION;
EXIT;

Download TestLink

Clone the maintained branch into /var/www/testlink:

sudo git clone --depth 1 --branch testlink_1_9_20_fixed \
  https://github.com/TestLinkOpenSourceTRMS/testlink-code.git /var/www/testlink

Create the log and upload directories

TestLink stores logs and uploaded attachments on disk. Its defaults are /var/testlink/logs/ and /var/testlink/upload_area/, deliberately outside the web root so that they cannot be fetched with a browser; the directories are not created for you. The web server also needs to write compiled templates to gui/templates_c and, during installation only, the database settings file config_db.inc.php.

sudo mkdir -p /var/testlink/logs /var/testlink/upload_area
sudo touch /var/www/testlink/config_db.inc.php
sudo chown -R apache:apache /var/testlink /var/www/testlink/gui/templates_c \
  /var/www/testlink/config_db.inc.php

With SELinux enforcing, Apache and PHP-FPM can only write to paths labelled for it. Label exactly those paths instead of disabling SELinux:

sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/testlink(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/testlink/gui/templates_c(/.*)?"
sudo semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/testlink/config_db.inc.php"
sudo restorecon -R /var/testlink /var/www/testlink

If you prefer other locations, set the environment variables TESTLINK_LOG_PATH and TESTLINK_UPLOAD_AREA for PHP, or override $tlCfg->log_path and $g_repositoryPath in custom_config.inc.php (copy custom_config.inc.php.example as a starting point). Do not edit config.inc.php itself, because updates overwrite it.

Configure Apache

Create /etc/httpd/conf.d/testlink.conf:

<VirtualHost *:80>
    ServerName testlink.example.com
    DocumentRoot /var/www/testlink
    <Directory /var/www/testlink>
        Options -Indexes
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>
sudo apachectl configtest
sudo systemctl restart php-fpm httpd

Run the web installer

Open http://testlink.example.com/. TestLink detects that it is not installed and redirects to /install/index.php.

  1. Choose New installation and accept the licence.
  2. Review the system check. It lists the PHP extensions and confirms that the template, log and upload directories exist and are writable. Fix anything marked as failed and reload.
  3. On the database page select MySQL/MariaDB, host localhost, and a database name such as testlink. Enter tladmin and its password as the database admin login. For the TestLink database login choose a new user name and a strong password; the installer creates that user.
  4. Start the installation. The installer creates the tables and writes config_db.inc.php.

The last page tells you to run one SQL script by hand: it creates the UDFStripHTMLTags function and contains a placeholder for your database name. Replace the placeholder and load it in one step (adjust testlink if you chose another database name):

sed 's/YOUR_TL_DBNAME/testlink/g' \
  /var/www/testlink/install/sql/mysql/testlink_create_udf0.sql | sudo mariadb

Secure the installation

A new installation has one account, admin with the password admin. Log in and change it immediately under My Settings.

Then remove the installer, make the database settings file read-only for the web server, and drop the temporary database administrator:

sudo rm -rf /var/www/testlink/install
sudo chown root:apache /var/www/testlink/config_db.inc.php
sudo chmod 640 /var/www/testlink/config_db.inc.php
sudo semanage fcontext -d "/var/www/testlink/config_db.inc.php"
sudo restorecon /var/www/testlink/config_db.inc.php
sudo mariadb -e "DROP USER 'tladmin'@'localhost';"

TestLink shows a security warning after login for as long as the install directory exists. Finally, put the site behind HTTPS before real users log in, for example with a Let's Encrypt certificate obtained through Certbot.

Updates and backups

Because fixes arrive as commits on the branch rather than as numbered releases, updating means pulling the branch. Back up first; a complete backup is the database plus the upload directory and your own configuration files:

sudo mariadb-dump testlink | gzip > ~/testlink-$(date +%F).sql.gz
sudo tar czf ~/testlink-files-$(date +%F).tar.gz /var/testlink/upload_area \
  /var/www/testlink/config_db.inc.php
sudo git -C /var/www/testlink pull

If you created custom_config.inc.php, include it in the backup as well. Review the commit log before pulling on a production system; there is no separate stable channel.

Frequently asked questions

Can I install the TestLink 1.9.20 archive from SourceForge instead?

Only on PHP 7, which is no longer supported upstream and is not available in the standard RHEL 9 repositories. On PHP 8 use the testlink_1_9_20_fixed branch, which carries the compatibility fixes.

The system check says a directory is not writable although the permissions are correct. Why?

That is almost always SELinux. Check the label with ls -Zd /var/testlink/logs; it must show httpd_sys_rw_content_t. Re-run the semanage fcontext and restorecon commands for the path, and look in /var/log/audit/audit.log for denials.

Does TestLink work with PostgreSQL?

Yes. The README lists PostgreSQL alongside MySQL and MariaDB, and the installer offers it when the pgsql PHP extension is loaded (php-pgsql package). Microsoft SQL Server support is described by the project as incomplete.

Is there a container image?

The repository includes a Dockerfile and a Compose file that build TestLink with a MySQL container, documented in docker/README.md. The project does not publish an official image of its own, so you build it from the source tree.

Share story:

Continue reading other guides on How VPS.