How to Install Backdrop CMS on FreeBSD 13.0

Updated on November 21, 2023
How to Install Backdrop CMS on FreeBSD 13.0 header image

Introduction

Backdrop is a free, open-source Content Management System (CMS) used by small and mid-sized businesses to publish and manage their online content. It enables users to create a variety of websites that are customize-able. It's based on Drupal CMS, and shares most of its features, with improvements. Some important features are:

  • Browse and install add-ons directly from your website.
  • Integrated security for granular access control.
  • A robust modifiable API to change functionality.
  • Configuration management interface to deploy changes to the production server.

This article explains how to install Backdrop CMS on FreeBSD 13.0 server.

Prerequisites

  • Deploy a Vultr FreeBSD 13.0 Server.
  • Create a non-root user with sudo access.
  • PHP version 5.3.29 or higher.
  • MySQL or MariaDB version 5.0.15 higher.
  • Apache (recommended), or Nginx.

1. Install Required Packages

  1. Update the system package list.

     $ pkg update
  2. Install the required packages.

     $ pkg install -y sudo nano unzip wget bash
  3. Install MySQL server, Apache, and PHP 7.4 and more modules.

     $ sudo pkg install -y apache24 mysql80-server php74 mod_php74 php74-curl php74-session php74-gd php74-json php74-mbstring php74-xmlrpc php74-gmp php74-curl php74-mysqli php74-intl php74-sqlite3 php74-xml php74-zip php74-zlib php74-pdo php74-pear php74-pdo_mysql php74-filter php74-mysqli php74-zip php74-imap php74-dom php74-simplexml
  4. Enable the PHP-FPM service.

     $ sudo sysrc php_fpm_enable=yes
  5. Start PHP-FPM service.

     $ sudo service php-fpm start
  6. Copy the sample PHP configuration file.

     $ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.ini

2. Install Backdrop CMS

  1. Download the latest version of the Backdrop CMS installation archive. To find the latest version, visit the release page.

     $ sudo wget https://github.com/backdrop/backdrop/releases/download/1.20.3/backdrop.zip
  2. Extract the downloaded file to your current directory.

     $ sudo unzip backdrop.zip
  3. Create an installation directory /usr/local/www/apache24/data/backdrop in the root of your web server.

     $ sudo mkdir -p /usr/local/www/apache24/data/backdrop
  4. Move all the files within the extracted directory into the installation folder.

     $ sudo mv backdrop/* /usr/local/www/apache24/data/backdrop
  5. Change ownership of the installation directory.

     $ sudo chown -R www:www /usr/local/www/apache24/data/backdrop
  6. Change access permissions for the directory.

     $ sudo chmod -R 755 /usr/local/www/apache24/data/backdrop

3. Create Backdrop CMS Database

  1. Enable the MySQL service to start on system boot.

     $ sudo sysrc mysql_enable="yes"
  2. Start the MySQL service.

     $ sudo service mysql-server start
  3. Run mysql_secure installation script to set up MySQL security.

     $ sudo mysql_secure_installation
  4. When prompted, answer the questions as shown below:

    • Setup VALIDATE PASSWORD plugin? Press N, then Enter.
    • Remove anonymous users? Press Y, then Enter.
    • Disallow root login remotely? Press Y, then Enter.
    • Remove test database and access to it? Press Y, then Enter.
    • Reload privilege tables now? Press Y, then Enter.
  5. Log in to MySQL shell. An the password prompt, enter the set password to continue.

     $ sudo mysql -u root -p
  6. Create a database called backdrop. You can change all the database descriptions with your preferred names.

     CREATE DATABASE backdrop;
  7. Create a database user with a strong password.

     CREATE USER 'backdropuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'ReplaceThisWithaStrongPassword';
  8. Grant the user full access to the database.

     GRANT ALL ON backdrop.* TO 'backdropuser'@'localhost' WITH GRANT OPTION;
  9. Save the changes made to the database.

     FLUSH PRIVILEGES;
  10. Exit MySQL shell.

     exit;

4. Configure Apache Server

  1. Enable Apache service to start on system boot.

     $ sudo sysrc apache24_enable=yes
  2. Start Apache service.

     $ sudo service apache24 start
  3. Create a configuration file to allow Apache to work with PHP.

     $ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf
  4. Add the following lines of code to the file.

     <IfModule dir_module>
         DirectoryIndex index.php index.html
         <FilesMatch "\.php$">
             SetHandler application/x-httpd-php
         </FilesMatch>
         <FilesMatch "\.phps$">
             SetHandler application/x-httpd-php-source
         </FilesMatch>
     </IfModule>
  5. Save and close the file. Cre1. ate Apache configuration file for Backdrop CMS named backdrop.conf.

     $ sudo nano /usr/local/etc/apache24/Includes/backdrop.conf
  6. Add the below code to the file.

     <VirtualHost *:80>
         ServerAdmin admin@example.com
         DocumentRoot /usr/local/www/apache24/data/backdrop
         ServerName example.com
         ServerAlias www.example.com
    
         <Directory /usr/local/www/apache24/data/backdrop/>
             Options FollowSymLinks
             AllowOverride All
             Require all granted
         </Directory>
    
     </VirtualHost>
  7. Save and close the file.

  8. Test the configuration.

     $ sudo apachectl configtest
  9. Restart Apache service.

     $ sudo service apache24 restart

5. Access Backdrop CMS Web Interface

To access the Backdrop CMS Web Interface, go to your browser and visit http://Server_IP/. For example:

http://192.0.2.10/

Conclusion

You have installed Backdrop CMS on your FreeBSD 13.0 server. Next, access the installation page and complete the process by connecting your database, creating an administrator account, and configuring your site.

More Information

To learn more about using Backdrop CMS, visit the official documentation.