openEuler Linux deploys FineReport
deployment environment
environment | Version |
---|---|
openEuler Linux | 22.03 |
MySQL | 8.0.33 |
FineReport | 11.0 |
Environmental preparation
Upgrade system kernel and software
yum -y update
reboot
Install common tool software
yum -y install vim tar net-tools
Install MySQL8
Add the MySQL Yum repository to the system's repository list
sudo yum -y install https://repo.mysql.com//mysql80-community-release-el8-5.noarch.rpm
Verify that the correct subrepositories are enabled and disabled by running the following commands and checking their output
sudo yum repolist enabled | grep mysql
Install MySQL with the following command
sudo yum -y install mysql-community-server
Start the MySQL server
Start the MySQL server with the following command:
sudo systemctl start mysqld
You can check the status of the MySQL server with the following command:
sudo systemctl status mysqld
Start the self-starting MySQL server with the following command:
sudo systemctl enable mysqld
On initial server startup, assuming the server's data directory is empty, the following happens:
-
The server has been initialized.
-
SSL certificate and key files are generated in the data directory.
-
validate_password
installed and enabled. -
Created a superuser account
'root'@'localhost
. The superuser's password is set and stored in the error log file. To display it, use the following command:sudo grep 'temporary password' /var/log/mysqld.log
Change the root password as soon as possible by logging in with the generated temporary password and setting a custom password for the superuser account:
mysql -uroot -p
change Password
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lihaozhe!!@@1122';
FLUSH PRIVILEGES;
Passwords specified as hashed values are not checked because the original password value is not available for checking:
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Lihaozhe!!@@1122';
FLUSH PRIVILEGES;
update mysql.user set host = '%',plugin='mysql_native_password' where user='root';
FLUSH PRIVILEGES;
exit;
sudo systemctl restart mysqld
Firewall open ports
–zone #Scope
–add-port=1935/tcp #Add port, the format is: port/communication protocol
–permanent #Permanently effective, without this parameter, it will fail after restarting
firewall-cmd --zone=public --add-port=3306/tcp --permanent
restart firewall
firewall-cmd --reload
# 使用新密码连接
mysql -h 你自己的IP地址 -uroot -p
Create finereport external database finedb
create database finedb default character set utf8;
install finereport
Official website download
https://www.finereport.com/product/download
Upload the installation package
tomcat-linux.tar.gz
Unzip the installation package to the specified directory
/usr/local
tar -zxvf tomcat-linux.tar.gz -C /usr/local
The decompressed directory is named tomcat-linux
Set tomcat.pid file generation
Among them, the tomcat.pid file itself does not exist. After setting, it will be automatically generated when Tomcat is started.
vim /usr/local/tomcat-linux/bin/catalina.sh
# 定位文件第152行找到 PRGDIR=`dirname "$PRG"` 并在该行下追加以下内容
CATALINA_PID="/usr/local/tomcat-linux/bin/tomcat.pid"
Upload database driver
cd /usr/local/tomcat-linux/webapps/webroot/WEB-INF/lib/
ls mysql*
After deleting the MySQL5 driver, upload the MySQL8 driver
mysql-connector-j-8.0.33.jar mysql driverprotobuf-java-3.5.1.jar mysql driver dependency
rm -f mysql-connector-java-5.1.49-bin.jar
Configure environment variables
vim /etc/profile.d/my_env.sh
export JAVA_HOME=/usr/local/tomcat-linux/jdk
export CATALINA_BASE=/usr/local/tomcat-linux
export CATALINA_HOME=/usr/local/tomcat-linux
export PATH=$PATH:$JAVA_HOME/bin:$CATALINA_BASE/bin:$CATALINA_HOME/bin
source /etc/profile.d/my_env.sh
Write a startup service
cd /usr/lib/systemd/system
vim finereport.service
[Unit]
Description=finereport-server
After=network.target
[Service]
Type=forking
# 因为服务启动时,是不会读取全局变量的(/etc/profile),因此全局变量中配置的属性是读取不到的需要注意。
# 所以需要在这里配置Tomcat 启动需要的JDK,指定JDK路径
Environment="JAVA_HOME=/usr/local/tomcat-linux/jdk"
# 此文件是在第一步时配置的,如果type是后台运行,建议将此属性加上,指定pid。
PIDFile=/usr/local/tomcat-linux/bin/tomcat.pid
# 需要注意的就是下面这一行,如果路径错了,那就无法自动启动,下面会有图文解释
# 整个 ExecStart 脚本,相当于是让系统开机时自动帮你在终端输入等号后面的命令
ExecStart=/usr/local/tomcat-linux/bin/startup.sh
ExecReload=/usr/local/tomcat-linux/bin/shutdown.sh
ExecReload=/bin/kill -s HUP $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start finereport.service
systemctl enable finereport.service
Set firewall port release
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --reload
restart the system
reboot
Browser Access Test
http://server IP address:8080/webroot/decision
http://192.168.126.131:8080/webroot/decision/
If the MySQL version is 8+, it is recommended to modify the driver to: com.mysql.cj.jdbc.Driver