JasperReports library is an open-source reporting engine that is entirely written in Java. Developers can use JasperReports as a stand-alone reporting and analytics library server. It can use data coming from any kind of data source and produce pixel-perfect documents that can be viewed, printed, or exported in a variety of document formats including HTML, PDF, Excel, OpenOffice, and Word. Below is how to install and use the JasperReports library server on Ubuntu Linux.
How to install and use JasperReports server on Ubuntu Linux
As described above, the JasperReports library is an open-source reporting engine that is entirely written in Java. Developers can use JasperReports as a stand-alone reporting and analytics library server. Below is how to install and use it on Ubuntu Linux.
Install Java OpenJDK
Because JasperReports is written in Java, you’ll Java installed on the server to install JasperReports. The open-source Java JDK app will work perfectly with JasperReports. Below is how to install OpenJDK on Ubuntu Linux. After installing OpenJDK, you can run the commands below to view the version installed. For additional resources on installing and managing OpenJDK, read the post below. How to install OpenJDK on Ubuntu Linux
Install MariaDB
JasperReports needs a database to store its data. If you are looking for an open-source database to use with JasperReports, MariaDB should be a great place to start. Run the commands below to install MariaDB. For additional resources on installing MariaDB, read the post below. How to install MariaDB on Ubuntu Linux
Create database account
Now that the MariaDB database is installed, let’s go and create an account that we will use with JasperReports. Log on to the database console shell. Then run the SQL statement below to create an account named jasparadmin with a password. Then save and exit.
Install Tomcat server
JasperReports also needs a Java-based Web server application. Tomcat server is what you will need to use with JasperReports. Below is how to install the Tomcat server. First, create a user and group accounts to use with Tomcat. Create a Tomcat account home directory, then download and extract Tomcat content into the directory. Next, change the ownership of the Tomcat’s directory to be owned by the tomcat user account. Create a systemd service config for Tomcat so the service can be started, stop, and reloaded on demand. Copy the content below and save it into the file. Exit and save the file. Next, reload the systemd daemon and start the Tomcat service. If you run systemd with the status option, it should show Tomcat started and running.
Install JasperReports
Now that we have installed all the server requirements for JasperReports, let’s go and download JasperReports files and configure them. Change as a Tomcat user. Then download the latest version of JasperReports. Unzip the downloaded file. After that, run the command below to copy the MySQL properties file to create a default master properties file. Run the commands below to open the newly created file. Then edit the highlighted lines to include the database user account created above. Save and exit. Nest, run the commands below to install JasperReports. You should see a successful build at the end of the output file. If not, make sure you follow the steps above correctly. Restart the Tomcat service after all the changes above.
Access JasperReports portal
At this point, all is set and JasperReports is ready. Open your web browser and browser to the server’s hostname or IP address followed by port number 8080 with uri /jasperserver. You should see the JasperReports portal. Use the account below to log in:
Username: jasperadmin Password: jasperadmin
Configure JasperReports to use a proxy
The most efficient way to use JasperReports is to set up a reverse proxy server. Below are two ports you can read and learn how to use JasperReports with a reverse proxy.
How to set up a reverse proxy with Nginx How to set up a reverse proxy with Apache
A good reverse proxy configuration file should look similar to the one below. That should do it! Conclusion: This post showed you how to install and use JasperReports on Ubuntu Linux. If you find any error above or have something to add, please use the comment form below.