Axelor 5.3.3 installation

Axelor Ver 5.3.6 Installation in Ubuntu 18.0

Prerequisites

Install Git

Install Git

$ sudo apt-get install git

For Ubuntu, this PPA provides the latest stable upstream Git version

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git

Install OpenJDK 8

Install OpenJDK 8

$ sudo apt-get install openjdk-8-jdk

Install Tomcat 9.0.26

For security purposes, Tomcat should be run as an unprivileged user (i.e. not root).

First create a new tomcat group:

$ sudo groupadd tomcat

Now create a new tomcat user:

$ sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat

Now, download version of Tomcat 9.0.26 from the Tomcat Downloads page. Under the Binary Distributions section, copy the link to the .tar.gz package. e.g apache-tomcat-9.0.26.tar.gz

Follow these commands:

$ cd /tmp
$ curl -O https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.26/bin/apache-tomcat-9.0.26.tar.gz
$ sudo mkdir -p /opt/tomcat
$ sudo tar -xzf apache-tomcat-9.0.26.tar.gz -C /opt/tomcat --strip-components=1

Now fix permissions:

$ cd /opt/tomcat
$ sudo chgrp -R tomcat /opt/tomcat
$ sudo chmod -R g+r conf
$ sudo chmod g+x conf
$ sudo chown -R tomcat webapps/ work/ temp/ logs/

Install PostgreSQL

$ sudo apt update
$ sudo apt install postgresql postgresql-contrib

You may also require to configure postgresql server to allow password authentication.

Example pg_hba.conf

$ sudo nano /etc/postgresql/10/main/pg_hba.conf

Replace peer to trust in # « local » is for Unix domain socket connections only. See below

# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5

Once PostgreSQL is configured, create a new database user with password:

$ sudo su postgres
$ createuser axelor --no-createdb --no-superuser
$ psql -c "alter user axelor with encrypted password 'axelor'";

A new PostgreSQL user axelor is created with the given password. The password used here is just for demonstration. Use your own strong password.

Create a database:

$ sudo su postgres
$ createdb -O axelor axelor
$ exit

A new database named axelor is created.

Build from source OR Download directory from here

Get the latest source code of the Axelor Open Suite using Git as follows:

$ mkdir -p /tmp/axelor-source
$ cd /tmp/axelor-source

$ git clone https://github.com/axelor/open-suite-webapp.git axelor-erp
$ sed -e 's|git@github.com:|https://github.com/|' -i axelor-erp/.gitmodules

$ cd axelor-erp
$ git checkout master
$ git submodule sync
$ git submodule init
$ git submodule update
$ git submodule foreach git checkout master
$ git submodule foreach git pull origin master

Now build the war package from the source:

$ ./gradlew -x test build

After build completion, you will find the war package under /tmp/axelor-source/axelor-erp/build/libs directory.

Deploy the App

Now as the war package is built, it’s time to run the app by deploying it on Tomcat.

Now copy the built WAR file « axelor-erp-5.3.6.war » from /tmp/axelor-source/axelor-erp/build/libs to this directory « /opt/tomcat/webapps/ROOT »

$ cd /opt/tomcat/webapps/ROOT
$ rm -r *
$ sudo cp /tmp/axelor-source/axelor-erp/build/libs/axelor-erp-5.3.6.war /opt/tomcat/webapps/ROOT/ROOT.war
$ sudo jar xvf ROOT.war

Now change the /opt/tomcat/webapps/ROOT/WEB-INF/classes/application.properties by editing the file as follow:

$ sudo nano /opt/tomcat/webapps/ROOT/WEB-INF/classes/application.properties

However, you have to provide database settings like this or if you have set it up with different database name or user name and password:

db.default.driver = org.postgresql.Driver
db.default.ddl = update
db.default.url = jdbc:postgresql://localhost:5432/axelor
db.default.user = axelor
db.default.password = axelor

Create Tomcat systemd Service File

We want to be able to run Tomcat as a service, so we will set up systemd service file.

Tomcat needs to know where Java is installed. This path is commonly referred to as “JAVA_HOME”. The easiest way to look up that location is by running this command:

$ sudo update-java-alternatives -l

It should display this

Output
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64

Your JAVA_HOME is the output from the last column. Given the example above, the correct JAVA_HOME for your server would be:

JAVA_HOME
/usr/lib/jvm/java-1.8.0-openjdk-amd64

With this piece of information, we can create the systemd service file. Open a file called tomcat.service in the /etc/systemd/system directory by typing:

$ sudo nano /etc/systemd/system/tomcat.service

Paste the following contents into your service file. Modify the value of JAVA_HOME if necessary to match the value you found on your system « /usr/lib/jvm/java-1.8.0-openjdk-amd64 » DONE for you :slight_smile: . You may also want to modify the memory allocation settings that are specified in CATALINA_OPTS :

/etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=root
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

When you are finished, save and close the file.
Next, reload the systemd daemon so that it knows about our service file:

$ sudo systemctl daemon-reload

Start the Tomcat service by typing:

sudo systemctl start tomcat

Double check that it started without errors by typing:

sudo systemctl status tomcat

After a short time you can access the application at: http://IP-ADDRESS:8080

While waiting for the application to come up you can check the log file « catalina.out » located in /opt/tomcat/logs.

$ sudo nano /opt/tomcat/logs/catalina.out

If you want to run the application with port 80 "without 8080. Note: make sure no other http services is running.

Edit the file /opt/tomcat/conf/server.xml as follow:

$ sudo nano /opt/tomcat/conf/server.xml 

and replace this par of the file the port from 8080 to 80

<Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />

That’s all folk good luck and hope it will work for you. If not give me a buzz :slight_smile:

7 « J'aime »