Operating System CentOS

Install LibreBooking (Booked Scheduler Fork) on AlmaLinux 9 or Rocky Linux 9

The open-source Booked Scheduler was discontinued in 2020. Install LibreBooking, its maintained fork, on AlmaLinux 9 or Rocky Linux 9 with Apache, PHP and MariaDB.

Booked Scheduler, the resource booking application formerly known as phpScheduleIt, is no longer available as open-source software: its developer turned it into a hosted, paid service on November 1, 2020, and 2.8.5 was the last open-source release. The code lives on as LibreBooking, a GPL-3.0 community fork that is actively maintained. CentOS 7 reached end of life in June 2024; its successors are AlmaLinux 9, Rocky Linux 9 and CentOS Stream 9.

This guide installs LibreBooking 7.2.0 on AlmaLinux 9 or Rocky Linux 9 with Apache, PHP 8.3 and MariaDB 10.11, which is the stack the project supports. At the end you have a working booking site with an administrator account and the background jobs scheduled.

Do not install the old 2.x Booked Scheduler archives that still circulate. The LibreBooking project states that every version before 7.2.0 contains a high-severity stored cross-site scripting flaw that lets any signed-in user take over an administrator account, and that fixes are not backported.

Requirements

  • AlmaLinux 9 or Rocky Linux 9 (9.6 or later, so that the PHP 8.3 and MariaDB 10.11 module streams are available) and a user with sudo rights.
  • A domain name pointing to the server. The examples use booking.example.com.
  • LibreBooking needs PHP 8.2 or later, MySQL 8.0 or later or MariaDB 10.6 or later, and Apache 2.4. The project does not test or support other web servers such as Nginx.

Step 1: Install Apache, PHP and MariaDB

The default PHP (8.0) and MariaDB (10.5) in the 9 family are too old, so enable newer module streams first:

sudo dnf upgrade -y
sudo dnf module reset -y php mariadb
sudo dnf module enable -y php:8.3 mariadb:10.11

Install the web server, the database server and the PHP extensions LibreBooking requires. php-gd, php-bcmath and php-ldap are optional (image processing, Active Directory and LDAP sign-in):

sudo dnf install -y httpd mariadb-server git unzip \
  php php-cli php-mysqlnd php-pdo php-intl php-mbstring php-xml \
  php-gd php-bcmath php-ldap policycoreutils-python-utils

Composer, which installs LibreBooking's PHP libraries, is packaged in EPEL:

sudo dnf install -y epel-release
sudo dnf install -y composer

Start the services and open the firewall for web traffic:

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

Step 2: Create the database

Open the MariaDB shell as root:

sudo mariadb

Create a database and a user for LibreBooking. Replace the password with your own:

CREATE DATABASE librebooking CHARACTER SET utf8mb4;
CREATE USER 'lb_user'@'localhost' IDENTIFIED BY 'choose-a-strong-password';
GRANT ALL PRIVILEGES ON librebooking.* TO 'lb_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 3: Download LibreBooking

The 7.2.0 release has no pre-built archive attached, so fetch the tagged source and install the dependencies with Composer. Do this as your normal user, not as root:

sudo mkdir /var/www/librebooking
sudo chown $USER: /var/www/librebooking
git clone --depth 1 --branch v7.2.0 https://github.com/LibreBooking/librebooking.git /var/www/librebooking
cd /var/www/librebooking
composer install --no-dev

Check the project's releases page for a newer tag before you start and use it instead of v7.2.0.

Step 4: Configure LibreBooking

Copy the sample configuration and open it:

cd /var/www/librebooking
cp config/config.dist.php config/config.php
nano config/config.php

The file returns one PHP array. Find these keys inside 'settings' and set them:

'admin.email' => 'admin@example.com',
'default.timezone' => 'Europe/London',
'script.url' => 'http://booking.example.com/Web',
'install.password' => 'choose-an-installer-password',

script.url must be the public URL of the Web directory; if it is empty, every user sees a warning. admin.email matters: the account that later registers with this address becomes the administrator. Further down, fill in the 'database' section:

'database' => [
    'type' => 'mysql',
    'hostspec' => '127.0.0.1',
    'name' => 'librebooking',
    'user' => 'lb_user',
    'password' => 'choose-a-strong-password',
],

Permissions and SELinux

The web server must be able to write to the template directories and the upload directories, and should be the only other account that can read the configuration file:

cd /var/www/librebooking
mkdir -p uploads/reservation Web/uploads/images
sudo chown -R apache:apache tpl tpl_c uploads Web/uploads
sudo chgrp apache config/config.php
sudo chmod 640 config/config.php

SELinux is enforcing by default, so label those directories as writable for Apache and allow PHP to reach the database over TCP:

