7. Part 1 Installation of Datomic Database on FreeBSD 11.2 AWS - tanalam2411/freebsd GitHub Wiki

1. Installing Java(JDK) for Maven:

root@freebsd:/usr/home/ec2-user # freebsd-update fetch
root@freebsd:/usr/home/ec2-user # freebsd-update install
root@freebsd:/usr/home/ec2-user # pkg search ^openjdk
openjdk-7.161.01,1             Java Development Kit 7
openjdk-jre-7.161.01,1         Java Runtime Environment 7
openjdk6-b45,1                 Oracle's Java 6 virtual machine release under the GPL v2
openjdk6-jre-b45,1             Oracle's Java 6 Runtime Environment under the GPL v2
openjdk8-8.181.13_1            Java Development Kit 8
openjdk8-jre-8.181.13_1        Java Runtime Environment 8
root@freebsd:/usr/home/ec2-user # pkg install openjdk8-8.181.13_1
root@freebsd:/usr/home/ec2-user # mount -t fdescfs fdesc /dev/fd
root@freebsd:/usr/home/ec2-user # mount -t procfs proc /proc
root@freebsd:/usr/home/ec2-user # vi /etc/fstab
----------------------------------------------------------
# Append this two lines at the end

fdesc   /dev/fd         fdescfs         rw      0       0
proc    /proc           procfs          rw      0       0
----------------------------------------------------------


root@freebsd:/usr/home/ec2-user # rehash 
root@freebsd:/usr/home/ec2-user # java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)

Setting JAVA_HOME env

root@freebsd:/usr/home/ec2-user # bash
[root@freebsd /usr/home/ec2-user]# export JAVA_HOME=/usr/local/openjdk8/
[root@freebsd /usr/home/ec2-user]# echo $JAVA_HOME
/usr/local/openjdk8/


2. Installing Maven (mvn)

Download it from - https://maven.apache.org/download.cgi

Cpoy the link address by right clicking of the second option Binary zip archive maven_download

[root@freebsd /usr/home/ec2-user]# cd /root/performance/datomic/
[root@freebsd:~/performance/datomic]# wget http://mirrors.fibergrid.in/apache/maven/maven-3/3.6.0/binaries/apache-maven-3.6.0-bin.zip
[root@freebsd:~/performance/datomic]# unzip apache-maven-3.6.0-bin.zip

[root@freebsd ~/performance/datomic]# cd apache-maven-3.6.0
[root@freebsd ~/performance/datomic/apache-maven-3.6.0]# pwd
/root/performance/datomic/apache-maven-3.6.0
[root@freebsd ~/performance/datomic/apache-maven-3.6.0]# export PATH=$PATH:/root/performance/datomic/apache-maven-3.6.0/bin
[root@freebsd ~/performance/datomic/apache-maven-3.6.0]# 
[root@freebsd ~/performance/datomic/apache-maven-3.6.0]# mvn -v
Apache Maven 3.6.0 (97c98ec64a1fdfee7767ce5ffb20918da4f719f3; 2018-10-24T18:41:47Z)

3. Download and Install Datomic:

https://my.datomic.com/downloads/free

datomic_free_download

[root@freebsd:~/performance/datomic]# wget https://my.datomic.com/downloads/free/0.9.5703
[root@freebsd:~/performance/datomic]# unzip 0.9.5703
[root@freebsd:~/performance/datomic]# cd datomic-free-0.9.5703/

[root@freebsd ~/performance/datomic/datomic-free-0.9.5703]# bin/maven-install

_______________________________________________________________________________
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  12.443 s
[INFO] Finished at: 2018-11-26T02:14:53Z
[INFO] ------------------------------------------------------------------------
_______________________________________________________________________________

4. Running Transactor:

[root@freebsd ~/performance/datomic/datomic-free-0.9.5703]# bash ./bin/transactor config/samples/free-transactor-template.properties

