Introduction
Textpattern CMS is a free, lightweight, and open-source Content Management System (CMS) based on PHP. With a fast, secure, and simple design for a good user experience. Some features include multi-language support, functionality extensible via plugins, built-in support, and tag-based template language.
This article explains how to install Textpattern CMS on FreeBSD 13.0 server.
Prerequisites
Perform the following steps first:
- Deploy a Rcs FreeBSD 13.0 Server.
- SSH into the server you deployed.
- Create a non-root user with sudo access.
Step 1. Install Required Packages
Update the system package list.
$ freebsd-update fetch install
$ pkg updateInstall required packages.
$ pkg install -y sudo nano unzip wget bashInstall 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-simplexmlEnable PHP-FPM service.
$ sudo sysrc php_fpm_enable=yesStart PHP-FPM service.
$ sudo service php-fpm startCopy the sample PHP configuration file.
$ sudo cp /usr/local/etc/php.ini-production /usr/local/etc/php.iniStep 2. Create Textpattern CMS Database
Enable MySQL service to start on system boot.
$ sudo sysrc mysql_enable="yes"Start MySQL service.
$ sudo service mysql-server startLog in to MySQL shell. Then, at the password prompt, just press Enter to continue.
$ sudo mysql -u root -pSecure the MySQL root user by changing the password. Change the value of MySecurePassword with your own secure password.
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MySecurePassword';Create a database called textpattern.
CREATE DATABASE textpattern;Create a database user called textpatternuser with a password SecurePassword. Change the value of SecurePassword with your own secure password.
CREATE USER 'textpatternuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'SecurePassword';Grant the user full access to the database.
GRANT ALL ON textpattern.* TO 'textpatternuser'@'localhost' WITH GRANT OPTION;Save the changes made to the database.
FLUSH PRIVILEGES;Exit MySQL shell.
exit;Step 3. Install Textpattern CMS
Download the latest version of Textpattern CMS. Get the latest version from the official download page.
$ wget https://textpattern.com/file_download/118/textpattern-4.8.8.zipUnzip the downloaded files.
$ sudo unzip textpattern-4.8.8.zipDelete the downloaded zip files.
$ sudo rm textpattern-4.8.8.zipCrate the installation directory /usr/local/www/apache24/data/textpattern.
$ sudo mkdir -p /usr/local/www/apache24/data/textpatternMove the extracted files into the installation directory.
$ sudo mv textpattern-4.8.8/* /usr/local/www/apache24/data/textpatternChange ownership of the installation directory.
$ sudo chown -R www:www /usr/local/www/apache24/data/textpatternChange access permissions for the directory.
$ sudo chmod -R 755 /usr/local/www/apache24/data/textpatternStep 4. Configure Apache2
Enable Apache service to start on system boot.
$ sudo sysrc apache24_enable=yesStart Apache service.
$ sudo service apache24 startCreate a configuration file to allow Apache to work with PHP.
$ sudo nano /usr/local/etc/apache24/modules.d/001_mod-php.confAdd the following lines of code to the file. Save and close 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>Create Apache configuration file for Textpattern CMS named textpattern.conf.
$ sudo nano /usr/local/etc/apache24/Includes/textpattern.confAdd the below code to the file. Save and close the file.
<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /usr/local/www/apache24/data/textpattern
ServerName example.com
<Directory /usr/local/www/apache24/data/textpattern/>
Options -Indexes +FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>Test the configuration.
$ sudo apachectl configtestRestart Apache service.
$ sudo service apache24 restartStep 5. Access Textpattern CMS
To access the Textpattern CMS Web Interface, go to your browser and visit http://Server_IP/textpattern/setup/. For example:
http://192.0.2.11/textpattern/setup/Access the installation page, and follow the database configuration process by entering the database connection credentials you used to set up the database.
Copy the code and paste it into the new configuration file on the next page. Create a new file config.php.
$ sudo nano /usr/local/www/apache24/data/textpattern/textpattern/config.phpAdd the code to the file. Save and close the file:
<?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.
?>Continue by creating an administrator account and other configurations. After installation is complete, delete the setup directory.
$ sudo rm -rf /usr/local/www/apache24/data/textpattern/textpattern/setup/Conclusion
You have installed Textpattern CMS on your FreeBSD 13.0 server. You can now check the official documentation to learn more on how to use Textpattern CMS.