WildFly/JBoss / PostgreSQL : Draft

First steps of tutorial (synthesis of readings).

  1. Download/Uncompress Wildfly
  2. Download/Install PostgreSQL (9.4 here)
  3. Configure PostgreSQL
    • Setup postgres password:
      su - postgres
      psql -c "ALTER USER postgres WITH PASSWORD 'postgres'" -d template1
      exit
    • Allow authentification using md5 from local sockets
      nano /etc/postgresql/9.4/main/pg_hba.conf
      # BEFORE: local   all          all           peer
      local   all      all                     md5
      # IPv4 local connections:
      host    all      all        127.0.0.1/32       md5
      # IPv6 local connections:
      host    all        all       ::1/128           md5

      then restart PostgreSQL service

    • Create database…
  4. To start in standalone mode listening on all IP addresses : bin/standalone.sh -b0.0.0.0
  5. Download PostgreSQL JDBC Driver (Here for Java 1.7+) JDBC Driver (PostgreSQL 9.4) into /tmp
  6. Configure Wildfly (JDBC Driver && DataSource)
      • Start jboss-cli
        bin/jboss-cli.sh
      • Install module:
        module add --name=org.postgres --resources=/tmp/postgresql-9.4-1205.jdbc41.jar --dependencies=javax.api,javax.transaction.api
      • Declare JDBC Driver into Application Server
        /subsystem=datasources/jdbc-driver=postgres:add(driver-name="postgres",driver-module-name="org.postgres",driver-class-name=org.postgresql.Driver)
      • Install datasource named “PostGreDS”
        data-source add --jndi-name=java:/PostGreDS --name=PostgrePool --connection-url=jdbc:postgresql://localhost/postgres --driver-name=postgres --user-name=postgres
  7. Other stuffs
    
    

References: