#!/bin/bash set -e # Detect the OS if [ -f /etc/redhat-release ]; then OS="RHEL" elif [ -f /etc/lsb-release ]; then OS="Ubuntu" else echo "Unsupported OS" exit 1 fi #MAIN download_files() { # Array von URLs URLS=( "https://nexus.alfresco.com/nexus/repository/releases/org/alfresco/alfresco-content-services-community-distribution/23.2.1/alfresco-content-services-community-distribution-23.2.1.zip" "https://nexus.alfresco.com/nexus/repository/releases/org/alfresco/alfresco-search-services/2.0.9.1/alfresco-search-services-2.0.9.1.zip" "https://nexus.alfresco.com/nexus/repository/releases/org/alfresco/alfresco-transform-core-aio/5.1.0/alfresco-transform-core-aio-5.1.0.jar" ) # Verzeichnis, in das die Dateien heruntergeladen werden sollen DEST_DIR="/tmp/downloads" # Erstelle das Verzeichnis, falls es nicht existiert mkdir -p "$DEST_DIR" # Herunterladen der Dateien for URL in "${URLS[@]}"; do echo "Downloading $URL..." # Extrahiere den Dateinamen aus der URL FILE_NAME=$(basename "$URL") # Lade die Datei herunter und speichere sie im Zielverzeichnis curl -L "$URL" -o "$DEST_DIR/$FILE_NAME" if [ $? -eq 0 ]; then echo "Successfully downloaded $FILE_NAME" else echo "Failed to download $FILE_NAME" fi done } # Functions for RHEL install_postgresql_rhel() { echo "Updating package list..." sudo yum update -y echo "Installing PostgreSQL 16..." #sudo yum install -y https://download.postgresql.org/pub/repos/yum/16/redhat/rhel-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo dnf -qy module disable postgresql sudo yum install -y postgresql16-server postgresql16-contrib echo "Initializing PostgreSQL database..." sudo /usr/pgsql-16/bin/postgresql-16-setup initdb echo "Enable local connections" sudo sed -i 's/peer/trust/' /var/lib/pgsql/16/data/pg_hba.conf sudo sed -i 's/ident/md5/' /var/lib/pgsql/16/data/pg_hba.conf echo "Starting PostgreSQL service..." sudo systemctl start postgresql-16 echo "Configuring Alfresco database..." sudo -u postgres psql -c "CREATE USER alfresco WITH PASSWORD 'alfresco';" sudo -u postgres psql -c "CREATE DATABASE alfresco OWNER alfresco ENCODING 'UTF8';" sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE alfresco TO alfresco;" echo "Stopping PostgreSQL service..." sudo systemctl stop postgresql-16 echo "Enabling PostgreSQL to start on boot..." sudo systemctl enable postgresql-16 echo "PostgreSQL installation and setup completed successfully!" } install_java_rhel() { echo "Updating package list..." sudo dnf update -y echo "Installing the latest Java JDK and development tools..." # Install Java JDK and development tools (java-17-openjdk and java-17-openjdk-devel) sudo dnf install -y java-17-openjdk java-17-openjdk-devel echo "Setting Java as the default version..." # Update alternatives to ensure the correct Java version is used sudo alternatives --install /usr/bin/java java /usr/lib/jvm/java-17-openjdk-*/bin/java 1 sudo alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-*/bin/javac 1 echo "Checking the installed Java version..." java -version # Automatically select the correct version echo "Selecting the Java alternative..." # Hier die Nummer der gewünschten Java-Version setzen. Ersetze "1" durch die entsprechende Nummer. echo "1" | sudo alternatives --config java echo "Selecting the javac alternative..." # Hier die Nummer der gewünschten javac-Version setzen. Ersetze "1" durch die entsprechende Nummer. echo "1" | sudo alternatives --config javac echo "Verifying Java installation..." java -version javac -version echo "Java JDK installation and setup completed successfully!" } install_tomcat_rhel() { # Tomcat installation for RHEL echo "Updating package list..." sudo yum update -y echo "Installing Tomcat 10..." sudo yum install -y tomcat tomcat-webapps tomcat-admin-webapps echo "Starting Tomcat service..." sudo systemctl start tomcat echo "Enabling Tomcat to start on boot..." sudo systemctl enable tomcat echo "Tomcat installation and setup completed successfully!" } install_activemq_rhel() { echo "Updating package list..." sudo yum update -y echo "Downloading ActiveMQ..." wget https://dlcdn.apache.org/activemq/6.1.3/apache-activemq-6.1.3-bin.tar.gz -O /tmp/apache-activemq-6.1.3-bin.tar.gz echo "Extracting ActiveMQ..." sudo mkdir /opt/activemq sudo tar xzvf /tmp/apache-activemq-6.1.3-bin.tar.gz -C /opt/activemq --strip-components=1 echo "Setting permissions for ActiveMQ directories..." sudo useradd activemq sudo chown -R activemq:activemq /opt/activemq sudo chmod -R 755 /opt/activemq echo "Creating ActiveMQ systemd service file..." cat <