System install on Ubuntu 16.04

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.

System installation

Base installation

  • Install apache, MySQL, then the dedicated modules for Akeneo PIM:
$ sudo apt-get install apache2
$ sudo a2enmod rewrite
$ sudo service apache2 restart

MySQL installation

Akeneo PIM supports MySQL from 5.1 to 5.6. Ubuntu 16.04 default MySQL version is MySQL 5.7. You have two possibilities:

  • Work with MySQL 5.6. You need to downgrade your version to MySQL 5.6.
  • Work with MySQL 5.7. MySQL 5.7 is not officialy supported but works in experimental mode if you disable the ONLY_FULL_GROUP_BY mode.

MySQL 5.6 (supported)

$ sudo apt-get install software-properties-common
$ sudo add-apt-repository -y ppa:ondrej/mysql-5.6
$ sudo apt-get install mysql-server-5.6

MySQL 5.7

$ sudo apt-get install mysql-server

PHP installation

Since Akeneo PIM 1.6, the minimal PHP version is PHP 5.6. Ubuntu 16.04 default PHP version is PHP 7.0. You have two possibilities:

  • Work with PHP 5.6 (supported). Actually, the only supported version of PHP for Akeneo PIM is 5.6. You need to downgrade your version to PHP 5.6.
  • Work with PHP 7 (experimental). You also can install Akeneo PIM with 7, in experimental mode and not supported.

PHP 5.6 (supported)

  • To downgrade to PHP 5.6, add this repository:
$ sudo add-apt-repository ppa:ondrej/php
  • Then, you have to add the universe source for Ubuntu 16.04, to be able to use mycrypt and mongodb:
$ sudo add-apt-repository "http://us.archive.ubuntu.com/ubuntu xenial main universe"
  • You can now install PHP 5.6 and the needed libraries:
$ sudo apt-get update
$ sudo apt-get remove php7*
$ sudo apt-get install php5.6
$ sudo apt-get install php5.6-xml php5.6-zip php5.6-curl php5.6-mongo php5.6-intl php5.6-mbstring php5.6-mysql php5.6-gd php5.6-mcrypt php5.6-cli php5.6-apcu libapache2-mod-php5.6
$ sudo phpenmod mcrypt
  • Check that PHP 5.6 is now your current PHP version with:
$ php -v

PHP 7 (experimental)

Warning

We continued our effort regarding PHP 7 support. PHP 7 is now usable in experimental mode for both CLI and Web. Experimental means that we manage to install and use the PIM but due to missing tests in our functional matrix we can’t commit to support it.

  • You only need to install PHP 7.0 and its needed libraries:
$ sudo apt-get update
$ sudo apt-get install php7.0
$ sudo apt-get install php7.0-xml php7.0-zip php7.0-curl php-mongodb php7.0-intl php7.0-mbstring php7.0-mysql php7.0-gd php7.0-mcrypt php7.0-cli php-apcu libapache2-mod-php7.0
$ sudo a2dismod mpm_event
$ sudo a2enmod mpm_prefork
$ sudo a2enmod php7.0
$ sudo phpenmod mcrypt
$ sudo service apache2 reload

Choosing the product storage

Depending on your data volume (number of products, number of attributes per product, number of basic, localized or scopable attributes, number of locales, number of scopes, etc.) you will have to choose a strategy to store your products, which will determine your database server configurations:

  • Full SQL database with MySQL. All your data will be stored in MySQL.
  • Hybrid SQL storage with MySQL and MongoDB. Your product related data will be stored in MongoDB. The other data will still remain in MySQL.

To make an educated choice you should try to find out how many product values your database will store. For example, for one product:

  • A simple attribute will generate only one product value
  • A localized attribute will generate as many product values as you have locales enabled
  • A scopable attribute will generate as many product values as you have channels
  • A localizable and scopable attribute will generate: (number of enabled locales * number of channels) product values

We consider that MySQL can store up to 5 million product values. Here is the complete formula to check if you have more product values than the recommended threshold that MySQL can manage alone:

N products * (
    N simple attributes
    + ( N localized attributes * N enabled locales )
    + ( N scopable attributes * N existing channels )
    + ( N scopable AND localizable attributes * N enabled locales * N existing channels )
) > 5 Million

Based on this formula, either you need a MongoDB Installation (optional), either you can directly go to the System configuration section.

MongoDB Installation (optional)

PHP 5.6 (supported)

  • Install MongoDB server and PHP driver

Note

Akeneo PIM will not work with MongoDB 3.*. The supported versions are 2.4 and 2.6.

$ sudo apt-get update
$ sudo apt-get install mongodb
$ sudo apt-get install php-mongo

PHP 7.0 (experimental)

You’ll have to install the new Mongo PHP extension and enable it:

$ sudo apt-get install php7.0-dev pkg-config
$ sudo pecl install mongodb
$ sudo phpenmod mongodb

Finally, you have to install the Mongo PHP adapter using the dependency manager composer:

$ composer require alcaeus/mongo-php-adapter --ignore-platform-reqs

System configuration

You now have a system with the right versions of Apache, PHP and MySQL. 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 Apache php.ini file /etc/php5/apache2/php.ini

Note

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

$ sudo vim /etc/php5/apache2/php.ini
memory_limit = 512M
date.timezone = Etc/UTC
  • Setup CLI php.ini file /etc/php5/cli/php.ini
$ sudo vim /etc/php5/cli/php.ini
memory_limit = 768M
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.

Apache

Setting up the permissions

To avoid spending too much time on permission problems between the CLI user and the Apache user, an good practice is to use the same user for 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 Apache
$ sudo service apache2 stop
  • Open this file /etc/apache2/envvars with your favorite text editor:
$ sudo vi /etc/apache2/envvars
# replace these environment variables:
export APACHE_RUN_USER=my_user
export APACHE_RUN_GROUP=my_group

$ sudo chown -R my_user /var/lock/apache2

Note

On the default installation, Apache run user and Apache run group are www-data. You have to replace these variables:

  • APACHE_RUN_USER=www-data by APACHE_RUN_USER=my_user
  • APACHE_RUN_GROUP=www-data by APACHE_RUN_GROUP=my_group
  • Restart Apache
$ sudo service apache2 start

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
<VirtualHost *:80>
    ServerName akeneo-pim.local

    DocumentRoot /path/to/installation/pim-community-standard/web/
    <Directory /path/to/installation/pim-community-standard/web/>
        AllowOverride All
        Require all granted
    </Directory>
    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.
  • 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 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