If you get this error:

Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
./bin/transactor: bin/classpath: /bin/bash: bad interpreter: No such file or directory
Error: Could not find or load main class clojure.main

Change in script bin/transactor

old - exec java -server -cp `bin/classpath` $XMX $XMS $JAVA_OPTS clojure.main --main datomic.launcher "$@"
new - exec java -server -cp `bash ./bin/classpath` $XMX $XMS $JAVA_OPTS clojure.main --main datomic.launcher "$@"

Start Transactor again

[root@freebsd ~/performance/datomic/datomic-free-0.9.5703]# bash ./bin/transactor config/samples/free-transactor-template.properties
Launching with Java options -server -Xms1g -Xmx1g -XX:+UseG1GC -XX:MaxGCPauseMillis=50
Starting datomic:free://localhost:4334/<DB-NAME>, storing data in: data ...
System started datomic:free://localhost:4334/<DB-NAME>, storing data in: data

5. Install Datomic Console

Download Datomic Console from https://my.datomic.com/downloads/free (Need SignUp)

datomic_console

After Signing up, download it on your host machine and SCP it to the remote machine (Ur Enviroment) datomic_console_download

[root@freebsd ~/performance/datomic]# unzip datomic-console-0.1.216.zip

Move content of Datomic's Console (bin and lib) to Datomic's Free location:

[root@freebsd ~/performance/datomic]# cp -R datomic-console-0.1.216/bin/* datomic-free-0.9.5703/bin/
[root@freebsd ~/performance/datomic]# cp -R datomic-console-0.1.216/lib/* datomic-free-0.9.5703/lib/

Run console:

[root@freebsd ~/performance/datomic/datomic-free-0.9.5703]# bash ./bin/console -p 8081 dev 

If you get this error:

datomic:free://localhost:4334/
./bin/console: bin/classpath: /bin/bash: bad interpreter: No such file or directory
Error: Could not find or load main class clojure.main

Change in script bin/console

old - /usr/bin/env java -server -Xmx1g $DATOMIC_JAVA_OPTS  -cp lib/console/*:`bin/classpath` clojure.main -i "bin/bridge.clj" --main datomic.console "$@"

new - /usr/bin/env java -server -Xmx1g $DATOMIC_JAVA_OPTS  -cp lib/console/*:`bash ./bin/classpath` clojure.main -i "bin/bridge.clj" --main datomic.console "$@"

Run console again

[root@freebsd ~/performance/datomic/datomic-free-0.9.5703]# bash ./bin/console -p 8081 dev datomic:free://localhost:4334/
Console started on port: 8081
   dev = datomic:free://localhost:4334/
Open http://localhost:8081/browse in your browser (Chrome recommended)

Open in browser - http://localhost:8081/browse datomic_console_ui


6. Start a Clojure REPL

root@freebsd:~/performance/datomic/datomic-free-0.9.5703 # bash ./bin/repl
./bin/repl: bin/run: /bin/bash: bad interpreter: No such file or directory

If you get this error, update file bin/repl and bin/run

root@freebsd:~/performance/datomic/datomic-free-0.9.5703 # vi bin/repl
________________________
old - bin/run -r $@
new - bash ./bin/run -r $@
________________________
root@freebsd:~/performance/datomic/datomic-free-0.9.5703 # vi bin/run

old - /usr/bin/env java -server -Xmx1g -Xms1g $DATOMIC_JAVA_OPTS ${java_opts} -cp `bin/classpath` clojure.main -i "bin/bridge.clj" ${clojure_args}
new - /usr/bin/env java -server -Xmx1g -Xms1g $DATOMIC_JAVA_OPTS ${java_opts} -cp `bash ./bin/classpath` clojure.main -i "bin/bridge.clj" ${clojure_args}

Starting REPL again:

root@freebsd:~/performance/datomic/datomic-free-0.9.5703 # bash ./bin/repl
Clojure 1.9.0
user=> 
⚠️ **GitHub.com Fallback** ⚠️