Installing SAP Hybris

  Written by The Jahia Team
   Estimated reading time:

You must modify your /etc/hosts file to declare the domain name used by the default installation of Hybris.

To declare the default Hybris domain name:

  1. In a terminal window, enter the following command to enable editing of the /etc/hosts file.
    sudo vi /etc/hosts
  2. Then add the following command.
    127.0.0.1 apparel-uk.local apparel-de.local electronics.local
  3. Save the file, close vi and continue the installation.

Installing Hybris 

To install Hybris:

  1. Unzip the HYBRISCOMM6500P_0-80003045.zip file that you download earlier into a specific directory to be used for Hybris server. Enter the following commands.
    mkdir hybris_65
    cd hybris_65
    unzip (path_to)/HYBRISCOMM6500P_0-80003045.zip
    The following directories display.
    ls
    .
    ├── README
    ├── build-tools
    ├── c4c-integration
    ├── hybris
    ├── hybris-Mobile-Apps-SDK
    ├── hybris-ems
    ├── hybris-sbg
    ├── idea-module-files
    ├── installer
    └── licenses
    
  2. Navigate to the installer folder.
    cd installer
  3. Verify that your JAVA_HOME environment property is correctly setup for an Oracle JVM. OpenJDK is not supported by SAP Hybris.
     echo $JAVA_HOME
  4. Enter java -version to display your current java version.
    java -version
    java version "1.8.0_151"
    Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
    Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
  5. Next, run SAP Hybris.
    ./install.sh -r b2c_acc_plus
  6. Navigate to the hybris/bin folder and enter the following commands.
    cd ../hybris/bin
    mkdir custom
    cd custom
    mkdir cio
    cd cio
    git clone git@github.com:Jahia/hybris-cio-storefront.git .
    The clone command should create a structure similar to the following:
    .
    ├── ciocockpits
    ├── ciocore
    ├── ciofacades
    ├── ciofulfilmentprocess
    ├── cioinitialdata
    ├── ciostorefront
    └── ciotest
    
  7. Edit the localextensions.xml file to declare Commerce I/O extensions. Navigate to the hybris/config directory.
    cd ../../../config
    pwd
    /hybris_install/hybris/config
    ls
    backup languages local.properties readme.txt
    tomcat
    customize licence localextensions.xml tcServer
  8. In the localextensions.xml file, comment out the yaccelerator extensions and add your custom extensions.
    vi localextensions.xml
    <!--extension name='yacceleratorcockpits' />
       <extension name='yacceleratorinitialdata' />
       <extension name='yacceleratorfulfilmentprocess' />
       <extension name='yacceleratorstorefront' /
    -->
    <!-- Please add next extensions -->
       <extension dir="{hybris_path}/bin/custom/cio/ciofulfilmentprocess"/>
       <extension dir="{hybris_path}/bin/custom/cio/ciocockpits"/>
       <extension dir="{hybris_path}/bin/custom/cio/ciocore"/>
       <extension dir="{hybris_path}/bin/custom/cio/ciofacades"/>
       <extension dir="{hybris_path}/bin/custom/cio/ciotest"/>
       <extension dir="{hybris_path}/bin/custom/cio/cioinitialdata"/>
       <extension dir="{hybris_path}/bin/custom/cio/ciostorefront"/>
    
  9. Navigate to the hybris/bin/platform directory and initialize the Hybris server.
    ⇒  cd ../../hybris/bin/platform/
    ⇒  pwd
    /hybris_install/hybris/bin/platform
    ⇒  . ./setantenv.sh
    ⇒  ant initialize
    The commerce server initializes.
        [java] INFO  [AfterSaveEventPublisher-master] [DefaultAfterSaveListenerRegistry] AfterSaveEventPublisher-master has been interrupted/terminated but without InterruptedException - stopping now.
        [java] INFO  [main] [DefaultCacheController] Removed listener from cache controller. Currently registered 1
        [java] INFO  [main] [DefaultSolrServerService] Stopping Solr servers ...
        [java] INFO  [main] [DefaultSolrServerService] Stopping Solr server for instance [name: default, hostname: localhost, port: 8983]
        [java] INFO  [main] [DefaultClusterNodeManagementService] Unregistering assigned cluster node id 0...
        [java] shutting down hybris registry..
    
    BUILD SUCCESSFUL
    Total time: 33 minutes 20 seconds
  10. Next, start your server.
    Note: If you have a new session, ensure that you run the following command: . ./setantenv.sh
    ./hybrisserver.sh
    Running hybrisPlatform on Tomcat...
    --> Wrapper Started as Console
    Java Service Wrapper Professional Edition 64-bit 3.5.29
      Copyright (C) 1999-2016 Tanuki Software, Ltd. All Rights Reserved.
        http://wrapper.tanukisoftware.com
      Licensed to SAP SE for hybris Platform
                      |
                      |
                      |
    Sep 27, 2017 4:00:57 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-9001"]
    Sep 27, 2017 4:00:57 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-bio-9002"]
    Sep 27, 2017 4:00:57 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-bio-8009"]
    Sep 27, 2017 4:00:57 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 348475 ms (~35 mins)
  11. Validate the installation by testing the OAUTH connection using the following curl command.
    curl -X POST \
    https://localhost:9002/authorizationserver/oauth/token \
    -H 'cache-control: no-cache' \
    -H 'content-type: application/x-www-form-urlencoded' \
    -k \
    -d
    'client_id=dxstore&client_secret=jahia4ever&grant_type=client_credentials'
    {"access_token":"6130a882-f1e1-4374-ae49-0e9a95

Verifying deployment of the coistorefront extension

Next verify that the coistorefront extension was successfully deployed.

To verify deployment of the coistorefront extension:

  1. Log into SAP Hybris using the following URL and credentials.
  2. Confirm that Product Cockpit is available from the Administration menu.
    product cockpit
  3. Select Product Cockpit. An orange bar indicates that you must index the catalog.
  4. Click here to start indexing the catalog, as shown in the following image.
    index products

When indexing completes, products in the catalog display in a list. You have successfully installed the ciostorefront extension.

ciostore

Optional configuration for a SAP Hybris installation on a distant server

Updating the domain name of your storefront

  1. Navigate to your Hybris install folder.
  2. Modify the local.properties file.
    ⇒ cd config
    ⇒ vi local.properties
  3. Change the default DNS to your actual DNS. In the following example, the DNS is: apparel-uk.dev.com.
    website.apparel-uk.http=http://apparel-uk.dev.com:9001/ciostorefront
    website.apparel-uk.https=https://apparel-uk.dev.com:9002/ciostorefront
    //&&
    media.apparel-uk.http=http://apparel-uk.dev.com:9001
    media.apparel-uk.https=https://apparel-uk.dev.com:9002
Attention: If your domain does not match the default patterns (apparel-uk.* or apparel.uk.*) you must add a new pattern in Hybris.

To add a new pattern:

  1. Update URL patterns to match the domain. Go to https://demo.commerceio.jahia.com/admincockpit/index.zul and replace the domain with your domain.

    admincockpit

  2. Navigate to Basesite>Website and select Apparel Site UK.
    The side panel opens.
  3. Locate the URL Patterns settings. By default, three patterns are specified.
  4. Add this value in the patterns:`(?i)^https?://demo.commerceio.jahia.com[^/]+(|/.*|\?.*)$` and click on the plus (+) sign.
Note: Do not copy the apostrophe characters (`) from the pattern.

Modifying hosts file on servers

/etc/hosts on Hybris

127.0.0.1 <yourdomain>

And ESIGate server put in /etc/hosts

[hybris-server-IP] <yourdomain>

Copying Hybris keystore to servers

To run on multiple servers, they need to use same SSL  keystore to avoid cross domain security issues. The easiest solution is to copy “HYBRIS_INSTALL_PATH/hybris/bin/platform/tomcat/lib/keystore” on all the servers you need, update DX and ESIGATE configuration files to reflect the new path of the keystore.

Note: This keystore is not intended for a production environment. A production environment requires a signed keystore. On demo.commerceio.jahia.com we are using letsencrypt under the recommendation of our IT department.