Initialer Import der Synology Scripts

This commit is contained in:
root
2026-08-05 08:43:57 +02:00
commit 5e32a7c411
404 changed files with 79932 additions and 0 deletions
@@ -0,0 +1,32 @@
#!/bin/bash
set -e
echo "Updating package list..."
sudo apt update
echo "Installing PostgreSQL..."
sudo apt install -y postgresql postgresql-contrib
echo "Enable local connections"
sudo sed -i 's/local\s\+all\s\+postgres\s\+peer/local all postgres trust/' /etc/postgresql/16/main/pg_hba.conf
sudo sed -i 's/local\s\+all\s\+all\s\+peer/local all all md5/' /etc/postgresql/16/main/pg_hba.conf
echo "Stopping PostgreSQL service..."
sudo systemctl stop postgresql
echo "Starting PostgreSQL service..."
sudo systemctl start postgresql
echo "Configuring Alfresco database..."
psql -U postgres -c "CREATE USER alfresco WITH PASSWORD 'alfresco';"
psql -U postgres -c "CREATE DATABASE alfresco OWNER alfresco ENCODING 'UTF8';"
psql -U postgres -c "GRANT ALL PRIVILEGES ON DATABASE alfresco TO alfresco;"
echo "Stopping PostgreSQL service..."
sudo systemctl stop postgresql
echo "Enabling PostgreSQL to start on boot..."
sudo systemctl enable postgresql
echo "PostgreSQL installation and setup completed successfully!"
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
echo "Updating package list..."
sudo apt update
echo "Installing Java JDK 17..."
sudo apt install -y openjdk-17-jdk
echo "Setting Java 17 as the default Java version..."
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-17-openjdk-amd64/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac 1
sudo update-alternatives --set java /usr/lib/jvm/java-17-openjdk-amd64/bin/java
sudo update-alternatives --set javac /usr/lib/jvm/java-17-openjdk-amd64/bin/javac
echo "Checking Java version..."
java -version
echo "Java JDK 17 installation and setup completed successfully!"
@@ -0,0 +1,64 @@
#!/bin/bash
set -e
# Variables
TOMCAT_VERSION=10.1.26
TOMCAT_USER=ubuntu
TOMCAT_GROUP=ubuntu
TOMCAT_HOME=/home/ubuntu/tomcat
echo "Updating package list..."
sudo apt update
echo "Downloading Apache Tomcat..."
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
echo "Extracting Tomcat..."
sudo mkdir -p $TOMCAT_HOME
sudo tar xzvf /tmp/apache-tomcat-$TOMCAT_VERSION.tar.gz -C $TOMCAT_HOME --strip-components=1
echo "Setting permissions for Tomcat directories..."
sudo chown -R $TOMCAT_USER:$TOMCAT_GROUP $TOMCAT_HOME
sudo chmod -R u+x $TOMCAT_HOME/bin
echo "Creating Tomcat systemd service file..."
cat <<EOL | sudo tee /etc/systemd/system/tomcat.service
[Unit]
Description=Apache Tomcat Web Application Container
After=network.target
[Service]
Type=forking
User=$TOMCAT_USER
Group=$TOMCAT_GROUP
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
Environment="CATALINA_PID=$TOMCAT_HOME/temp/tomcat.pid"
Environment="CATALINA_HOME=$TOMCAT_HOME"
Environment="CATALINA_BASE=$TOMCAT_HOME"
Environment="CATALINA_OPTS=-Xms2048M -Xmx3072M -server -XX:MinRAMPercentage=50 -XX:MaxRAMPercentage=80"
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
Environment="JAVA_TOOL_OPTIONS=-Dencryption.keystore.type=JCEKS -Dencryption.cipherAlgorithm=DESede/CBC/PKCS5Padding -Dencryption.keyAlgorithm=DESede -Dencryption.keystore.location=/home/ubuntu/keystore/metadata-keystore/keystore -Dmetadata-keystore.password=mp6yc0UD9e -Dmetadata-keystore.aliases=metadata -Dmetadata-keystore.metadata.password=oKIWzVdEdA -Dmetadata-keystore.metadata.algorithm=DESede"
ExecStart=$TOMCAT_HOME/bin/startup.sh
ExecStop=$TOMCAT_HOME/bin/shutdown.sh
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Starting Tomcat service..."
sudo systemctl start tomcat
echo "Stopping Tomcat service..."
sudo systemctl stop tomcat
echo "Enabling Tomcat service to start on boot..."
sudo systemctl enable tomcat
echo "Apache Tomcat installation and setup completed successfully!"
@@ -0,0 +1,62 @@
#!/bin/bash
set -e
# Variables
ACTIVEMQ_VERSION=5.18.5
ACTIVEMQ_USER=ubuntu
ACTIVEMQ_GROUP=ubuntu
ACTIVEMQ_HOME=/home/ubuntu/activemq
echo "Updating package list..."
sudo apt update
echo "Downloading ActiveMQ..."
wget https://dlcdn.apache.org/activemq/$ACTIVEMQ_VERSION/apache-activemq-$ACTIVEMQ_VERSION-bin.tar.gz -O /tmp/apache-activemq-$ACTIVEMQ_VERSION-bin.tar.gz
echo "Extracting ActiveMQ..."
sudo mkdir -p $ACTIVEMQ_HOME
sudo tar xzvf /tmp/apache-activemq-$ACTIVEMQ_VERSION-bin.tar.gz -C $ACTIVEMQ_HOME --strip-components=1
echo "Setting permissions for ActiveMQ directories..."
sudo chown -R $ACTIVEMQ_USER:$ACTIVEMQ_GROUP $ACTIVEMQ_HOME
sudo chmod -R 755 $ACTIVEMQ_HOME
echo "Creating ActiveMQ systemd service file..."
cat <<EOL | sudo tee /etc/systemd/system/activemq.service
[Unit]
Description=Apache ActiveMQ
After=network.target
[Service]
Type=forking
User=$ACTIVEMQ_USER
Group=$ACTIVEMQ_GROUP
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
Environment="ACTIVEMQ_HOME=$ACTIVEMQ_HOME"
Environment="ACTIVEMQ_BASE=$ACTIVEMQ_HOME"
Environment="ACTIVEMQ_CONF=$ACTIVEMQ_HOME/conf"
Environment="ACTIVEMQ_DATA=$ACTIVEMQ_HOME/data"
ExecStart=$ACTIVEMQ_HOME/bin/activemq start
ExecStop=$ACTIVEMQ_HOME/bin/activemq stop
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Starting ActiveMQ service..."
sudo systemctl start activemq
echo "Stopping ActiveMQ service..."
sudo systemctl stop activemq
echo "Enabling ActiveMQ service to start on boot..."
sudo systemctl enable activemq
echo "Apache ActiveMQ installation and setup completed successfully!"
@@ -0,0 +1,44 @@
#!/bin/bash
# URLs of the resources to be downloaded
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"
)
# Directory to save the downloaded files
DOWNLOAD_DIR="./downloads"
# Create the download directory if it does not exist
mkdir -p "$DOWNLOAD_DIR"
# Function to download a file
download_file() {
local url=$1
local dest_dir=$2
local filename=$(basename "$url")
echo "Downloading $filename..."
curl -L -o "$dest_dir/$filename" -w "\nHTTP Status: %{http_code}\n" "$url"
if [ $? -eq 0 ]; then
echo "Downloaded $filename successfully."
else
echo "Failed to download $filename."
fi
# Check if the file size is greater than 0 bytes
if [ ! -s "$dest_dir/$filename" ]; then
echo "Warning: Downloaded file $filename is empty."
fi
}
# Loop through each URL and download the file
for url in "${URLS[@]}"; do
download_file "$url" "$DOWNLOAD_DIR"
done
echo "All downloads are complete."
@@ -0,0 +1,90 @@
#!/bin/bash
set -e
echo "Install unzip command"
sudo apt -y install unzip
echo "Create support folders and configuration in Tomcat"
mkdir -p /home/ubuntu/tomcat/shared/classes && mkdir -p /home/ubuntu/tomcat/shared/lib
sed -i 's|^shared.loader=$|shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar|' /home/ubuntu/tomcat/conf/catalina.properties
echo "Unzip Alfresco ZIP Distribution File"
mkdir /tmp/alfresco
unzip downloads/alfresco-content-services-community-distribution-23.2.1.zip -d /tmp/alfresco
echo "Copy JDBC driver"
cp /tmp/alfresco/web-server/lib/postgresql-42.6.0.jar /home/ubuntu/tomcat/shared/lib/
echo "Configure JAR Addons deployment"
mkdir -p /home/ubuntu/modules/platform && mkdir -p /home/ubuntu/modules/share && mkdir -p /home/ubuntu/tomcat/conf/Catalina/localhost
cp /tmp/alfresco/web-server/conf/Catalina/localhost/* /home/ubuntu/tomcat/conf/Catalina/localhost/
echo "Install Web Applications"
cp /tmp/alfresco/web-server/webapps/* /home/ubuntu/tomcat/webapps/
echo "Apply configuration"
cp -r /tmp/alfresco/web-server/shared/classes/* /home/ubuntu/tomcat/shared/classes/
mkdir /home/ubuntu/keystore && cp -r /tmp/alfresco/keystore/* /home/ubuntu/keystore/
mkdir /home/ubuntu/alf_data
cat <<EOL | tee /home/ubuntu/tomcat/shared/classes/alfresco-global.properties
#
# Custom content and index data location
#
dir.root=/home/ubuntu/alf_data
dir.keystore=/home/ubuntu/keystore/
#
# Database connection properties
#
db.username=alfresco
db.password=alfresco
db.driver=org.postgresql.Driver
db.url=jdbc:postgresql://localhost:5432/alfresco
#
# Solr Configuration
#
solr.secureComms=secret
solr.sharedSecret=secret
solr.host=localhost
solr.port=8983
index.subsystem.name=solr6
#
# Transform Configuration
#
localTransform.core-aio.url=http://localhost:8090/
#
# Events Configuration
#
messaging.broker.url=failover:(nio://localhost:61616)?timeout=3000&jms.useCompression=true
#
# URL Generation Parameters
#-------------
alfresco.context=alfresco
alfresco.host=localhost
alfresco.port=8080
alfresco.protocol=http
share.context=share
share.host=localhost
share.port=8080
share.protocol=http
EOL
echo "Apply AMPs"
mkdir /home/ubuntu/amps && cp -r /tmp/alfresco/amps/* /home/ubuntu/amps/
mkdir /home/ubuntu/bin && cp -r /tmp/alfresco/bin/* /home/ubuntu/bin/
java -jar /home/ubuntu/bin/alfresco-mmt.jar install /home/ubuntu/amps /home/ubuntu/tomcat/webapps/alfresco.war -directory
java -jar /home/ubuntu/bin/alfresco-mmt.jar list /home/ubuntu/tomcat/webapps/alfresco.war
echo "Modify alfresco and share logs directory"
mkdir /home/ubuntu/tomcat/webapps/alfresco && unzip /home/ubuntu/tomcat/webapps/alfresco.war -d /home/ubuntu/tomcat/webapps/alfresco
mkdir /home/ubuntu/tomcat/webapps/share && unzip /home/ubuntu/tomcat/webapps/share.war -d /home/ubuntu/tomcat/webapps/share
sed -i 's|^appender\.rolling\.fileName=alfresco\.log|appender.rolling.fileName=/home/ubuntu/tomcat/logs/alfresco.log|' /home/ubuntu/tomcat/webapps/alfresco/WEB-INF/classes/log4j2.properties
sed -i 's|^appender\.rolling\.fileName=share\.log|appender.rolling.fileName=/home/ubuntu/tomcat/logs/share.log|' /home/ubuntu/tomcat/webapps/share/WEB-INF/classes/log4j2.properties
echo "Alfresco has been configured"
@@ -0,0 +1,48 @@
#!/bin/bash
set -e
echo "Unzip SOLR ZIP Distribution File"
mkdir /tmp/solr
unzip downloads/alfresco-search-services-2.0.9.1.zip -d /tmp/solr
mv /tmp/solr/alfresco-search-services /home/ubuntu
# Variables
SOLR_USER=ubuntu
SOLR_GROUP=ubuntu
SOLR_HOME=/home/ubuntu/alfresco-search-services
echo "Creating SOLR systemd service file..."
cat <<EOL | sudo tee /etc/systemd/system/solr.service
[Unit]
Description=Apache SOLR Web Application Container
After=network.target
[Service]
Type=forking
User=$SOLR_USER
Group=$SOLR_GROUP
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
ExecStart=/home/ubuntu/alfresco-search-services/solr/bin/solr start -a "-Dcreate.alfresco.defaults=alfresco,archive -Dalfresco.secureComms=secret -Dalfresco.secureComms.secret=secret"
ExecStop=/home/ubuntu/alfresco-search-services/solr/bin/solr stop
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Starting Solr service..."
sudo systemctl start solr
echo "Stopping Solr service..."
sudo systemctl stop solr
echo "Enabling Solr service to start on boot..."
sudo systemctl enable solr
echo "SOLR has been configured"
@@ -0,0 +1,57 @@
#!/bin/bash
set -e
echo "Install Transform dependencies"
sudo apt-get update &&
sudo apt install -y imagemagick &&
sudo apt install -y libreoffice &&
sudo apt install -y exiftool
curl -L -o /tmp/alfresco-pdf-renderer-1.2-linux.tgz https://nexus.alfresco.com/nexus/repository/releases/org/alfresco/alfresco-pdf-renderer/1.2/alfresco-pdf-renderer-1.2-linux.tgz &&
sudo tar xf /tmp/alfresco-pdf-renderer-1.2-linux.tgz -C /usr/bin
echo "Configure Transform server"
mkdir /home/ubuntu/transform
cp downloads/alfresco-transform-core-aio-5.1.0.jar /home/ubuntu/transform
# Variables
TRANSFORM_USER=ubuntu
TRANSFORM_GROUP=ubuntu
TRANSFORM_HOME=/home/ubuntu/transform
echo "Creating Transform systemd service file..."
cat <<EOL | sudo tee /etc/systemd/system/transform.service
[Unit]
Description=Transform Application Container
After=network.target
[Service]
Type=simple
User=$TRANSFORM_USER
Group=$TRANSFORM_GROUP
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
Environment="LIBREOFFICE_HOME=/usr/lib/libreoffice"
ExecStart=java -jar /home/ubuntu/transform/alfresco-transform-core-aio-5.1.0.jar
ExecStop=/bin/kill -15 $MAINPID
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Starting Transform service..."
sudo systemctl start transform
echo "Stopping Transform service..."
sudo systemctl stop transform
echo "Enabling Transform service to start on boot..."
sudo systemctl enable transform
echo "Transform has been configured"
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
# Install Node.js and npm (LTS version)
echo "Installing Node.js and npm..."
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
# Verify Node.js and npm installation
echo "Verifying Node.js and npm installation..."
node -v
npm -v
# Clone the Alfresco Content App repository
git clone https://github.com/Alfresco/alfresco-content-app.git
cd alfresco-content-app
# Checkout to the specific version 4.4.1
git checkout tags/4.4.1 -b 4.4.1
# Install project dependencies
npm install
# Build the application for production
npm run build
@@ -0,0 +1,93 @@
#!/bin/bash
# Exit script on any error
set -e
# Update and upgrade the system
echo "Updating system..."
sudo apt update && sudo apt upgrade -y
# Install Nginx
echo "Installing Nginx..."
sudo apt install -y nginx
# Create directory for the Alfresco Content App
echo "Creating directory for Alfresco Content App..."
sudo mkdir -p /var/www/alfresco-content-app
sudo cp -r /home/ubuntu/alfresco-content-app/dist/content-ce/* /var/www/alfresco-content-app
echo "Creating nginx systemd service file..."
cat <<EOL | sudo tee /etc/systemd/system/nginx.service
[Unit]
Description=A high performance web server and a reverse proxy server
Documentation=man:nginx(8)
After=network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t -q -g 'daemon on; master_process on;'
ExecStart=/usr/sbin/nginx -g 'daemon on; master_process on;'
ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading systemd daemon..."
sudo systemctl daemon-reload
echo "Enabling nginx service to start on boot..."
sudo systemctl enable nginx
# Configure Nginx to serve the Alfresco Content App
echo "Configuring Nginx..."
cat <<EOL | sudo tee /etc/nginx/sites-available/alfresco-content-app
server {
listen 80;
server_name localhost;
client_max_body_size 0;
set \$allowOriginSite *;
proxy_pass_request_headers on;
proxy_pass_header Set-Cookie;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host \$host:\$server_port;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_pass_header Set-Cookie;
root /var/www/alfresco-content-app;
index index.html;
location / {
try_files \$uri \$uri/ /index.html;
}
location /alfresco/ {
proxy_pass http://localhost:8080;
}
location /share/ {
proxy_pass http://localhost:8080;
}
}
EOL
# Enable the new Nginx configuration
echo "Enabling Nginx configuration..."
sudo ln -s /etc/nginx/sites-available/alfresco-content-app /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo systemctl stop nginx
# Instructions to transfer the built files
echo "Nginx setup complete."
@@ -0,0 +1,26 @@
#!/bin/bash
set -e
## RECOMMENDATION: run this sequence of commands manually, waiting between one command and the next one to ensure service dependencies are met.
echo "Starting postgresql"
sudo systemctl start postgresql
echo "Starting activemq"
sudo systemctl start activemq
echo "Starting transform"
sudo systemctl start transform
echo "Starting tomcat"
sudo systemctl start tomcat
echo "Starting solr"
sudo systemctl start solr
echo "Starting nginx"
sudo systemctl start nginx
echo "Services have been started successfully!"