Install Akeneo PIM

#System installation on Ubuntu 22.04 (Jammy Jellyfish)

Here is a quick guide to set up the System Requirements on Ubuntu 22.04. This guide will help you to install all the packages and modules needed for Akeneo PIM on a freshly installed Ubuntu 22.04 system and then configure the application to match your local installation.

Please perform the following commands as root.

#System installation

#MySQL 8.0

The easiest way to install MySQL 8.0 is to use the official vendor APT repository.

Follow the official documentation: https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/.

Download the bundle package for the required version:

$ wget https://dev.mysql.com/get/mysql-apt-config_0.8.24-1_all.deb
$ sudo dpkg -i mysql-apt-config_0.8.24-1_all.deb

And follow the aforementioned documentation.

When installing MySQL 8.0, you’ll have to choose the authentication method. Please select Use Legacy Authentication Method as the Strong Password Encryption is not yet supported by Akeneo PIM.

#PHP 8.1

As Ubuntu 22.04 only provides PHP 7.4, we need to use Ondrej Sury packages to install PHP 8.1..

First, install the repository:

$ apt-get install software-properties-common
$ add-apt-repository ppa:ondrej/php
$ apt update

If you get an error it may be because of non-UTF-8 locales, try

$ LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
$ apt update

Then, install PHP and the required extensions:

$ apt-get install php8.1-cli php8.1-apcu php8.1-bcmath php8.1-curl php8.1-opcache php8.1-fpm php8.1-gd php8.1-intl php8.1-mysql php8.1-xml php8.1-zip php8.1-mbstring php8.1-imagick

#Composer v2

You can install Composer by following the online documentation: https://getcomposer.org/download/

#Elasticsearch 8.4

Follow the official Elasticsearch documentation: official vendor package:

  • first install the PGP key

  • then install the package via the official repository

$ apt-get install apt-transport-https
$ wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
$ echo "deb https://artifacts.elastic.co/packages/8.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-8.x.list
$ apt update && apt-get install elasticsearch
$ service elasticsearch start

You will probably need to increase the MAX_MAP_COUNT Linux kernel setting. Proceed as follow (first command will affect your current session, second one every boot of your machine):

$ sysctl -w vm.max_map_count=262144
$ echo "vm.max_map_count=262144" | tee /etc/sysctl.d/elasticsearch.conf
$ service elasticsearch restart

#Apache

$ apt-get install apache2
$ a2enmod rewrite proxy_fcgi
$ service apache2 restart

If you migrate from Apache with mod_php, don’t forget to deactivate it by running the following commands

$ a2dismod php5

#System configuration

You now have a system with the right versions of Apache, PHP, MySQL and Elasticsearch. The next step is to configure them to be able to run an Akeneo PIM instance.

#MySQL

  • Create a dedicated MySQL database and a dedicated user (called akeneo_pim) for the application

$ mysql -u root -p
mysql> CREATE DATABASE akeneo_pim;
mysql> CREATE USER akeneo_pim@localhost IDENTIFIED WITH mysql_native_password BY 'akeneo_pim';
mysql> GRANT ALL PRIVILEGES ON akeneo_pim.* TO akeneo_pim@localhost;
mysql> EXIT

#PHP

  • Setup CLI php.ini file /etc/php/8.1/cli/php.ini

$ sudo vim /etc/php/8.1/cli/php.ini
memory_limit = 1024M
date.timezone = UTC

Use the time zone matching your location, for example America/Los_Angeles or Europe/Berlin. See https://www.php.net/timezones for the list of all available timezones.

  • Setup FPM php.ini file /etc/php/8.1/fpm/php.ini

If you have several PHP versions on your server, these files can be located in /etc/php/x.x/fpm/php.ini and /etc/php/x.x/cli/php.ini.

$ sudo vim /etc/php/8.1/fpm/php.ini
memory_limit = 512M
date.timezone = UTC

To avoid spending too much time on permission problems between the CLI user and the FPM user, a good practice is to use the same user for both of them.

This configuration is aimed to easily set up a development machine. It is absolutely not suited for a production environment.

  • Get your identifiers

$ id
uid=1000(my_user), gid=1000(my_group), ...

In this example, the user is my_user and the group is my_group.

  • Stop FPM

$ sudo service php8.1-fpm stop
  • Open the file /etc/php/8.1/fpm/pool.d/www.conf with your favorite text editor:

$ sudo vi /etc/php/8.1/fpm/pool.d/www.conf
# replace these environment variables:
user = my_user
group = my_group
listen = /run/php/php8.1-fpm.sock
listen.owner = www-data
listen.group = www-data

On the default installation, FPM user and group are www-data. listen.owner and listen.group must be set on the same user than your Apache server. /run/php/php8.1-fpm.sock is the default socket path. If you changed it in /etc/php/8.1/fpm/pool.d/www.conf, change it in the Apache virtual host too.

  • Restart FPM

$ sudo service php8.1-fpm restart

#Elasticsearch

Depending on the volume of data, it can be interesting to tweak the amount of memory usable by the JVM, as recommended by the official documentation. Usually, this configuration lies in the file /etc/elasticsearch/jvm.options.

#Apache

#Creating the virtual host file

The next step is to create a virtual host for Apache to point to the installation folder of the Akeneo PIM. First, create the file /etc/apache2/sites-available/akeneo-pim.local.conf

<VirtualHost *:80>
    ServerName akeneo-pim.local

    DocumentRoot /path/to/installation/pim-community-standard/public
    <Directory /path/to/installation/pim-community-standard/public>
        AllowOverride None
        Require all granted

        Options -MultiViews
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule ^(.*)$ index.php [QSA,L]
    </Directory>

    <Directory /path/to/installation/pim-community-standard/public/bundles>
        RewriteEngine Off
    </Directory>

    <Location "/index.php">
        SetHandler "proxy:unix:/run/php/php8.1-fpm.sock|fcgi://localhost/"
    </Location>

    SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0

    ErrorLog ${APACHE_LOG_DIR}/akeneo-pim_error.log
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/akeneo-pim_access.log combined
</VirtualHost>
  • Replace /path/to/installation by the path to the directory where you want to install the PIM.

  • Replace pim-community-standard by pim-enterprise-standard for enterprise edition.

  • /run/php/php8.1-fpm.sock is the default socket path. If you changed it in /etc/php/8.1/fpm/pool.d/www.conf, change it in the virtual host too.

#Enabling the virtual host

The Apache configuration is done, you need to enable it:

$ sudo apache2ctl configtest
# This will return 'Syntax OK'

$ sudo a2ensite akeneo-pim.local
$ sudo service apache2 reload

#Adding the virtual host name

The last step is to edit the file /etc/hosts and add the following line:

127.0.0.1    akeneo-pim.local

#Node 18

$ apt-get install curl
$ curl -sL https://deb.nodesource.com/setup_18.x -o nodesource_setup.sh
$ bash nodesource_setup.sh
$ apt-get install -y nodejs

To check which version of Node.js you have installed after these initial steps, type:

$ node -v

#Yarn

$ curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
$ echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
$ apt update && apt-get install yarn

To check which version of YARN you have installed after these initial steps, type:

$ yarn -v

Found a typo or a hole in the documentation and feel like contributing?
Join us on Github!