Project

General

Profile

Support #951

Install OFBiz on FreeBSD

Added by Daniel Curtis over 3 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Accounting Server
Target version:
Start date:
11/18/2020
Due date:
% Done:

100%

Estimated time:

Description

This is a guide on installing a self-hosted OFBiz instance on FreeBSD 12.2-RELEASE.

Prepare the Environment

  • Make sure the system is up to date:
    pkg update && pkg upgrade
    
  • Add ofbiz user:
    pw add user -n ofbiz -m -s /bin/sh -c "OFBiz" 
    
  • Install the dependencies:
    pkg install openjdk8 git gradle
    

Configure PostgreSQL

  • Install PostgreSQL:
    pkg install postgresql-jdbc postgresql96-server postgresql96-client postgresql96-contrib
    
  • Initialize, start, and enable postgresql at boot:
    sysrc postgresql_enable="YES" 
    service postgresql initdb
    service postgresql start
    
  • Log in to postgresql user account and connect to database:
    su - postgres
    psql -d template1
    
    • Create a user:
      CREATE USER ofbiz WITH PASSWORD 'SuperSecretPassword' CREATEDB;
      
    • Create the databases & grant all privileges on database
      CREATE DATABASE ofbizdb OWNER ofbiz encoding='UTF8';
      CREATE DATABASE ofbizolapdb OWNER ofbiz encoding='UTF8';
      CREATE DATABASE ofbiztenantdb OWNER ofbiz encoding='UTF8';
      
  • Quit the database session
    \q
    exit
    

Install OFBiz

  • Download ofbiz:
    su - ofbiz
    git clone -b release18.12 https://github.com/apache/ofbiz-framework
    cd ofbiz-framework
    
  • Edit the entityengine.xml file:
    vi framework/entity/config/entityengine.xml
    
    • And modify the group-map section:
      <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
          <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localpostgresolap"/>
          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localpostgrestenant"/>
      </delegator>
      <delegator name="default-no-eca" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" entity-eca-enabled="false distributed-cache-clear-enabled="false">
          <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localpostgresolap"/>
          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localpostgrestenant"/>
      </delegator>
      <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
          <group-map group-name="org.apache.ofbiz" datasource-name="localpostgres"/>
          <group-map group-name="org.apache.ofbiz.olap" datasource-name="localpostgresolap"/>
          <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localpostgrestenant"/>
      </delegator>
      
    • Also modify the datasource section:
      <datasource name="localpostgres" 
              helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO" 
              schema-name="public" 
              field-type-name="postgres" 
              check-on-start="true" 
              add-missing-on-start="true" 
              use-fk-initially-deferred="false" 
              alias-view-columns="false" 
              join-style="ansi" 
              use-binary-type-for-blob="true" 
              use-order-by-nulls="true" 
              result-fetch-size="50"> 
          <read-data reader-name="tenant"/>
          <read-data reader-name="seed"/>
          <read-data reader-name="seed-initial"/>
          <read-data reader-name="demo"/>
          <read-data reader-name="ext"/>
          <read-data reader-name="ext-test"/>
          <read-data reader-name="ext-demo"/>
          <inline-jdbc
                  jdbc-driver="org.postgresql.Driver" 
                  jdbc-uri="jdbc:postgresql://127.0.0.1:5433/ofbizdb" 
                  jdbc-username="ofbiz" 
                  jdbc-password="SuperSecretPassword" 
                  isolation-level="ReadCommitted" 
                  pool-minsize="2" 
                  pool-maxsize="250" 
                  time-between-eviction-runs-millis="600000"/>
      </datasource>
      <datasource name="localpostgresolap" 
              helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO" 
              schema-name="public" 
              field-type-name="postgres" 
              check-on-start="true" 
              add-missing-on-start="true" 
              use-fk-initially-deferred="false" 
              alias-view-columns="false" 
              join-style="ansi" 
              result-fetch-size="50" 
              use-binary-type-for-blob="true" 
              use-order-by-nulls="true">
          <read-data reader-name="tenant"/>
          <read-data reader-name="seed"/>
          <read-data reader-name="seed-initial"/>
          <read-data reader-name="demo"/>
          <read-data reader-name="ext"/>
          <read-data reader-name="ext-test"/>
          <read-data reader-name="ext-demo"/>
          <inline-jdbc
                  jdbc-driver="org.postgresql.Driver" 
                  jdbc-uri="jdbc:postgresql://127.0.0.1:5433/ofbizolapdb" 
                  jdbc-username="ofbiz" 
                  jdbc-password="SuperSecretPassword" 
                  isolation-level="ReadCommitted" 
                  pool-minsize="2" 
                  pool-maxsize="250" 
                  time-between-eviction-runs-millis="600000"/>
      </datasource>
      <datasource name="localpostgrestenant" 
              helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO" 
              schema-name="public" 
              field-type-name="postgres" 
              check-on-start="true" 
              add-missing-on-start="true" 
              use-fk-initially-deferred="false" 
              alias-view-columns="false" 
              join-style="ansi" 
              result-fetch-size="50" 
              use-binary-type-for-blob="true" 
              use-order-by-nulls="true">
          <read-data reader-name="tenant"/>
          <read-data reader-name="seed"/>
          <read-data reader-name="seed-initial"/>
          <read-data reader-name="demo"/>
          <read-data reader-name="ext"/>
          <read-data reader-name="ext-test"/>
          <read-data reader-name="ext-demo"/>
          <inline-jdbc
                  jdbc-driver="org.postgresql.Driver" 
                  jdbc-uri="jdbc:postgresql://127.0.0.1:5433/ofbiztenantdb" 
                  jdbc-username="ofbiz" 
                  jdbc-password="SuperSecretPassword" 
                  isolation-level="ReadCommitted" 
                  pool-minsize="2" 
                  pool-maxsize="250" 
                  time-between-eviction-runs-millis="600000"/>
      </datasource>
  • Edit the build.gradle file:
    vi build.gradle
    
    • And insert the postgres jdbc to the end of the compile dependencies:
      dependencies {
          // ofbiz compile libs
          ...
          compile 'org.postgresql:postgresql:42.2.18'
      }
      
  • Compile ofbiz:
    ./gradlew cleanAll loadAll
    

Resources

#1

Updated by Daniel Curtis over 3 years ago

  • Description updated (diff)
#2

Updated by Daniel Curtis over 3 years ago

  • Description updated (diff)
#3

Updated by Daniel Curtis over 3 years ago

  • Description updated (diff)
  • Status changed from New to In Progress
  • % Done changed from 0 to 50
#4

Updated by Daniel Curtis over 3 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 50 to 100
#5

Updated by Daniel Curtis about 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF