Raspberry Pi & Tomcat

1. JDK für ARM-Architektur downloaden
Download

2. SSH-Verbindung aufbauen und die Datei z.B. via WinSCP auf die Pi kopieren

3. /opt/ Rechte verändern (Benutzername == pi)
sudo chown pi:pi /opt/

4. JDK nach /opt/ kopieren und entpacken
tar xvzf ~/jdk*.tar.gz
rm ~/jdk*.tar.gz

5. Tomcat downloaden und entpacken
wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/tomcat/tomcat-7/v7.0.42/bin/apache-tomcat-7.0.42.tar.gz
tar xvzf /opt/apache-tomcat-x.x.x.tar.gz

6. tomcat-users.xml Benutzer einrichten
vi /opt/apache-tomcat-7.0.42/conf/tomcat-users.xml
<user username=“username“ password=“pwd“ roles=“manager-gui“/>

7. setenv.sh erstellen und ausführbar machen
vi /opt/apache-tomcat-7.0.42/bin/setenv.sh

JAVA_HOME=“/opt/jdk1.8.0″
export JAVA_HOME
JAVA_OPTS=“-Xmx128m -Xms128m -Djava.awt.headless=true“
export JAVA_OPTS
CATALINA_HOME=“/opt/apache-tomcat-7.0.42″
export CATALINA_HOME
CATALINA_BASE=“/opt/apache-tomcat-7.0.42″
export CATALINA_BASE

„Headless mode is a system configuration in which the display device, keyboard, or mouse is lacking. Sounds unexpected, but actually you can perform different operations in this mode, even with graphic data.“ [oracle.com]

chmod +x /opt/apache-tomcat-7.0.42/bin/setenv.sh 

8. Tomcat starten
./catalina.sh start

9. Autostart-Script für Tomcat erstellen
sudo vi /etc/init.d/tomcat

#! /bin/sh
### BEGIN INIT INFO
# Provides: Was macht das Skript?
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Kurze Beschreibung
# Description: Längere Bechreibung
### END INIT INFO
# Author: Aaron Kreis

# Aktionen
export JAVA_HOME=/opt/jdk1.8.0
export CATALINA_HOME=/opt/apache-tomcat-7.0.42

case „$1“ in
start)
sudo sh $CATALINA_HOME/bin/startup.sh
;;
stop)
sudo sh $CATALINA_HOME/bin/shutdown.sh
;;
restart)
sudo sh $CATALINA_HOME/bin/shutdown.sh
sudo sh $CATALINA_HOME/bin/startup.sh
;;
esac

exit 0

10. Dateirechte setzen
sudo chmod 755 /etc/init.d/tomcat

11. Runtime Eintrag
sudo update-rc.d tomcat defaults

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert

Diese Website verwendet Akismet, um Spam zu reduzieren. Erfahre mehr darüber, wie deine Kommentardaten verarbeitet werden.