How to Install PIMCore on FreeBSD 13

Updated on February 25, 2022
How to Install PIMCore on FreeBSD 13 header image

Introduction

PIMCore is an open-source, web-based digital content management platform. It's used by enterprise businesses for Product Information Management (PIM), Master Data Management (MDM), Digital Asset Management (DAM), Digital Commerce Platform, and Content Management System. It's fast, flexible, and user-friendly with custom plugins for advanced functionality. This article explains how to install PIMCore on FreeBSD 13.0 server.

Prerequisites

Perform the following steps first:

Step 1. Install Required Packages

Update the system package list.

$ pkg update

Install required packages.

$ pkg install -y sudo nano unzip wget bash

Install PHP 8.0, Apache, MySQL, and more modules.

 $ sudo pkg install -y apache24 mysql80-server mod_php80 php80 php80-session php80-curl php80-xml php80-zip php80-mbstring php80-ctype php80-imap php80-simplexml php80-tokenizer php80-xmlreader php80-xmlwriter php80-pear php80-fileinfo php80-phar php80-exif php80-iconv php80-mysqli php80-pdo_mysql php80-dom php80-filter php80-intl php80-openssl php80-intl php80-opcache php80-gd

Enable PHP-FPM service.

$ sudo sysrc php_fpm_enable=yes

Start PHP-FPM service.

$ sudo service php-fpm start

Copy the sample PHP configuration file.

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

Step 2. Create PIMCore Database

Enable MySQL service to start on system boot.

$ sudo sysrc mysql_enable="yes"

Start MySQL service.

$ sudo service mysql-server start

Log in to MySQL shell. On password prompt, just press Enter to continue.

$ sudo mysql -u root -p

Secure the MySQL root user by changing the password. Change the value of StrongPassword with your own secure password.

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

Create a database named pimcore.

CREATE DATABASE pimcore charset=utf8mb4;

Create a database user pimcoreuser with a password MySecurePassword. Change the value of MySecurePassword to your own secure password.

CREATE USER 'pimcoreuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'MySecurePassword';

Grant the database user full access to the database.

GRANT ALL ON pimcore.* TO 'pimcoreuser'@'localhost' WITH GRANT OPTION;

Save all the changes to take effect.

FLUSH PRIVILEGES;

Exit MySQL shell.

exit;

Step 3. Install PIMCore

Install required dependencies.

$ sudo pkg install -y curl git

Download Composer installer.

$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

Verify the installer.

$ php -r "if (hash_file('sha384', 'composer-setup.php') === '906a84df04cea2aa72f40b5f787e49f22d4c2f19492ac310e8cba5b96ac8b64115ac402c8cd292b8a03482574915d1a8') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

Run the installer.

$ php composer-setup.php

Remove the installer.

$ php -r "unlink('composer-setup.php');"

Make Composer global by moving composer.phar to the system path.

$ sudo mv composer.phar /usr/local/bin/composer

Verify Composer version.

$ composer -V

Change to document root.

$ cd /usr/local/www/apache24/data/

Set up the project using composer.

$ sudo COMPOSER_MEMORY_LIMIT=-1 composer create-project pimcore/skeleton pimcore

Change to the installation directory.

$ cd /usr/local/www/apache24/data/pimcore

Run the installer to create an administrator account, and enter your database credentials.

$ sudo ./vendor/bin/pimcore-install

Set the ownership of the directory to the web-root user and group.

$ sudo chown -R www:www /usr/local/www/apache24/data/pimcore/

Change the access permissions.

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

Step 4. Configure Apache2

Enable Apache service to start on system boot.

$ sudo sysrc apache24_enable=yes

Start Apache service.

$ sudo service apache24 start

Create a configuration file to allow Apache to work with PHP.

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

Add 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 pimcore.conf for PIMCore.

$ sudo nano /usr/local/etc/apache24/Includes/pimcore.conf

Add the bellow code to the file. Save and close the file.

<VirtualHost *:80>

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

    <Directory /usr/local/www/apache24/data/pimcore/public/>
        Options -Indexes +FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

</VirtualHost>

Test the configuration.

$ sudo apachectl configtest

Enable mod_rewrite by editing the apache configuration file.

$ sudo nano /usr/local/etc/apache24/httpd.conf

Uncomment the following line. Save and close the file:

LoadModule rewrite_module libexec/apache24/mod_rewrite.so

Restart Apache service.

$ sudo service apache24 restart

Step 5. Access PIMCore

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

http://192.0.2.10/admin/

Conclusion

You have installed PIMCore on your FreeBSD 13.0 server. You can now check the official documentation to learn more on how to use PIMCore.