Skip to main content
Version: Next

Advanced Installation Topics

To fully automate the installation process, options can be passed in the CLI as parameters, rather than adding them interactively.

For Docker installation:
docker compose exec php vendor/bin/pimcore-install --admin-username=admin --admin-password=admin \
--mysql-username=username --mysql-password=password --mysql-database=pimcore \
--mysql-host-socket=127.0.0.1 --mysql-port=3306 \
--no-interaction
For webserver installation:
./vendor/bin/pimcore-install --admin-username=admin --admin-password=admin \
--mysql-username=username --mysql-password=password --mysql-database=pimcore \
--mysql-host-socket=127.0.0.1 --mysql-port=3306 \
--no-interaction
info

The --no-interaction flag will prevent any interactive prompts.

To avoid having to pass sensitive data (e.g. DB password) as command line option, you can also set each parameter as env variable. See ./vendor/bin/pimcore-install for details. Example:

$ PIMCORE_INSTALL_MYSQL_USERNAME=username PIMCORE_INSTALL_MYSQL_PASSWORD=password ./vendor/bin/pimcore-install \
--admin-username=admin --admin-password=admin \
--mysql-database=pimcore \
--no-interaction

Installing Bundles

Overview of Bundle Lists

When installing, you will interact with two lists of bundles: Recommended Bundles and Required Bundles.

  • Recommended Bundles:

    • Displayed to users during interactive mode.
    • These are the bundles users can specify when using the --install-bundles=commaSeparatedBundleList option.
  • Required Bundles:

    • These bundles will automatically be installed in interactive mode, if the user choses to install bundles.
    • They are installed whenever the --install-bundles option is set.

By default, here's what's included in the Recommended Bundles list:

Automating Bundle Installation

To install specific bundles automatically, use the --install-bundles[=bundleList] flag. This flag installs and activates all required bundles and any specified bundles, provided they are part of the recommended bundles list.

Note: The bundles will be automatically added to config/bundles.php.

./vendor/bin/pimcore-install --admin-username=admin --admin-password=admin \
--mysql-username=username --mysql-password=password --mysql-database=pimcore \
--mysql-host-socket=127.0.0.1 --mysql-port=3306 \
--install-bundles=PimcoreApplicationLoggerBundle,PimcoreCustomReportsBundle \
--no-interaction

Modifying Required Bundles and Bundle Recommendations

The BundleSetupEvent is triggered under two circumstances:

  1. To preset the installable (recommended) and automatically installed (required) bundles for the --install-bundles option.
  2. To modify a list of recommended bundles in interactive mode. Required bundles are not installed if the user declines to install bundles.

By subscribing or listening to the BundleSetupEvent, you can add or remove bundles from the required or recommended lists.

For practical examples, refer to the Pimcore Skeleton. It shows how the Admin UI Classic Bundle is integrated.

<?php

namespace App\EventSubscriber;

use Pimcore\Bundle\AdminBundle\PimcoreAdminBundle;
use Pimcore\Bundle\InstallBundle\Event\BundleSetupEvent;
use Pimcore\Bundle\InstallBundle\Event\InstallEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

class BundleSetupSubscriber implements EventSubscriberInterface
{
public static function getSubscribedEvents(): array
{
return [
InstallEvents::EVENT_BUNDLE_SETUP => [
['bundleSetup'],
],
];
}

public function bundleSetup(BundleSetupEvent $event): void
{
// make bundle installable (using --install-bundles) and recommend it in interactive installation
$event->addInstallableBundle('PimcoreAdminBundle', PimcoreAdminBundle::class, true);

// add required bundle
$event->addRequiredBundle('PimcoreAdminBundle', PimcoreAdminBundle::class);
}
}

Make sure to register your listener/subscriber under config/installer.yaml as described in Preconfiguring the Installer.

services:
# default configuration for services in *this* file
_defaults:
# automatically injects dependencies in your services
autowire: true
# automatically registers your services as commands, event subscribers, etc.
autoconfigure: true
# this means you cannot fetch services directly from the container via $container->get()
# if you need to do this, you can override this setting on individual services
public: false

# ---------------------------------------------------------
# Event Subscribers
# ---------------------------------------------------------
App\EventSubscriber\BundleSetupSubscriber: ~

Preconfiguring the Installer

You can preconfigure the values used by the installer by adding a config file which sets values for the database credentials. This is especially useful when installing Pimcore on platforms where credentials are available via env vars instead of having direct access to them. To preconfigure the installer, add a config file in config/installer.yaml (note: the file can be of any format supported by Symfony's config, so you could also use xml or php as the format), then configure the pimcore_install tree:

# config/installer.yaml

pimcore_install:
parameters:
database_credentials:
user: username
password: password
dbname: pimcore

# env variables can be directly read with the %env() syntax
# see https://symfony.com/blog/new-in-symfony-3-2-runtime-environment-variables
host: "%env(DB_HOST)%"
port: "%env(DB_PORT)%"

Set a Time Zone

Make sure to set the corresponding time zone in your configuration. It will be used for displaying date/time values in the admin backend.

pimcore:
general:
timezone: Europe/Berlin

Office Document Preview

The feature for displaying a preview of documents directly in Pimcore is optional. To use it, you must install either Gotenberg or LibreOffice according to your preference.