Is your company struggling with Hybris Commerce installations and deployments for your development, testing, and production environments?
This step-by-step tutorial will show you how to automate your Hybris Commerce installations, which will:
- Save your company time and money
- Eliminate installation and deployment mistakes
- Establish a consistent Hybris deployment process
In more technical terms, this article will demonstrate how to automate the installation of SAP Hybris 6.3 and its requisite software dependencies for Linux CentOS 7 with a Vagrant Up command. The information learned in this tutorial should provide a useful framework for Hybris installations and deployments.
This tutorial will work on both Windows and Mac machines. There are a few open source software products required to successfully complete this tutorial:
- Vagrant: https://www.vagrantup.com/downloads.html
- VirtualBox: https://www.virtualbox.org/wiki/Downloads
- Putty or Git Bash (Windows Users):
- Putty: https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
- Git Bash: https://git-scm.com/download/
- Mac Users: Built-in command prompt
You will also need the binaries for the SAP Hybris Commerce Suite, which is not an open source product. I’m using SAP Hybris Commerce Suite 6.3 for this tutorial. Only SAP Hybris Commerce customers and certified SAP Hybris partners have access to the SAP Hybris Software, https://wiki.hybris.com/display/downloads/Archived+6.3.0+Release
Once you have installed these software products on your machine, you are ready to fully automate your SAP Hybris deployment.
Open the command prompt. In my case, I’m using Git Bash.
1. Clone or download the HybrisArchitect.com Install-Hybris-With-Vagrant Github repository. Perform the following at the command prompt:
2. A new directory called Install-Hybris-With-Vagrant is created.
3. Change into the Install-Hybris-With-Vagrant directory by using the following change directory command at the command prompt:
4. Perform the following list directory command at the command prompt:
5. You should see the following files:
6. Copy the hybris-commerce-suite-184.108.40.206.zip file, Hybris Commerce Suite, into this directory.
7. Now it's time to install Hybris. Perform the following command at the command prompt:
8. 15-20 minutes later, you should see the following in your command prompt screen:
9. Go to your Web browser and type: https://localhost:9002/platform
You should now see the HAC Initialization screen. Hybris has been successfully installed!
In the next section, I will review the files that fully automated the Hybris installation, starting with the Vagrantfile.
- Line 6 downloads the entire CentOS 7 Linux distro to your host machine.
- Line 9 defines the name of the virtual machine
- Line 10 establishes the amount of RAM dedicated to the virtual machine.
- Line 13 is commented out, but you may find this line useful if you want to assign a private IP address to your virtual machine.
- Lines 15 and 16 ensure the default Hybris ports are available on the virtual machine.
- Line 18 ensures the host machine is set up for agent forwarding.
- Line 21 allows the Hybris Installation Zip file to be copied to the virtual machine from your host machine.
- Line 24 provisions the primary shell script, bootstrap.sh, to install and configure the Hybris dependencies such as Java 8 and MySQL. We will review the bootstrap.sh momentarily that installs the dependencies.
- Line 26 displays a congratulations banner once the installation is complete.
Now let’s review the second file, bootstrap.sh.
The Bootrap.sh file is a shell script that installs the Hybris software dependencies such as Java and MySQL. In more detail, the bootstrap.sh file will install Java 1.8, which is recommended for Hybris 6.3 The bootstrap.sh file will also configure the MySQL credentials and create a database called hybrisDB.
Let’s review the bootstrap.sh file.
- Lines 3-7 are variables used throughout the shell script such as Hybris directory location, Hybris database name, and Hybris database credentials. Please modify these according to your environment.
- Line 9 updates Centos 7 with more recent packages, if available.
- Line 12 installs the wget package.
- Lines 15 through 23 downloads and installs Java. I recommend setting up javac and jar commands path using alternatives as shown in Lines 19 through 23.
- Jumping to line 28, which sets the JAVA_HOME system variable.
- Line 31 sets the PATH variable
- Now the fun starts on line 39. We perform a wget to download the MySQL RPM file.
- Line 40-43, installs MySQL.
- Line 46 starts the MySQL Service
- Line 49 is very important in order to successfully automate the installation. Line 49 grabs the MySQL default password and assigns it to a local variable.
- On line 54, the default password is then used to login into mysqladmin
- On line 55, the Hybris database is created with the name, hybrisDB. You may change this to any db name that makes sense for you.
- Jumping to line 63. This is very important as the Hybris Installation Zip file is copied from your Host computer’s Vagrant directory to the virtual machine’s /opt/hybris63 directory.
- On line 65, installing the unzip binaries to unzip the Hybris Installation Zip file.
- Line 68, the Hybris Installation Zip file is unzipped.
- Line 71, the Hybris Installation Zip file is removed from the virtual machine for good measure.
- Skipping ahead to line 77 through 82, we open the project.properties file with the sed command to disable hsqldb database by commenting out its configuration.
- Line 85 through 94, we enable the MySQL configuration by removing the hashtag or pound symbol. The database name is set to use hybrisDB. The Hybris user name and password is set to match the username and password we defined in lines 6 and 7 of this file.
- Line 98 downloads the MySQL Connector Java Jar file and copies it to the /hybris/bin/platform/lib/dbdriver.
- On line 100, the Ant environment variables are set.
- Line 104, ant clean all command is executed to run Hybris in the develop mode automatically.
- Lastly on line 106, the Hybris application is started.
There's a lot of information covered in the article. Please clone the Github repo discussed in the article, and spend time familiarizing yourself with the Vagrantfile and bootstrap.sh files. Once you understand the details of these files, you will be well on your way to fully automating your own Hybris deployments. Good luck!