
FreeBSD is rock solid unix like operating system that is widely used in the server side. FreeBSD is used in many area such as network, filesystem. Jasperser is opensource reporting platform that provided excellent reporting feature and widely used in Enterprise Java Application. And Tomcat is servlet container that most of Java Web Application deployed on. Comparing to Application Server like wildfly/Jboss, Tomcat is very light weight and could be extend to use for any enterprise application. In this post, I will demostrate how to utilize install Jasperserver by using tomcat 9 on FreeBSD.
Table contents
- Install Tomcat9 on FreeBSD
- Install Jasperserver
- Referrence
For my environment, I have set up as following
- For OS is FreeBSD 13.1
- Java Runtime is JDK 1.8
- Servlet/Web Container is Tomcat 9
- Report Server is Jasperserver 7.6
- Database server is PostgreSQL 12
Installing Tomcat 9 on FreeBSD
To install Tomcat 9 on FreeBSD, I have used pkg (FreeBSD Package Management). And for default, sudo command needts to be install as prerequisite. You could use pkg to install sudo command.
%sudo pkg update
%sudo pkg install tomcat9 -y
Next is to edit /etc/rc.conf to disable tomcat9 service
%sudo vim /etc/rc.conf
hostname="freebsd"
keymap="us.kbd"
ifconfig_em0="inet 192.168.10.67 netmask 255.255.255.0"
defaultrouter="192.168.10.1"
sshd_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"
tomcat9_enable="NO"
Next is to add user to tomcat
% sudo vim /usr/local/apache-tomcat-9.0/conf/tomcat-users.xml
And add below,
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<user username="admin" password="password" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-gui"/>
Then, to be able to access, tomcat management page, you need to edit /usr/local/apache-tomcat-9.0/webapps/manager/META-INF/context.xml
% sudo vim /usr/local/apache-tomcat-9.0/webapps/manager/META-INF/context.xml
Now you need to comment out below
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Context antiResourceLocking="false" privileged="true" >
<CookieProcessor className="org.apache.tomcat.util.http.Rfc6265CookieProcessor"
sameSiteCookies="strict" />
<!--
<Valve className="org.apache.catalina.valves.RemoteAddrValve"
allow="127\.\d+\.\d+\.\d+|::1|0:0:0:0:0:0:0:1" />
-->
<Manager sessionAttributeValueClassNameFilter="java\.lang\.(?:Boolean|Integer|Long|Number|String)|org\.apache\.catalina\.filters\.CsrfPreventionFilter\$LruCache(?:\$1)?|java\.util\.(?:Linked)?HashMap"/>
</Context>
Now, once you start tomcat 9, you could be able to access management page
% sudo tcsh /usr/local/apache-tomcat-9.0/bin/startup.sh
Installing Jasper Server
Prerequisit for installin Jasper Server on FreeBSD is installing bash shell. Default shell on FreeBSD is tcsh. So, you need to install bash on FreeBSD and change default shell to bash.
%sudo pkg install bash -y
Then, you need to change your default shell from tcsh shell to bash shell
%sudo chsh -s /usr/local/bin/bash user01
Next step is to download jasperserver
$cd ~
$mkdir download
$cd download
$wget https://sourceforge.net/projects/jasperserver/files/JasperServer/JasperReports%20Server%20Community%20edition%207.8.0/TIB_js-jrs-cp_7.8.0_bin.zip
$unzip TIB_js-jrs-cp_7.8.0_bin.zip
$ ls
jasperreports-server-cp-7.8.0-bin TIB_js-jrs-cp_7.8.0_bin.zip
$cd jasperreports-server-cp-7.8.0-bin
$ ls
apache-ant buildomatic docs jasperserver.war samples TIB_js-jrs-ce_7.8.0_license.pdf TIB_js-jrs-ce_7.8.0_license.txt
$ cp buildomatic/sample_conf/postgresql_master.properties buildomatic/default_master.properties
Edit the configuration file for install
$vi buildomatic/default_master.properties
appServerType = tomcat
# appServerType = jboss-eap-7
# appServerType = wildfly
# appServerType = glassfish
# appServerType = skipAppServerCheck
# appServerType = wildfly
# Tomcat app server root dir
appServerDir = /usr/local/apache-tomcat-9.0
# if linux package managed tomcat instance, set two properties below
# CATALINA_HOME = /usr/share/tomcat9
# CATALINA_BASE = /var/lib/tomcat9
# JBoss app server root dir
# appServerDir = C:\\wildfly-14.0.1.Final
# appServerDir = /home/devuser/wildfly-14.0.1.Final
# appServerDir = /opt/wildfly
# jboss.profile = default
# Glassfish app server root dir
# appServerDir = C:\\glassfish-4.1.2
# appServerDir = /home/devuser/glassfish-4.1.2
# database type
dbType=postgresql
# database location and connection settings
dbHost=localhost
dbUsername=user01
dbPassword=password
# additional database parameters
# (uncomment these if you want non-default settings)
dbPort=5432
set Java Home and JRE HOME
$sudo vim /etc/profile
export JAVA_HOME=/usr/local/openjdk8
export JRE_HOME=/usr/local/openjdk8/jre
Before installing JasperServer, you need to edit install script.
$cd buildomatic
$vim js-install-ce.sh
#!/usr/local/bin/bash
#
# JasperReports Server CE installation script.
#
# Usage: js-install-ce.sh {option:(>EMPTY<|minimal|drop-db|regen-config|test)}
#
./bin/do-js-install.sh ce $*
And also in ./bin/do-js-install.js and ./bin/do-js-setup.sh change #!/bin/sh to #!/usr/local/bin/bash. Once you finished, execute script below to install jasperserver.
$cd buildomatic
$sudo bash js-install-ce.sh
To start tomcat and jasperserver, do not use service tomcat9 start. you need to use below command, otherwise tomcat will throw error for deploying jasperserver.
$sudo bash /usr/local/apache-tomcat-9.0/bin/startup.sh
To login default username and password is jasperadmin/jasperadmin
No comments:
Post a Comment