import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';
Unix Installation
To run the application without Docker/Podman, you will need to manually install all dependencies and build the necessary components.
Note that some dependencies might not be available in the standard repositories of all Linux distributions, and may require additional steps to install.
The following guide assumes you have a basic understanding of using a command line interface in your operating system.
It should work on most Linux distributions and MacOS. For Windows, you might need to use Windows Subsystem for Linux (WSL) for certain steps. The amount of dependencies is to actually reduce overall size, ie installing LibreOffice sub components rather than full LibreOffice package.
You could theoretically use a Distrobox/Toolbox, if your Distribution has old or not all Packages. But you might just as well use the Docker Container then.
Step 1: Prerequisites
Install the following software, if not already installed:
- Java 21 or later
- Gradle 7.0 or later (included within repo so not needed on server)
- Git
- Python 3.8 (with pip)
- Make
- GCC/G++
- Automake
- Autoconf
- libtool
- pkg-config
- zlib1g-dev
- libleptonica-dev
Step 2: Clone and Build jbig2enc (Only required for certain OCR functionality)
Step 3: Install Additional Software
Next we need to install LibreOffice for conversions, tesseract for OCR, and opencv for pattern recognition functionality.
Install the following software:
- libreoffice (libreoffice-core libreoffice-common libreoffice-writer libreoffice-calc libreoffice-impress)
- python3-uno
- unoserver
- pngquant
- tesseract
- opencv-python-headless
Step 4: Grab latest Stirling-PDF Jar
The JAR can be downloaded in two versions, normal and security
Example for the "normal" version
Step 5: Move jar to desired location
You can move this file to a desired location, for example, /opt/Stirling-PDF/.
You must also move the Script folder within the Stirling-PDF repo that you have downloaded to this directory.
This folder is required for the python scripts using OpenCV.
Step 6: OCR Language Support
If you plan to use the OCR (Optical Character Recognition) functionality, you might need to install language packs for Tesseract if running non-english scanning.
.traineddata file(s) for the language(s) you need.
2. Place the .traineddata files in the Tesseract tessdata directory: /usr/share/tessdata
3. Please view tesseract install guide for more info.
**IMPORTANT:** DO NOT REMOVE EXISTING `eng.traineddata`, IT'S REQUIRED.
Step 7: Run Stirling-PDF
dbus_tmp_dir="/run/user/$(id -u)/libreoffice-dbus", you get the following error:
[Thread-7] INFO s.s.SPDF.utils.ProcessExecutor - mkdir: cannot create directory '/run/user/1501': Permission denied
To resolve this, use:
bash
mkdir temp
export DBUS_SESSION_BUS_ADDRESS="unix:path=./temp"
Step 8: Adding a Desktop Icon
This will add a modified Appstarter to your Appmenu.
location=$(pwd)/gradlew
image=$(pwd)/docs/stirling-transparent.svg
cat > ~/.local/share/applications/Stirling-PDF.desktop <<EOF
[Desktop Entry]
Name=Stirling PDF;
GenericName=Launch StirlingPDF and open its WebGUI;
Category=Office;
Exec=xdg-open http://localhost:8080 && nohup $location java -jar /opt/Stirling-PDF/Stirling-PDF-*.jar &;
Icon=$image;
Keywords=pdf;
Type=Application;
NoDisplay=false;
Terminal=true;
EOF
Note: Currently the app will run in the background until manually closed.
Optional: Changing the Host and Port
To override the default configuration, you can add the following to /.git/Stirling-PDF/configs/custom_settings.yml file:
For systemd add in the .env file (see run as service for setting environment variables):
Note: The file custom_settings.yml is created after the first application launch. To have it before that, you can create the directory and add the file yourself.
Optional: Run Stirling-PDF as a service (requires root).
First create a .env file, where you can store environment variables:
In this file you can add all variables, one variable per line, as stated in the main readme (for example SYSTEM_DEFAULTLOCALE="de-DE").
Create a new file where we store our service settings and open it with nano editor:
Paste this content, make sure to update the filename of the jar-file. Press Ctrl+S and Ctrl+X to save and exit the nano editor:
[Unit]
Description=Stirling-PDF service
After=syslog.target network.target
[Service]
SuccessExitStatus=143
User=root
Group=root
Type=simple
EnvironmentFile=/opt/Stirling-PDF/.env
WorkingDirectory=/opt/Stirling-PDF
ExecStart=/usr/bin/java -jar Stirling-PDF-0.17.2.jar
ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
Notify systemd that it has to rebuild its internal service database (you have to run this command every time you make a change in the service file):
Enable the service to tell the service to start it automatically:
See the status of the service:
Manually start/stop/restart the service:
sudo systemctl start stirlingpdf.service
sudo systemctl stop stirlingpdf.service
sudo systemctl restart stirlingpdf.service
Starting unoserver alongside Stirling PDF
To ensure that unoserver is running alongside Stirling PDF, you need to start it with the following command:
You can add this command to your startup script or systemd service file to ensure it starts automatically with Stirling PDF.
Customizing Paths in settings.yml
If the install path is different, it can be customized in settings.yml: