h<\/a>and check if they release the more recent version. To proceed with the installation, let\u2019s download the binary distribution file first.<\/p>\n\n\n\n# su - tomcat\n$ wget https:\/\/dlcdn.apache.org\/tomcat\/tomcat-9\/v9.0.76\/bin\/apache-tomcat-9.0.76.tar.gz -O tomcat-9.0.76.tar.gz<\/pre>\n\n\n\nOur user ‘tomcat’ home directory is \/opt\/tomcat, and the directory was created when we added that user. And, we will install Tomcat under this directory. Let\u2019s extract the downloaded file now.<\/p>\n\n\n\n
$ tar -xzvf tomcat-9.0.76.tar.gz -C \/opt\/tomcat --strip-components=1<\/pre>\n\n\n\nNow, the directory \/opt\/tomcat contains all Tomcat files. You can verify this with this command.<\/p>\n\n\n\n
$ ls -lh \/opt\/tomcat<\/pre>\n\n\n\nThe command will return an output like this:<\/p>\n\n\n\n
tomcat@ubuntu22:~$ ls -lh \/opt\/tomcat\/ total 12M -rw-r----- 1 tomcat tomcat 20K Jun 5 07:17 BUILDING.txt -rw-r----- 1 tomcat tomcat 6.1K Jun 5 07:17 CONTRIBUTING.md -rw-r----- 1 tomcat tomcat 56K Jun 5 07:17 LICENSE -rw-r----- 1 tomcat tomcat 2.3K Jun 5 07:17 NOTICE -rw-r----- 1 tomcat tomcat 3.4K Jun 5 07:17 README.md -rw-r----- 1 tomcat tomcat 6.8K Jun 5 07:17 RELEASE-NOTES -rw-r----- 1 tomcat tomcat 17K Jun 5 07:17 RUNNING.txt drwxr-x--- 2 tomcat tomcat 4.0K Jun 19 13:43 bin drwx------ 2 tomcat tomcat 4.0K Jun 5 07:17 conf drwxr-x--- 2 tomcat tomcat 4.0K Jun 19 13:43 lib drwxr-x--- 2 tomcat tomcat 4.0K Jun 5 07:17 logs drwxr-x--- 2 tomcat tomcat 4.0K Jun 19 13:43 temp -rw-rw-r-- 1 tomcat tomcat 12M Jun 5 07:32 tomcat-9.0.76.tar.gz drwxr-x--- 7 tomcat tomcat 4.0K Jun 5 07:17 webapps drwxr-x--- 2 tomcat tomcat 4.0K Jun 5 07:17 work<\/pre>\n\n\n\nNow, exit from user \u2018tomcat\u2019 and go back to the root or your sudo user.<\/p>\n\n\n\n
$ exit<\/pre>\n\n\n\nWe need to create a systemd file to manage our Tomcat service. Let\u2019s create systemd service file for Tomcat.<\/p>\n\n\n\n
# nano \/etc\/systemd\/system\/tomcat.service<\/pre>\n\n\n\nPaste the following into the systemd service file, then save it.<\/p>\n\n\n\n
[Unit]\nDescription=Apache Tomcat\nAfter=network.target\n\n[Service]\nType=forking\n\nUser=tomcat\nGroup=tomcat\n\nEnvironment=JAVA_HOME=\/usr\/lib\/jvm\/java-1.11.0-openjdk-amd64\nEnvironment=CATALINA_PID=\/opt\/tomcat\/tomcat.pid\nEnvironment=CATALINA_HOME=\/opt\/tomcat\nEnvironment=CATALINA_BASE=\/opt\/tomcat\nEnvironment=\"CATALINA_OPTS=-Xms1024M -Xmx1024M -server -XX:+UseParallelGC\"\n\nExecStart=\/opt\/tomcat\/bin\/startup.sh\nExecStop=\/opt\/tomcat\/bin\/shutdown.sh\n\nExecReload=\/bin\/kill $MAINPID\nRemainAfterExit=yes\n\n[Install]\nWantedBy=multi-user.target<\/pre>\n\n\n\nSave the file, exit from nano editor then reload systemd for changes to take effect.<\/p>\n\n\n\n
# systemctl daemon-reload<\/pre>\n\n\n\nAt this point, we are not going to start Tomcat.<\/p>\n\n\n\n
<\/span>Step 5. Download and Deploy JasperReports<\/span><\/h2>\n\n\n\nIn this step, we will download the Jasper Reports server zipped file and install it manually. When writing this article, the latest available version is 8.2.0. You can check if they have the more recent version at https:\/\/sourceforge.net\/projects\/jasperserver\/files\/JasperServer\/.<\/p>\n\n\n\n
# su - tomcat $ wget https:\/\/sourceforge.net\/projects\/jasperserver\/files\/JasperServer\/JasperReports%20Server%20Community%20Edition%208.2.0\/TIB_js-jrs-cp_8.2.0_bin.zip\/download -O jasperreports_8.2.0.zip<\/pre>\n\n\n\nOnce downloaded, we can extract it directly.<\/p>\n\n\n\n
$ unzip jasperreports_8.2.0.zip<\/pre>\n\n\n\nJasper Reports server supports PostgreSQL, MySQL, Oracle, DB2, and SQL servers. In this article, we are going to use MySQL (MariaDB), and we already installed it. To proceed with the Jasper Report configuration file, let\u2019s copy the sample configuration file first.<\/p>\n\n\n\n
Let\u2019s copy \/opt\/jasperreports-server-cp-8.0.0-bin\/buildomatic\/sampe-conf\/mysql.master_properties to buildomatic directory as default_master.properties<\/p>\n\n\n\n
$ cp -a jasperreports-server-cp-8.2.0-bin\/buildomatic\/sample_conf\/mysql_master.properties jasperreports-server-cp-8.2.0-bin\/buildomatic\/default_master.properties<\/pre>\n\n\n\nNow, let’s edit jasperreports-server-cp-8.2.0-bin\/buildomatic\/default_master.properties<\/p>\n\n\n\n
$ nano jasperreports-server-cp-8.2.0-bin\/buildomatic\/default_master.properties<\/pre>\n\n\n\nAdd the two lines below<\/p>\n\n\n\n
CATALINA_HOME = \/opt\/tomcat CATALINA_BASE = \/opt\/tomcat<\/pre>\n\n\n\nThen, replace the database configuration part with the following, and make sure the username and database match with the one we created earlier.<\/p>\n\n\n\n
dbHost=localhost dbUsername=master dbPassword=m0d1fyth15<\/pre>\n\n\n\nAnd set encrypt to true.<\/p>\n\n\n\n
encrypt = true<\/pre>\n\n\n\nIt should look like this:<\/p>\n\n\n\n
CATALINA_HOME = \/opt\/tomcat\nCATALINA_BASE = \/opt\/tomcat\n\ndbHost=localhost\ndbUsername=master\ndbPassword=m0d1fyth15\n\nencrypt = true<\/pre>\n\n\n\nSave the file then exit.<\/p>\n\n\n\n
Next, let\u2019s enter the buildomatic directory and run the js-install-ce.sh executable file. Prior to running this executable file, make sure Tomcat is NOT running.<\/p>\n\n\n\n
$ cd jasperreports-server-cp-8.2.0-bin\/buildomatic\/ $ .\/js-install-ce.sh<\/pre>\n\n\n\nThis will create databases and deploy jasperserver in Tomcat.<\/p>\n\n\n\n
Then, let\u2019s edit \/opt\/tomcat\/conf\/catalina.policy file.<\/p>\n\n\n\n
$ nano \/opt\/tomcat\/conf\/catalina.policy<\/pre>\n\n\n\nAppend the following into the file.<\/p>\n\n\n\n
grant codeBase \"file:\/groovy\/script\" { permission java.io.FilePermission \"${catalina.home}${file.separator}webapps${file.separator} jasperserver-pro${file.separator}WEB-INF${file.separator}classes${file.separator}-\", \"read\"; permission java.io.FilePermission \"${catalina.home}${file.separator}webapps${file.separator} jasperserver-pro${file.separator}WEB-INF${file.separator}lib${file.separator}*\", \"read\"; permission java.util.PropertyPermission \"groovy.use.classvalue\", \"read\"; };<\/pre>\n\n\n\n Save the file then exit.<\/p>\n\n\n\n
Then, we also need to edit applicationContext.xml file.<\/p>\n\n\n\n
$ nano \/opt\/tomcat\/webapps\/jasperserver\/WEB-INF\/applicationContext.xml<\/pre>\n\n\n\nInsert these into the reportsProtectionDomainProvider list<\/strong>.<\/p>\n\n\n\n <bean class=\"java.io.FilePermission\">\n <constructor-arg value=\"${catalina.home}${file.separator}webapps\n ${file.separator}jasperserver-pro${file.separator}\n WEB-INF${file.separator}classes${file.separator}-\"\/>\n <constructor-arg value=\"read\"\/>\n <\/bean>\n <bean class=\"java.io.FilePermission\">\n <constructor-arg value=\"${catalina.home}${file.separator}webapps\n ${file.separator}jasperserver-pro${file.separator}WEB-INF\n ${file.separator}lib${file.separator}*\"\/>\n <constructor-arg value=\"read\"\/>\n <\/bean><\/pre>\n\n\n\nIt should look like in the picture below.<\/p>\n\n\n\n <\/figure>\n\n\n\n<\/p>\n\n\n\n
Once completed, you can start Tomcat and wait for a few moments until everything is running.<\/p>\n\n\n\n
$ exit\n# systemctl start tomcat<\/pre>\n\n\n\nThen, you can navigate to http:\/\/YOUR_SERVER_IP_ADDRESS:8080\/jasperserver\/ to access JasperReports Server using the default login credentials.<\/p>\n\n\n\n
username: jasperadmin password: jasperadmin<\/pre>\n\n\n\n <\/figure>\n\n\n\n<\/p>\n\n\n\n
Once logged in, you can see the dashboard<\/p>\n\n\n\n <\/figure>\n\n\n\n<\/p>\n\n\n\n