System installation on Ubuntu 16.04 (Xenial Xerus)

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

Note

Please perform the following commands as root.

System installation

MySQL 5.7

$ apt install mysql-server

PHP 7.1

The easiest way to install PHP 7.1 is to use Ond?ej Sur? packages.

First, install the repository:

$ add-apt-repository ppa:ondrej/php
$ apt update

Then, install PHP and the required extensions:

$ apt install php7.1-apcu php7.1-bcmath php7.1-cli php7.1-curl php7.1-fpm php7.1-gd php7.1-intl php7.1-mcrypt php7.1-mysql php7.1-soap php7.1-xml php7.1-zip

For Enterprise Edition, please also install:

$ apt install php7.1-imagick

Elasticsearch 5.5+

The easiest way to install Elasticsearch 5.5+ is to use the official vendor package:

  • first install the PGP key
  • then install the package via the official repository
$ apt install apt-transport-https
$ wget -O - https://artifacts.elastic.co/GPG-KEY-elasticsearch | apt-key add -
$ echo "deb https://artifacts.elastic.co/packages/5.x/apt stable main" | tee -a /etc/apt/sources.list.d/elastic-5.x.list
$ apt update
$ apt install openjdk-8-jre-headless
$ apt install elasticsearch

Apache

$ apt install apache2
$ a2enmod rewrite proxy_fcgi
$ systemctl restart apache2

Note

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> GRANT ALL PRIVILEGES ON akeneo_pim.* TO akeneo_pim@localhost IDENTIFIED BY 'akeneo_pim';
mysql> EXIT

PHP

  • Setup CLI php.ini file /etc/php/7.1/cli/php.ini
$ sudo vim /etc/php/7.1/cli/php.ini
memory_limit = 1024M
date.timezone = Etc/UTC

Note

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

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

Note

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/7.1/fpm/php.ini
memory_limit = 512M
date.timezone = Etc/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.

Warning

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 php7.1-fpm stop
  • Open the file /etc/php/7.1/fpm/pool.d/www.conf with your favorite text editor:
$ sudo vi /etc/php/7.1/fpm/pool.d/www.conf
# replace these environment variables:
user = my_user
group = my_group
listen = /run/php/php7.1-fpm.sock
listen.user = www-data
listen.group = www-data

Note

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

  • Restart FPM
$ sudo systemctl restart php7.1-fpm

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<VirtualHost *:80>
    ServerName akeneo-pim.local

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

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

    <Directory /path/to/installation/pim-community-standard>
        Options FollowSymlinks
    </Directory>

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

    <FilesMatch \.php$>
        SetHandler "proxy:unix:/run/php/php7.1-fpm.sock|fcgi://localhost/"
    </FilesMatch>

    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>

Note

  • 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/php7.1-fpm.sock is the default socket path. If you changed it in /etc/php/7.1/fpm/pool.d/www.conf, change it in the virtual host too.
  • Don’t forget to add the web directory of your Symfony application.

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 systemctl reload apache2

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

$ curl -sL https://deb.nodesource.com/setup_8.x | -E bash -
$ apt-get install -y nodejs

Yarn

$ curl -sS 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-get update && apt-get install yarn