Skip to content

TransiTime Prerequisite installation

Claudiu Bogdan Minea edited this page Jul 23, 2022 · 12 revisions

Tested working dependency versions:

  • Tomcat 8.5.73
  • Java OpenJDK 64-Bit Server VM 1.8.0_292
  • MySQL Server 5.7.36

Prerequisite installation

sudo apt-get update
sudo apt install openjdk-8-jdk maven lamp-server^ phpmyadmin git
sudo update-java-alternatives -l
sudo update-java-alternatives -s java-1.8.0-openjdk-amd64
java -version

Environment preparation

sudo groupadd tomcat
sudo useradd -s /bin/false -g tomcat -d /opt/tomcat tomcat
cd /tmp
curl -O https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.81/bin/apache-tomcat-8.5.81.tar.gz
sudo mkdir /opt/tomcat
sudo tar xzvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1
cd /opt/tomcat
sudo chgrp -R tomcat /opt/tomcat
sudo chmod -R g+r conf
sudo chmod g+x conf
sudo chown -R tomcat webapps/ work/ temp/ logs/
sudo nano /etc/systemd/system/tomcat.service

Add this to /etc/systemd/system/tomcat.service

[Unit]
Description=Apache Tomcat Web Application Container
After=network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/opt/tomcat/bin/shutdown.sh

User=tomcat
Group=tomcat
UMask=0007
RestartSec=10
Restart=always

[Install]
WantedBy=multi-user.target

Exit and save with CTRL+X, followed by Y to continue in shell. Now execute mysql -u root and run:

CREATE DATABASE `DB_NAME`;
CREATE USER DB_USER@localhost IDENTIFIED BY 'DB_PASS';
GRANT ALL PRIVILEGES ON DB_NAME.* TO 'DB_USER'@'localhost';
FLUSH PRIVILEGES;

Exit with CTRL+D to continue in shell. You need to create databases for the secondary agencies and grant the user privileges for them.

Running Tomcat, setting to run on boot and allowing port access through the firewall

sudo systemctl daemon-reload
sudo systemctl start tomcat
sudo systemctl status tomcat
sudo systemctl enable tomcat
sudo ufw allow 8080
Clone this wiki locally