Files
syno-scripts/Bash/ALL SYSTEM/TESTING/Full_install_ALLFRESCO.sh
T

110 lines
3.4 KiB
Bash
Executable File

#!/bin/bash
# Überprüfung des Betriebssystems
function check_os() {
if [ -f /etc/redhat-release ]; then
echo "Red Hat Derivat erkannt"
OS="redhat"
elif [ -f /etc/debian_version ]; then
echo "Debian/Ubuntu erkannt"
OS="debian"
else
echo "Betriebssystem nicht unterstützt"
exit 1
fi
}
# Automatische Ermittlung von Systeminformationen
function get_system_info() {
HOSTNAME=$(hostname)
IP_ADDR=$(hostname -I | awk '{print $1}')
CPU_CORES=$(nproc)
TOTAL_MEM=$(grep MemTotal /proc/meminfo | awk '{print $2}')
echo "Systeminformationen:"
echo "Hostname: $HOSTNAME"
echo "IP-Adresse: $IP_ADDR"
echo "CPU-Kerne: $CPU_CORES"
echo "Speicher (kB): $TOTAL_MEM"
}
# Installation der notwendigen Pakete auf Debian/Ubuntu
function install_debian_dependencies() {
echo "Installiere Abhängigkeiten auf Debian/Ubuntu..."
sudo apt update
sudo apt install -y openjdk-11-jdk postgresql postgresql-contrib libreoffice curl wget unzip
}
# Installation der notwendigen Pakete auf Red Hat Derivaten
function install_redhat_dependencies() {
echo "Installiere Abhängigkeiten auf Red Hat..."
sudo yum update -y
sudo yum install -y java-11-openjdk postgresql-server postgresql-contrib libreoffice curl wget unzip
}
# Alfresco herunterladen
function download_alfresco() {
echo "Lade Alfresco herunter..."
wget https://download.alfresco.com/cloudfront/release/community/202210-GA-build-411/alfresco-content-services-community-distribution-202210.zip -O alfresco.zip
#wget https://nexus.alfresco.com/nexus/service/local/repositories/releases/content/org/alfresco/alfresco-content-services-community-distribution/23.1.0/alfresco-content-services-community-distribution-23.1.0.zip -O alfresco.zip
unzip alfresco.zip -d /opt/alfresco
chmod -R 755 /opt/alfresco
}
# Datenbank konfigurieren (PostgreSQL)
function configure_database() {
echo "Konfiguriere PostgreSQL..."
sudo postgresql-setup initdb
sudo systemctl start postgresql
sudo systemctl enable postgresql
sudo -u postgres psql -c "CREATE USER alfresco WITH PASSWORD 'alfresco';"
sudo -u postgres psql -c "CREATE DATABASE alfresco WITH OWNER alfresco;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE alfresco TO alfresco;"
}
# Alfresco konfigurieren
function configure_alfresco() {
echo "Konfiguriere Alfresco..."
ALFRESCO_GLOBAL_PROPERTIES="/opt/alfresco/web-server/shared/classes/alfresco-global.properties"
cp /opt/alfresco/web-server/shared/classes/alfresco-global.properties.sample $ALFRESCO_GLOBAL_PROPERTIES
cat <<EOL >> $ALFRESCO_GLOBAL_PROPERTIES
db.driver=org.postgresql.Driver
db.username=alfresco
db.password=alfresco
db.url=jdbc:postgresql://localhost:5432/alfresco
alfresco.host=$IP_ADDR
alfresco.port=8080
share.host=$IP_ADDR
share.port=8080
index.subsystem.name=solr6
EOL
}
# Alfresco Dienst starten
function start_alfresco() {
echo "Starte Alfresco..."
/opt/alfresco/alfresco.sh start
}
# Hauptfunktion zur Installation und Konfiguration von Alfresco
function install_alfresco() {
check_os
get_system_info
if [ "$OS" == "debian" ]; then
install_debian_dependencies
elif [ "$OS" == "redhat" ]; then
install_redhat_dependencies
fi
download_alfresco
configure_database
configure_alfresco
start_alfresco
echo "Alfresco Installation und Konfiguration abgeschlossen!"
}
# Skript starten
install_alfresco