How to: Install hybris on AWS

It is really simple to install hybris on AWS (Amazon Web Services) if you know a little about Linux. But since I have never had any experience on Linux I wrote down the actions I did. Feel free to comment any tips & tricks.

hybris-on-aws

Create an environment

  1. Create an EC2 instance in AWS. The recommended server requirements Quad Core, e.g. i7, 16 GB memory and 20 GB of hard disk space, SSD recommended.
  2. Please make sure the ports 9001 & 9002 are configured in the AWS Security Group to get access to this instance.
  3. Connect to the AWS instance by Putty
  4. Get root access and install all server components required for hybris
    sudo -s #to gain root access
    yum install java
    yum install mysqld
    service mysqld start #to start the service
  5. Create a new user and set a password for this user. I prefer to install hybris in its own environment.
  6. useradd hybris <enter>passwd hybris <enter>
  7. Switch to the hybris user
  8. su hybris

Install hybris and build it

  1. Download the hybris installation file (hybris-commerce-suite-5.x.x.x.zip, 2GB) to your desktop (https://wiki.hybris.com/display/downloads/Download)
  2. Download and open WinSCP (or Filezilla) to create an SCP connection to transfer the installation file to the hybris home directory
  3. In my situation I could only connect with the EC2-user and therefor transfer the file only to the home directory of the EC2-user. But that is not the place I want hybris to be installed. So I used the following command to move the file to the hybris home directory before unzipping.
    mv /home/ec2-user/hybris-commerce-suite-5.4.0.0.zip /home/hybris/hybris-commerce-suite-5.4.0.0.zip
  4. Unzip the file
    unzip /home/hybris/hybris-commerce-suite-5.4.0.0.zip
  5. Clean up the installation file
    rm hybris-commerce-suite-5.4.0.0.zip
  6. Build the build the hybris Commerce Suite
    cd /home/hybris/hybris/bin/platform. ./setantenv.sh #please add the dot at first followed by a space#If the setantenv.sh command is run properly, there will be no specific outputant clean all #This will start building hybris
  7. Press the Enter key to use the default, the develop configuration template.
  8. Wait for the build to complete. It may take several minutes:
    BUILD SUCCESSFULTotal time: 2 minutes 5 seconds
  9. Start hybris
    cd /home/hybris/hybris/bin/platform. ./hybrisserver.sh #please add the dot at first followed by a space
  10. (!) Do not close the command window because the hybris Server must continue running in this window while you work in the hybris Commerce Suite. You may minimize it.
  11. Wait for the hybris Server start-up to complete:
    Dec 12, 2014 3:39:08 PM org.apache.catalina.startup.Catalina startINFO: Server startup in 163949 ms
  12. The hybris Commerce Suite is now ready for use. Open the hybris Administration Console, the default URL for which is http://localhost:9001

Configure hybris as a service

To auto-start hybris on boot we need to configure hybris as a service.

  1. Stop the hybris server and get back to root access
    CTRL-C
    exit
  2. Create a hybris service startup file
    vi /etc/init.d/hybris
  3. Copy the text from the following file into the new created file.
    hybris startup script
  4. Set the correct value for the hybris installation directory
    # Make sure the server starts as a non-root user, set that here.
    RUNAS="hybris"
    # Set the base path to your hybris installation.
    HYBRIS_HOME="/home/hybris/hybris"
  5. Save the file
  6. To verify the file is saved correctly open the file
    cat /etc/init.d/hybris
  7. Make sure the file can be executed
    chmod 755 /etc/init.d/hybris
  8. Add the file to the server startup list
    chkconfig --add hybris
    chkconfig hybris on
    service hybris start

Configure hybris with a MySQL database

  1. Make sure the mysqld service will auto-start on boot
    ntsysv
    ntsysv - simple interface for configuring runlevels
  2. Create a mysql database for hybris
    mysql -u root
    CREATE DATABASE hybris_db;
    GRANT all ON hybris_db.* TO \'hybris\'@\'localhost\';
    UPDATE mysql.user SET Password=PASSWORD(\'password\') WHERE User=\'hybris\';
    FLUSH PRIVILEGES;SELECT user,host FROM mysql.user; #show all users
    exitmysql -u hybris -h localhost -p #to log in as the hybris user
    SHOW DATABASES; #to show all databases
    exit
  3. Restart the mysql service
    sudo /etc/init.d/mysqld stop
    sudo /etc/init.d/mysqld start
  4. Download the mysql db connector from http://dev.mysql.com/downloads/file.php?id=454397.
  5. Put the jar-file in the  folder ${HYBRIS_BIN_DIR}/platform/lib/dbdriver/(yet again I need to copy the file from my ec2-user home directory as I cannot use FTP on my hybris user)
    exit #to gain root access
    mv /home/ec2-user/mysql-connector-java-5.1.34-bin.jar /home/hybris/hybris/bin/platform/lib/dbdriver/mysql-connector-java-5.1.34-bin.jar
    chown hybris:hybris /home/hybris/hybris/bin/platform/lib/dbdriver/mysql-connector-java-5.1.34-bin.jar #to set the owner and group to hybris
  6. Put the mysql properties file in
  7. Set the correct values in the properties file to connect with the mysql database
    su hybrisvi /home/hybris/hybris/bin/platform/project.properties
  8. db.url=jdbc:mysql://localhost/hybris_db?useConfigs=maxPerformancedb.driver=com.mysql.jdbc.Driverdb.username=hybrisdb.password={password}db.tableprefix=hybris_dbmysql.allow.fractional.seconds=truemysql.optional.tabledefs=CHARSET=utf8 COLLATE=utf8_binmysql.tabletype=InnoDB#hsqldb.usecachedtables=true
  9. Save the file
  10. Edit the config and add the following
    vi /etc/my.cnf
  11. innodb_flush_log_at_trx_commit=0
  12. Save the file
  13. Rebuild hybris
    cd /home/hybris/hybris/bin/platform. ./setantenv.shant clean all #rebuild

Initialize hybris

  1. Restart hybris
    exit #to gain root access
    service hybris restart
  2. Open the hybris Administration Console, the default URL for which is http://{AWS IP}:9001

All done!

One Reply to “How to: Install hybris on AWS”

Leave a Reply

Your email address will not be published. Required fields are marked *