sudo -u tomcat path-to-zflow-app/WEB-INF/update_system.sh path-to-zflow-app /tmp/zflow-update-archive
Author Archives: clabgo
ZFlow on SUSE Linux
Target Platform
SUSE Linux Enterprise Server (SLES 15+)
Software Stack
JDK 17.0.13 + Apache Tomcat 9.0.96 + MySQL 8.0.40
Overview
Purpose
This guide provides step-by-step instructions for deploying Java WAR files on SUSE Linux Enterprise Server using: – JDK 17.0.13 (OpenJDK Temurin) – Apache Tomcat 9.0.96 – MySQL 8.0.40
Architecture
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Client Web │ │ Apache │ │ MySQL │
│ Browser │◄► │ Tomcat 9.0 │◄ ►│ 8.0.40 │
│ │ │ (JDK 17) │ │ │
└─────────────────┘ └─────────────────┘ └─────────────── ─┘
Supported Platforms
- SUSE Linux Enterprise Server 15 SP6+
- SUSE Linux Enterprise Server 15 SP7
- openSUSE Leap 15.4+
Prerequisites
Hardware Requirements
| Component | Minimum | Recommended |
| CPU | 2 cores | 4+ cores |
| RAM | 4 GB | 8+ GB |
| Storage | 20 GB | 50+ GB |
| Network | 100 Mbps | 1 Gbps |
System Requirements
- SUSE Linux Enterprise Server 15 or later
- Root or sudo access
- Active internet connection
- Basic Linux command line knowledge
Network Ports
| Port | Service | Description |
| 8080 | Tomcat HTTP | Web application access |
| 3306 | MySQL | Database access (internal) |
| 22 | SSH | Remote administration |
System Preparation
Update System
# Update package repository
sudo zypper refresh
# Update all packages
sudo zypper update -y
# Install essential tools
sudo zypper install -y curl wget unzip tar vim net-tools
Create Directory Structure
Create installation directories
sudo mkdir -p /opt/{jdk-17,tomcat,mysql-8.0.40}
sudo mkdir -p /var/lib/mysql-8.0.40
sudo mkdir -p /opt/backups
sudo mkdir -p /opt/scripts
System Information Verification
# Check OS version
cat /etc/os-release
Expected Output:
NAME=”SLES”
VERSION=”15-SP7″
ID=”sles”
# Check available resources
df -h
free -h
JDK 17 Installation
Download JDK 17
Navigate to the temporary directory
cd /tmp
Download OpenJDK 17 (Temurin)
wget https://github.com/adoptium/temurin17-binaries/releases/download/jdk-17.0.13%2B11/OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz
Verify download
ls -la OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz
Install JDK 17
# Extract to /opt
sudo tar -xzf OpenJDK17U-jdk_x64_linux_hotspot_17.0.13_11.tar.gz -C /opt/
Rename for easier access
sudo mv /opt/jdk-17.0.13+11 /opt/jdk-17
Set ownership
sudo chown -R root:root /opt/jdk-17
Set permissions
sudo chmod -R 755 /opt/jdk-17
Verify JDK Installation
Test Java installation
/opt/jdk-17/bin/java -version
/opt/jdk-17/bin/javac -version
Expected Output:
openjdk version “17.0.13” 2024-10-15
OpenJDK Runtime Environment Temurin-17.0.13+11 (build 17.0.13+11)
OpenJDK 64-Bit Server VM Temurin-17.0.13+11 (build 17.0.13+11, mixed mode, sharing)
MySQL 8.0.40 Installation
Repository RPM option
Download the MySQL Repository RPM
Replace
sles15with your version (e.g.,sles12) if needed.
Install the Repository Package
Enable Desired MySQL Version (Optional)
To check available MySQL versions:
To enable a specific version (e.g., MySQL 8.0):
Install MySQL Server
Start and Enable the MySQL Service
Secure the Installation
This will prompt you to set a root password and remove insecure defaults.
Manual Download Option
Download MySQL 8.0.40 binary
cd /tmp
wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.40-linux-glibc2.28-x86_64.tar.xz
Verify download
ls -la mysql-8.0.40-linux-glibc2.28-x86_64.tar.xz
Install MySQL 8.0.40
Extract MySQL
sudo tar -xJf mysql-8.0.40-linux-glibc2.28-x86_64.tar.xz -C /opt/
Rename directory
sudo mv /opt/mysql-8.0.40-linux-glibc2.28-x86_64 /opt/mysql-8.0.40
Create MySQL user
sudo useradd -r -s /bin/false mysql
Set ownership
sudo chown -R mysql:mysql /opt/mysql-8.0.40
sudo chown -R mysql:mysql /var/lib/mysql-8.0.40
Initialize MySQL Database
Initialize MySQL data directory
sudo /opt/mysql-8.0.40/bin/mysqld –initialize-insecure –user=mysql –basedir=/opt/mysql-8.0.40 –datadir=/var/lib/mysql-8.0.40
Create MySQL Configuration
# Create MySQL configuration file
sudo tee /etc/mysql-8.0.40.cnf << ‘EOF’
[mysqld]
basedir=/opt/mysql-8.0.40
datadir=/var/lib/mysql-8.0.40
socket=/var/lib/mysql-8.0.40/mysql.sock
port=3306
user=mysql
bind-address=127.0.0.1
server-id=1
Security and Performance
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_DATE,NO_ZERO_IN_DATE,ERROR_FOR_DIVISION_BY_ZERO
max_connections=200
innodb_buffer_pool_size=512M
query_cache_size=64M
Character Set
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci
[mysql]
socket=/var/lib/mysql-8.0.40/mysql.sock
default-character-set=utf8mb4
[client]
socket=/var/lib/mysql-8.0.40/mysql.sock
default-character-set=utf8mb4
EOF
Create MySQL Service
Create systemd service for MySQL 8.0.40
sudo tee /etc/systemd/system/mysql-8.0.40.service << ‘EOF’
[Unit]
Description=MySQL 8.0.40 Database Server
After=network.target
[Service]
Type=notify
User=mysql
Group=mysql
ExecStart=/opt/mysql-8.0.40/bin/mysqld –defaults-file=/etc/mysql-8.0.40.cnf
TimeoutSec=600
Restart=on-failure
RestartSec=30
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Start MySQL Service
Reload systemd and start MySQL
sudo systemctl daemon-reload
sudo systemctl start mysql-8.0.40
sudo systemctl enable mysql-8.0.40
Verify MySQL is running
sudo systemctl status mysql-8.0.40
Verify MySQL Installation
# Check MySQL version
/opt/mysql-8.0.40/bin/mysql –version
Test connection
/opt/mysql-8.0.40/bin/mysql –socket=/var/lib/mysql-8.0.40/mysql.sock -u root -e “SELECT VERSION();”
Expected Output:
/opt/mysql-8.0.40/bin/mysql Ver 8.0.40 for Linux on x86_64 (MySQL Community Server – GPL)
Apache Tomcat 9.0 Installation
Download Tomcat 9.0.96
# Download Tomcat 9.0.96
cd /tmp
wget https://archive.apache.org/dist/tomcat/tomcat-9/v9.0.96/bin/apache-tomcat-9.0.96.tar.gz
# Verify download
ls -la apache-tomcat-9.0.96.tar.gz
Install Tomcat 9.0
# Extract Tomcat
sudo tar -xzf apache-tomcat-9.0.96.tar.gz -C /opt/
# Rename for consistency
sudo mv /opt/apache-tomcat-9.0.96 /opt/tomcat
# Create tomcat user and group
sudo groupadd tomcat
sudo useradd -r -s /bin/false tomcat
# Set ownership to tomcat
sudo chown -R tomcat:tomcat /opt/tomcat
# Set execute permissions on scripts
sudo chmod +x /opt/tomcat/bin/*.sh
Create Tomcat Service
# Create systemd service for Tomcat
sudo tee /etc/systemd/system/tomcat.service << ‘EOF’
[Unit] Description=Apache Tomcat 9.0 Web Server (JDK 17) After=network.target mysql-8.0.40.service [Service] Type=forking User=tomcat Group=tomcat # Environment Variables Environment=JAVA_HOME=/opt/jdk-17 Environment=CATALINA_HOME=/opt/tomcat Environment=CATALINA_BASE=/opt/tomcat Environment=CATALINA_TMPDIR=/opt/tomcat/temp # JVM Options Environment="CATALINA_OPTS=-Xms512m -Xmx4g -XX:+UseG1GC -XX:MaxGCPauseMillis=200" # Security options for JDK 17 Environment="JDK_JAVA_OPTIONS=--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.rmi/sun.rmi.transport=ALL-UNNAMED" # Service Control ExecStart=/opt/tomcat/bin/startup.sh ExecStop=/opt/tomcat/bin/shutdown.sh SuccessExitStatus=143 Restart=on-failure RestartSec=30 # Security PrivateTmp=true NoNewPrivileges=true [Install] WantedBy=multi-user.target
EOF
Environment Configuration
System Environment Variables
# Create environment configuration
sudo tee /etc/environment << ‘EOF’
JAVA_HOME=/opt/jdk-17
CATALINA_HOME=/opt/tomcat
CATALINA_BASE=/opt/tomcat
MYSQL_HOME=/opt/mysql-8.0.40
PATH=/opt/jdk-17/bin:/opt/mysql-8.0.40/bin:/opt/tomcat/bin:$PATH
EOF
Apply environment variables
source /etc/environment
User Profile Configuration
Add to .bashrc for easy access
echo ‘export JAVA_HOME=/opt/jdk-17’ >> ~/.bashrc
echo ‘export CATALINA_HOME=/opt/tomcat’ >> ~/.bashrc
echo ‘export MYSQL_HOME=/opt/mysql-8.0.40’ >> ~/.bashrc
echo ‘export PATH=/opt/jdk-17/bin:/opt/mysql-8.0.40/bin:/opt/tomcat/bin:$PATH’ >> ~/.bashrc
Apply changes
source ~/.bashrc
Service Configuration
Start All Services
Start services in correct order
sudo systemctl start mysql-8.0.40
sudo systemctl start tomcat
Enable services for auto-start
sudo systemctl enable mysql-8.0.40
sudo systemctl enable tomcat
Verify all services are running
sudo systemctl status mysql-8.0.40 tomcat
Firewall Configuration
Configure firewall for web access
sudo firewall-cmd –permanent –add-port=8080/tcp
sudo firewall-cmd –permanent –add-port=8443/tcp
sudo firewall-cmd –reload
Verify firewall rules
sudo firewall-cmd –list-ports