#!/bin/bash set -e # Variables POSTGRES_USER=alfresco POSTGRES_PASSWORD=alfresco POSTGRES_DB=alfresco JAVA_HOME=/usr/lib/jvm/java-17-openjdk TOMCAT_VERSION=10.1.26 TOMCAT_USER=rheluser TOMCAT_GROUP=rheluser TOMCAT_HOME=/home/rheluser/tomcat ACTIVEMQ_VERSION=5.18.5 ACTIVEMQ_USER=rheluser ACTIVEMQ_GROUP=rheluser ACTIVEMQ_HOME=/home/rheluser/activemq SOLR_VERSION=2.0.9.1 SOLR_USER=rheluser SOLR_GROUP=rheluser SOLR_HOME=/home/rheluser/alfresco-search-services TRANSFORM_JAR=alfresco-transform-core-aio-5.1.0.jar TRANSFORM_USER=rheluser TRANSFORM_GROUP=rheluser TRANSFORM_HOME=/home/rheluser/transform NODEJS_SETUP_URL="/root/RHEL_full_install_alfresco_addon.sh" CONTENT_APP_REPO=https://github.com/Alfresco/alfresco-content-app.git CONTENT_APP_VERSION=4.4.1 NGINX_CONF_PATH=/etc/nginx/conf.d/alfresco-content-app.conf NGINX_ROOT=/var/www/alfresco-content-app # Helper function to print and execute commands execute() { echo "$ $@" "$@" } # Anlegen des Users und Gruppe user_add_and_group(){ execute sudo groupadd rheluser execute sudo useradd -m -g rheluser rheluser } # Update and upgrade the system 00_update_system() { echo "Updating system..." execute sudo dnf update -y } # Install PostgreSQL and configure database 01_install_postgresql() { echo "Installing PostgreSQL..." execute sudo dnf install -y postgresql-server postgresql-contrib echo "Initializing PostgreSQL database..." execute sudo postgresql-setup --initdb echo "Configuring PostgreSQL..." execute sudo sed -i 's/local\s\+all\s\+postgres\s\+peer/local all postgres trust/' /var/lib/pgsql/data/pg_hba.conf execute sudo sed -i 's/local\s\+all\s\+all\s\+peer/local all all md5/' /var/lib/pgsql/data/pg_hba.conf echo "Starting PostgreSQL service..." execute sudo systemctl start postgresql execute sudo systemctl enable postgresql echo "Configuring Alfresco database..." execute sudo -u postgres psql -c "CREATE USER ${POSTGRES_USER} WITH PASSWORD '$POSTGRES_PASSWORD';" execute sudo -u postgres psql -c "CREATE DATABASE ${POSTGRES_DB} OWNER ${POSTGRES_USER} ENCODING 'UTF8';" execute sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_DB} TO ${POSTGRES_USER};" } # Install Java JDK 17 02_install_java() { echo "Installing Java JDK 17..." execute sudo dnf install -y java-17-openjdk echo "Checking Java version..." execute java -version } # Install Apache Tomcat 03_install_tomcat() { echo "Downloading and installing Apache Tomcat..." execute wget https://dlcdn.apache.org/tomcat/tomcat-10/v$TOMCAT_VERSION/bin/apache-tomcat-$TOMCAT_VERSION.tar.gz -O /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz execute sudo mkdir -p $TOMCAT_HOME execute sudo tar xzvf /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz -C $TOMCAT_HOME --strip-components=1 echo "Setting permissions for Tomcat directories..." execute sudo chown -R $TOMCAT_USER:$TOMCAT_GROUP $TOMCAT_HOME execute sudo chmod -R u+x $TOMCAT_HOME/bin echo "Creating Tomcat systemd service file..." cat <