Installation of PicApport under Linux
We appreciate any feedback and suggestions to improve this document and the scripts contained therein.
Also we are looking for someone to help us creating an installation package incl. the correct dependencies to Java and screen etc.
The following instruction has been tested under Debian 8.5:
Step 1 of 3 Install latest JRE from Oracle
For Ubuntu:
please regard the following instructions: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04
(Important: the JRE is now valid system wide for java calls)
For Debian:
– unpack the tar.gz File form the oracle download-Site(http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html) to the /opt/ directory. (a jre1.8.0_xx should be created)
– set the Symlink under /etc/alternatives/java to /opt/jre1.8.0_XX/bin/java (for a standard installation this usually is a OpenJDK, under /usr/lib/jvm)
prompt> ln -s -f /opt/jre1 .8.0_XX /bin/java /etc/alternatives/java |
Test your Java-Installation
prompt> java -version |
If the correct runtime environment has been found the console output should loo like this for a JRE 1.8.0_92:
java version "1.8.0_xxx" ... |
We recommend to continue with your PicApport installation only if you Java environment has been successfully installed.
Step 2 of 3 PicApport-Installation
Directory Structure (recommendation)
- /opt/picapport
- picapport-headless.jar – Java program File
- StartPicApport.sh Shell-Script to start PicApport
- .picapport (the PicApport data directory)
- /etc/init.d
- picapport (Daemon script)
We recommend do perform the installation as root.
prompt> su - |
Create the picapport-Directory in the directory /opt.
prompt> mkdir /opt/picapport |
Download the picapport-headless.jar from http://www.picapport.de/photo-server-download.php and copy it to /opt/picapport
Create the PicApport data directory
prompt> mkdir /opt/picapport/ .picapport |
Create a Shell-Script with the name StartPicApport.sh in your /opt/picapport with the following content:
#!/bin/bash java -Xms512m -Xmx1024m -Duser.home= /opt/picapport -jar /opt/picapport/picapport-headless .jar |
You can download this file here: StartPicApport.sh
Make the script executable
prompt> chmod a+x /opt/picapport/StartPicApport .sh |
Create a file picapport.properties in PicApport data directory /opt/picapport/.picapport with the following content: (You’ll find the complete documentation for the parameters in the: PicApport-Server Guide)
server.port= 80 server.ssl= false user.log.access= true gui.enabled= false robot.root. 0 .id=Photos robot.root. 0 .path=/srv/photos |
You can download this file here: picapport.properties
Step 3 of 3 Create and configure the daemon (optional)
Install screen-Packet with the following command:
prompt> apt-get install screen |
Create the Daemon-Start-Script with the name picapport under under /etc/init.d:
#!/bin/bash # Filename : picapport # Version : 2.0 # Date : 20.09.2016 # Copyright : (c) 2016 Contecon Software GmbH # Description : starting script for starting PicApport as a daemon # History : 20.08.2015 - Initial version # 20.09.2016 - revised ### BEGIN INIT INFO # Provides: picapport # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 # Default-Stop: 1 # Short-Description: PicApport Server ### END INIT INFO PATH= /usr/bin : /usr/local/bin : /sbin : /bin : /usr/sbin : /usr/bin NAME=picapport DESC= "PicApport Daemon" DAEMON_ARGS= "-d -m -S $NAME bash /opt/picapport/StartPicApport.sh" case "$1" in start) start-stop-daemon -- test --start --pidfile "/var/run/$NAME.pid" -- exec /usr/bin/screen -- $DAEMON_ARGS if [ $? - eq 0 ]; then echo -n "Starting $DESC: " start-stop-daemon --start --pidfile "/var/run/$NAME.pid" -- exec /usr/bin/screen -- $DAEMON_ARGS PID=$( ps -aux | grep 'StartPicApport.sh' | grep --ignore- case 'screen' | awk '{print $2}' | head -1) echo $PID > /var/run/ $NAME.pid echo "Daemon $NAME started. To access console type: screen -R $PID.picapport" else echo -n "Daemon $NAME already running. To access console type: screen -R " cat /var/run/ $NAME.pid | awk '{print $1".picapport"}' fi ;; stop) echo -n "Stopping $DESC: " start-stop-daemon --stop −−retry=SIGTERM /30/KILL/10 --pidfile "/var/run/$NAME.pid" -- exec /usr/bin/screen -- $DAEMON_ARGS if [ $? - eq 0 ]; then echo "Daemon $NAME stopped." else echo "Daemon $NAME was not started." fi [ -e /var/run/ $NAME.pid ] && rm /var/run/ $NAME.pid ;; status) start-stop-daemon --status --pidfile "/var/run/$NAME.pid" -- exec /usr/bin/screen -- $DAEMON_ARGS if [ $? - eq 0 ]; then echo -n "Daemon $NAME is running. To access console type: screen -R " cat /var/run/ $NAME.pid | awk '{print $1".picapport"}' else echo "Daemon $NAME was not started." fi ;; *) echo "usage: /etc/init.d/picapport start|stop|status" ;; esac exit 0 |
You can download this file here: picapport
Make the Daemon executable
prompt> chmod a+x /etc/init .d /picapport |
Configure the Daemon
prompt> update-rc.d picapport defaults |
Use the Daemon
Once the Daemon has been configured it will be started automatically with your system.
The Daemon supports the following commands: (The possible output is provided in blue)
Use the command marked with green to access the console of the PicApport Server (screen)
Start the Daemon:
prompt> /etc/init .d /picapport start |
Would start /usr/bin/screen -d -m -S picapport bash /opt/picapport/StartPicApport.sh.
Starting PicApport Daemon: Daemon picapport started. To access console type: screen -R 4573.picapport
Stop the Daemon:
prompt> /etc/init .d /picapport stop |
Stopping PicApport Daemon: Daemon picapport stopped.
Get the Daemon status:
prompt> /etc/init .d /picapport status |
Daemon picapport is running. To access console type: screen -R 4722.picapport