在Centos7.9/Ubuntu20.04下安装JasperReports报表工具

实验环境:

Centos7如下

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@localhost ~]# uname -r
3.10.0-1160.71.1.el7.x86_64

Ubuntu20.04如下

alex@ubuntu20:~$ lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:Ubuntu 20.04.6 LTS
Release:20.04
Codename:focal
alex@ubuntu20:~$ uname -r
5.4.0-155-generic
alex@ubuntu20:~$ arch
x86_64

安装

下载安装包

用本地电脑去JasperReports官网下载一个最新的版本文件,网络要FQ,可能需要注册登录

文件名 TIB_js-jrs-cp_8.2.0_linux_x86_64.run

https://community.jaspersoft.com/project/jasperreports-server/releases

下面这个网址不需要登录注册

https://sourceforge.net/projects/jasperserver/files/JasperServer/

还有一个zip格式的,也可以下载,不过需要自己部署java和tomcat环境还需要安装MySQL数据库,跟部署tomcat的web环境一样,稍微麻烦点

也可以用这条命令下载比不过地址和版本可能会变化失效

wget https://sourceforge.net/projects/jasperserver/files/JasperServer/JasperReports%20Server%20Community%20edition%208.0.0/TIB_js-jrs-cp_8.0.0_bin.zip/download -O jasperreports_8.0.0.zip

谷歌浏览器的安装

没有图形界面的情况下,都需要安装谷歌

Centos7如下

yum install lrzsz -y

把文件上传到centos下

添加谷歌的yum源

[root@localhost ~]# cat /etc/yum.repos.d/google-chrome.repo 
[google-chrome]
name=google-chrome
baseurl=https://dl.google.com/linux/chrome/rpm/stable/x86_64
enabled=1
gpgcheck=1
gpgkey=https://dl.google.com/linux/linux_signing_key.pub

安装谷歌浏览器

yum install google-chrome-stable -y

Ubuntu20.04如下

安装文件传输工具,把run文件拖进去

sudo apt install lrzsz -y

安装谷歌浏览器

wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt update
sudo apt install google-chrome-stable

正式安装

增加执行权限

sudo chmod +x TIB_js-jrs-cp_8.2.0_linux_x86_64.run 
./TIB_js-jrs-cp_8.2.0_linux_x86_64.run

接着一直按回车,不要修改任何配置,安装时间可能会要几分钟,看你的配置,到100%的时候没有动也不要慌,可以用top看到后台java程序还在占用很高的CPU和内存,不用管它安装结束会自动退出的,不要CTRL +C结束它就行了。

Centos如下

安装完毕可以去防火墙开放端口,默认会安装到/opt/jasperreports-server-cp-8.2.0/目录下

cd /opt/jasperreports-server-cp-8.2.0/
[root@localhost jasperreports-server-cp-8.2.0]# ls
apache-ant     common            postgresql      TIB_js-jrs-ce_8.2.0_license_installer.txt
apache-tomcat  ctlscript.sh      properties.ini  TIB_js-jrs-ce_8.2.0_license.txt
apps           installation.log  samples         uninstall
buildomatic    java              scripts         uninstall.dat

防火墙开放端口

systemctl start firewalld
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload

Ubuntu20.04如下

安装目录默认在家目录下/home/alex/jasperreports-server-cp-8.2.0

alex@ubuntu20:~/jasperreports-server-cp-8.2.0$ ls
apache-ant     common            postgresql      TIB_js-jrs-ce_8.2.0_license_installer.txt
apache-tomcat  ctlscript.sh      properties.ini  TIB_js-jrs-ce_8.2.0_license.txt
apps           installation.log  samples         uninstall
buildomatic    java              scripts         uninstall.dat
alex@ubuntu20:~/jasperreports-server-cp-8.2.0$

关闭防火墙

sudo iptables -F

浏览器登录

输入centos或者Ubuntu的IP地址端口号加上后面的

http://192.168.191.129:8088/jasperserver/login.html

登陆账号

jasperadmin

密码

jasperadmin


jasper.jpg启动和重启以及停止

JasperReports的安装目录下,运行如下命令

cd /opt/jasperreports-server-cp-8.2.0/
./ctlscript.sh  start
./ctlscript.sh  restart
./ctlscript.sh  stop

卸载应该是

./uninstall

修改端口号

vi apache-tomcat/conf/server.xml

输入/8080按回车定位到默认端口号,然后改成8088,保存退出

端口修改.jpg接着需要重启一下

./ctlscript.sh  restart

等待一段时间,再去浏览器输入新的端口号就可以了

最后编辑于:2023/08/09作者: admin

发表评论