Installing Textpattern CMS on FreeBSD 13.0

Textpattern CMS is a free, open-source content management system (CMS) designed using PHP. It is known for its speed, security, and minimalistic approach, ensuring an efficient user experience. Notable features include multi-language support, plugin extendability, built-in features, and a template system based on tags.

This guide details how to set up Textpattern CMS on a FreeBSD 13.0 server.

Requirements

Complete the following initial setup steps:

  • Launch a FreeBSD 13.0 server as a custom image using the Installation Handbook 
  • Connect to your server via SSH.
  • Set up a non-root user with sudo privileges.

Step 1: Installing Essential Packages

Begin by updating the system package repository:

freebsd-update fetch install

pkg update

Install the necessary tools and utilities:

pkg install -y sudo nano unzip wget bash

Install PHP 7.4 and required extensions:

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-simplexml

Enable and start the PHP-FPM service:

sudo sysrc php_fpm_enable=yes

sudo service php-fpm start

Copy the default PHP configuration to the appropriate location:

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

Step 2: Setting Up the Textpattern Database

Configure MySQL to start on boot and initialize the service:

sudo sysrc mysql_enable="yes"

sudo service mysql-server start

Access the MySQL shell (press Enter if prompted for a password):

Set a secure password for the root user. Replace MySecurePassword with your chosen strong password:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySecurePassword';

Create the textpattern database:

CREATE DATABASE textpattern;

Establish a new MySQL user textpatternuser and assign a password. Replace SecurePassword accordingly:

CREATE USER 'textpatternuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SecurePassword';

Grant the user full privileges on the textpattern database:

GRANT ALL ON textpattern.* TO 'textpatternuser'@'localhost' WITH GRANT OPTION;

Apply the permission changes:

Exit the MySQL command-line interface:

Step 3: Installing Textpattern CMS

Begin by downloading the latest version of Textpattern CMS from the official site:

wget https://textpattern.com/file_download/118/textpattern-4.8.8.zip

Extract the contents of the downloaded ZIP archive:

sudo unzip textpattern-4.8.8.zip

Remove the original zip file:

sudo rm textpattern-4.8.8.zip

Create the installation directory for Textpattern:

sudo mkdir -p /usr/local/www/apache24/data/textpattern

Move the extracted files into the new directory:

sudo mv textpattern-4.8.8/* /usr/local/www/apache24/data/textpattern

Set the correct ownership for the directory:

sudo chown -R www:www /usr/local/www/apache24/data/textpattern

Adjust the directory permissions:

sudo chmod -R 755 /usr/local/www/apache24/data/textpattern

Step 4: Configuring Apache2 for Textpattern

Enable Apache to automatically start when the system boots:

sudo sysrc apache24_enable=yes

Start the Apache service:

sudo service apache24 start

Create a configuration file to enable PHP processing in Apache:

sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.conf

Insert the following code and save the file:

    DirectoryIndex index.php index.html
    <filesmatch "\.php$"="">
        SetHandler application/x-httpd-php
    
    <filesmatch "\.phps$"="">
        SetHandler application/x-httpd-php-source
    

Create a virtual host configuration file for Textpattern:

sudo nano /usr/local/etc/apache24/Includes/textpattern.conf

Add the following settings to the file and save it:

    ServerAdmin admin@example.com
    DocumentRoot /usr/local/www/apache24/data/textpattern
    ServerName example.com

    
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    


Verify the Apache configuration syntax:

Restart Apache to apply the new configuration:

sudo service apache24 restart

Step 5: Finalizing Textpattern Installation

To launch the web-based setup, open your browser and go to:

http://Server_IP/textpattern/setup/

For example:

http://192.0.2.11/textpattern/setup/

Proceed with the database setup by entering the credentials used during the database creation process.

Once provided, a code snippet will appear. Copy and paste it into a file named config.php using the following command:

sudo nano /usr/local/www/apache24/data/textpattern/textpattern/config.php

Insert the generated configuration code, similar to:

<?php
    $txpcfg['db'] = 'textpattern';
    $txpcfg['user'] = 'textpatternuser';
    $txpcfg['pass'] = 'SecurePassword';
    $txpcfg['host'] = 'localhost';
    $txpcfg['table_prefix'] = '';
    $txpcfg['txpath'] = '/usr/local/www/apache24/data/textpattern/textpattern';
    $txpcfg['dbcharset'] = 'utf8mb4';
    // For more customization options, please consult config-dist.php file.
?>

Complete the installation by creating an admin account and finalizing any remaining settings. Then, remove the setup directory to enhance security:

sudo rm -rf /usr/local/www/apache24/data/textpattern/textpattern/setup/

Conclusion

You’ve successfully installed Textpattern CMS on a FreeBSD 13.0 server. For further customization and usage, consult the official documentation.

Source: vultr.com

Create a Free Account

Register now and get access to our Cloud Services.

Posts you might be interested in:

Moderne Hosting Services mit Cloud Server, Managed Server und skalierbarem Cloud Hosting für professionelle IT-Infrastrukturen

Deploy Jenkins with Docker Compose on Ubuntu

Docker, Tutorial
Installing Jenkins on a Ubuntu Server Using Docker Compose Jenkins, a widely used open-source application developed in Java, is ideal for creating continuous integration and continuous deployment (CI/CD) pipelines, accelerating…