sudo semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/librebooking/(tpl|tpl_c|uploads|Web/uploads)(/.*)?'
sudo restorecon -R /var/www/librebooking
sudo setsebool -P httpd_can_network_connect_db 1

If LibreBooking will send mail through a remote SMTP server, also run sudo setsebool -P httpd_can_network_connect 1.

Step 5: Configure Apache

LibreBooking expects the document root to be the project directory itself, not its Web subdirectory; pointing the document root at Web is unsupported and breaks navigation and sign-in redirects. The public address therefore always contains /Web/. Create a virtual host:

sudo nano /etc/httpd/conf.d/librebooking.conf
<VirtualHost *:80>
    ServerName booking.example.com
    DocumentRoot /var/www/librebooking

    <Directory /var/www/librebooking>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/httpd/librebooking-error.log
    CustomLog /var/log/httpd/librebooking-access.log combined
</VirtualHost>

LibreBooking needs the Apache rewrite and headers modules; both are loaded by default on these distributions, which you can confirm with httpd -M | grep -E 'rewrite|headers'. Test the configuration and restart Apache:

sudo apachectl configtest
sudo systemctl restart httpd

Before real users sign in, add a TLS certificate to this virtual host and change script.url to https://.

Step 6: Run the installer and create the administrator

First let LibreBooking check its own requirements (PHP version and extensions, dependencies, configuration file, writable directories and database connection):

cd /var/www/librebooking
composer preflight

Then open http://booking.example.com/Web/install in a browser. Enter the installer password from config.php and the database credentials, and let the wizard create the tables. The database and user already exist, so leave the options for creating them switched off.

Importing only create-schema.sql and create-data.sql by hand, as older Booked Scheduler tutorials do, fails with LibreBooking: the upgrade scripts in database_schema/upgrades have to be applied in between. The wizard does that for you.

When the wizard has finished, go to http://booking.example.com/Web/register.php and register with the address you set as admin.email. That account receives administrator rights. Finally, disable the wizard again by emptying the installer password in config/config.php:

'install.password' => '',

Step 7: Schedule the background jobs

Reminders, waitlist notifications, automatic release of unused reservations and cleanup run from cron. Edit the crontab of the apache user:

sudo crontab -u apache -e

Add the jobs the project documents:

* * * * * /usr/bin/env php -f /var/www/librebooking/Jobs/autorelease.php
* * * * * /usr/bin/env php -f /var/www/librebooking/Jobs/sendreminders.php
* * * * * /usr/bin/env php -f /var/www/librebooking/Jobs/sendmissedcheckin.php
* * * * * /usr/bin/env php -f /var/www/librebooking/Jobs/sendwaitlist.php
0 0 * * * /usr/bin/env php -f /var/www/librebooking/Jobs/sendseriesend.php
0 0 * * * /usr/bin/env php -f /var/www/librebooking/Jobs/sessioncleanup.php
0 1 * * * /usr/bin/env php -f /var/www/librebooking/Jobs/deleteolddata.php

The mail jobs only send anything when email is enabled in the configuration.

Upgrading and troubleshooting

  • Upgrades: back up the database and the installation directory, put the new release in place, copy your config/config.php into it, run composer install --no-dev again and open /Web/install/configure.php to update the configuration file. Then run the wizard at /Web/install to upgrade the database. Because security fixes are not backported, stay on the latest release.
  • Blank page or template errors: the web server cannot write to tpl_c or tpl. Recheck ownership and the SELinux labels from step 4.
  • Database connection errors: confirm the httpd_can_network_connect_db boolean is on and test the credentials with mariadb -u lb_user -p librebooking.
  • More detail: set the level key in the 'logging' section to debug and make sure the configured log folder is writable by apache. PHP's session.auto_start must stay disabled, which is the default.

The full option reference is in the LibreBooking documentation; the source and release notes are in the project repository.

Frequently asked questions

Is Booked Scheduler still free?

No. Since November 2020 Booked is sold only as a hosted subscription service. The last open-source version, 2.8.5, receives no fixes. LibreBooking continues from that code under the GPL-3.0 licence and has diverged considerably since.

Can I move an existing Booked Scheduler 2.x installation to LibreBooking?

LibreBooking descends from the same database schema, and its upgrade procedure applies the scripts in database_schema/upgrades in version order starting from the version you run. Restore a copy of your database on a test server, point a fresh LibreBooking installation at it and run the upgrade there before touching production.

Is there a Docker image?

Yes. The project publishes a librebooking/librebooking image and a separate repository with a Compose setup, and its installation guide recommends Docker for new installations. It is the easier route if you do not want to manage PHP module streams and SELinux yourself.

Can I use Nginx instead of Apache?

It may work with equivalent rewrite rules, but the project states that web servers other than Apache are not supported or tested, so you are on your own if something breaks.

Share story:

Continue reading other guides on How VPS.