JasperReports is a powerful reporting tool that helps you generate dynamic reports from various data sources. In this guide, we will walk you through the installation of JasperReports Server on Ubuntu 22.04 and configure it to run behind an Nginx proxy. Whether you are deploying it on a local server or using a Windows VPS UK, this tutorial will cover all the necessary steps.
Step 1: Update Your System
Before installing JasperReports, ensure your system is up to date. Run the following commands:
sudo apt update && sudo apt upgrade -y
Keeping your system updated is crucial for security and performance, whether you're setting it up locally or on a VPS Windows Servers platform.
Step 2: Install Java
JasperReports requires Java to run. Install OpenJDK 11 using the following command:
sudo apt install openjdk-11-jdk -y
After installation, verify the Java installation:
java -version
Step 3: Install JasperReports Server
Download the latest JasperReports Server Community Edition from the Jaspersoft Community website. Use the following commands to download and extract it:
cd /opt
sudo wget https://sourceforge.net/projects/jasperreportsserver/files/JasperReportsServer/7.8.0/jasperreports-server-7.8.0-bin.zip
sudo apt install unzip -y
sudo unzip jasperreports-server-7.8.0-bin.zip
Move the extracted folder to a more accessible location:
sudo mv jasperreports-server-7.8.0 jasperreports
Step 4: Configure JasperReports Server
Navigate to the JasperReports directory:
cd /opt/jasperreports
Run the installation script:
sudo ./js-install.sh
Follow the on-screen instructions to complete the installation process.
Step 5: Install Nginx
Nginx will be used as a reverse proxy to forward requests to the JasperReports server. Install Nginx with the following command:
sudo apt install nginx -y
After installation, start and enable the Nginx service:
sudo systemctl start nginx
sudo systemctl enable nginx
Step 6: Configure Nginx as a Reverse Proxy
Create a new Nginx configuration file for JasperReports:
sudo nano /etc/nginx/sites-available/jasperreports
Add the following configuration, replacing your_domain.com
with your actual domain:
server {
listen 80;
server_name your_domain.com;
location / {
proxy_pass http://localhost:8080; # Default port for JasperReports
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Save and exit the file, then create a symbolic link to enable the configuration:
sudo ln -s /etc/nginx/sites-available/jasperreports /etc/nginx/sites-enabled/
Test the Nginx configuration for syntax errors:
sudo nginx -t
If the test is successful, restart Nginx to apply the changes:
sudo systemctl restart nginx
Step 7: Secure Nginx with Let's Encrypt SSL
To secure your JasperReports installation with SSL, install Certbot:
sudo apt install certbot python3-certbot-nginx -y
Run Certbot to obtain and install the SSL certificate:
sudo certbot --nginx -d your_domain.com
Certbot will automatically configure SSL for your JasperReports instance, ensuring secure access to the platform, whether it is hosted locally or on a Windows VPS hosting UK.
Step 8: Access JasperReports Server
Open your web browser and navigate to:
http://your_domain.com
You should see the JasperReports Server login page. Log in with the credentials you set during installation.