667 lines
20 KiB
Bash
Executable File
667 lines
20 KiB
Bash
Executable File
#!/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 <<EOL | sudo tee /etc/systemd/system/activemq.service
|
|
[Unit]
|
|
Description=Apache ActiveMQ
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=forking
|
|
|
|
User=activemq
|
|
Group=activemq
|
|
|
|
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
|
|
Environment="ACTIVEMQ_HOME=/opt/activemq"
|
|
Environment="ACTIVEMQ_BASE=/opt/activemq"
|
|
Environment="ACTIVEMQ_CONF=/opt/activemq/conf"
|
|
Environment="ACTIVEMQ_DATA=/opt/activemq/data"
|
|
|
|
ExecStart=/opt/activemq/bin/activemq start
|
|
ExecStop=/opt/activemq/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 "Enabling ActiveMQ service to start on boot..."
|
|
sudo systemctl enable activemq
|
|
|
|
echo "Apache ActiveMQ installation and setup completed successfully!"
|
|
}
|
|
install_alfresco_rhel(){
|
|
|
|
echo "Create support folders and configuration in Tomcat"
|
|
mkdir -p /etc/tomcat/shared/classes && mkdir -p /etc/tomcat/shared/lib
|
|
sed -i 's|^shared.loader=$|shared.loader=${catalina.base}/shared/classes,${catalina.base}/shared/lib/*.jar|' /etc/tomcat/catalina.properties
|
|
|
|
echo "Unzip Alfresco ZIP Distribution File"
|
|
mkdir /tmp/downloads/alfresco
|
|
|
|
echo "Copy JDBC driver"
|
|
cp /tmp/downloads/alfresco/web-server/lib/postgresql-42.6.0.jar /etc/tomcat/shared/lib/
|
|
|
|
echo "Configure JAR Addons deployment"
|
|
mkdir -p /etc/modules/platform && mkdir -p /opt/modules/share && mkdir -p /opt/tomcat/conf/Catalina/localhost
|
|
cp /tmp/downloads/alfresco/web-server/conf/Catalina/localhost/* /opt/tomcat/conf/Catalina/localhost/
|
|
|
|
echo "Install Web Applications"
|
|
cp /tmp/downloads/alfresco/web-server/webapps/* /etc/tomcat/webapps/
|
|
|
|
echo "Apply configuration"
|
|
cp -r /tmp/downloads/alfresco/web-server/shared/classes/* /etc/tomcat/shared/classes/
|
|
mkdir /opt/keystore && cp -r /tmp/downloads/alfresco/keystore/* /opt/keystore/
|
|
mkdir /opt/alf_data
|
|
cat <<EOL | tee /etc/tomcat/shared/classes/alfresco-global.properties
|
|
#
|
|
# Custom content and index data location
|
|
#
|
|
dir.root=/opt/alf_data
|
|
dir.keystore=/opt/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 /opt/amps && cp -r /tmp/downloads/alfresco/amps/* /opt/amps/
|
|
mkdir /opt/bin && cp -r /tmp/downloads/alfresco/bin/* /opt/bin/
|
|
java -jar /opt/bin/alfresco-mmt.jar install /opt/amps /etc/tomcat/webapps/alfresco.war -directory
|
|
java -jar /opt/bin/alfresco-mmt.jar list /etc/tomcat/webapps/alfresco.war
|
|
|
|
echo "Modify alfresco and share logs directory"
|
|
mkdir /etc/tomcat/webapps/alfresco && unzip /etc/tomcat/webapps/alfresco.war -d /etc/tomcat/webapps/alfresco
|
|
mkdir /etc/tomcat/webapps/share && unzip /etc/tomcat/webapps/share.war -d /etc/tomcat/webapps/share
|
|
sed -i 's|^appender\.rolling\.fileName=alfresco\.log|appender.rolling.fileName=/opt/tomcat/logs/alfresco.log|' /etc/tomcat/webapps/alfresco/WEB-INF/classes/log4j2.properties
|
|
sed -i 's|^appender\.rolling\.fileName=share\.log|appender.rolling.fileName=/opt/tomcat/logs/share.log|' /etc/tomcat/webapps/share/WEB-INF/classes/log4j2.properties
|
|
|
|
|
|
echo "Alfresco has been configured"
|
|
}
|
|
|
|
install_solr_rhel() {
|
|
echo "Unzip SOLR ZIP Distribution File"
|
|
mkdir /tmp/solr
|
|
unzip /tmp/downloads/alfresco-search-services-2.0.9.1.zip -d /tmp/solr
|
|
mv /tmp/solr/alfresco-search-services /opt/solr/alfresco-search-services
|
|
echo "creating user ..."
|
|
sudo useradd solr
|
|
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
|
|
Group=solr
|
|
|
|
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk"
|
|
|
|
ExecStart=/opt/solr/alfresco-search-services/solr/bin/solr start -a "-Dcreate.alfresco.defaults=alfresco,archive -Dalfresco.secureComms=secret -Dalfresco.secureComms.secret=secret"
|
|
ExecStop=/opt/solr/alfresco-search-services/solr/bin/solr stop
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOL
|
|
|
|
echo "SELinux anpassungen werden durchgeführt...."
|
|
ausearch -c '(solr)' --raw | audit2allow -M my-solr
|
|
semodule -X 300 -i my-solr.pp
|
|
|
|
echo "Permission für für solr werden gesetzt...."
|
|
chmod -R 755 /opt/solr/alfresco-search-services/solr/server/../../logs
|
|
chown -R solr:solr /opt/solr/alfresco-search-services/solr/server/../../logs
|
|
|
|
echo "Reloading systemd daemon..."
|
|
sudo systemctl daemon-reload
|
|
|
|
echo "Starting Solr service..."
|
|
sudo systemctl start solr
|
|
|
|
echo "Enabling Solr service to start on boot..."
|
|
sudo systemctl enable solr
|
|
|
|
echo "SOLR has been configured"
|
|
}
|
|
|
|
install_transform_rhel() {
|
|
echo "Install Repo Dependency..."
|
|
sudo subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
|
|
sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
|
|
|
|
echo "Install Transform dependencies"
|
|
sudo dnf install -y GraphicsMagick libreoffice perl-Image-ExifTool
|
|
|
|
curl -L -o /tmp/downloads/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/downloads/alfresco-pdf-renderer-1.2-linux.tgz -C /usr/bin
|
|
|
|
echo "Configure Transform server"
|
|
mkdir /opt/transform
|
|
cp /tmp/downloads/alfresco-transform-core-aio-5.1.0.jar /opt/transform
|
|
|
|
echo " User wird angelegt..."
|
|
sudo useradd 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
|
|
Group=transform
|
|
|
|
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk"
|
|
Environment="LIBREOFFICE_HOME=/usr/lib/libreoffice"
|
|
|
|
ExecStart=java -jar /opt/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 "Enabling Transform service to start on boot..."
|
|
sudo systemctl enable transform
|
|
|
|
echo "Transform has been configured"
|
|
}
|
|
|
|
install_nginx_rhel() {
|
|
echo "Updating system..."
|
|
sudo yum update -y
|
|
|
|
echo "Installing Nginx..."
|
|
sudo yum install -y nginx
|
|
|
|
echo "Creating directory for Alfresco Content App..."
|
|
sudo mkdir -p /var/www/alfresco-content-app
|
|
sudo cp -r /tmp/downloads/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=NGINX web server
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=forking
|
|
|
|
ExecStart=/usr/sbin/nginx
|
|
ExecReload=/usr/sbin/nginx -s reload
|
|
ExecStop=/usr/sbin/nginx -s stop
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOL
|
|
|
|
echo "Reloading systemd daemon..."
|
|
sudo systemctl daemon-reload
|
|
|
|
echo "Starting Nginx service..."
|
|
sudo systemctl start nginx
|
|
|
|
echo "Enabling Nginx to start on boot..."
|
|
sudo systemctl enable nginx
|
|
|
|
echo "Nginx installation and configuration completed successfully!"
|
|
}
|
|
|
|
# Functions for Ubuntu
|
|
install_postgresql_ubuntu() {
|
|
echo "Updating package list..."
|
|
sudo apt update
|
|
|
|
echo "Installing PostgreSQL 16..."
|
|
sudo apt install -y wget ca-certificates
|
|
wget -qO - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
|
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs) pgdg" | sudo tee /etc/apt/sources.list.d/pgdg.list
|
|
sudo apt update
|
|
sudo apt install -y postgresql-16 postgresql-client-16
|
|
|
|
echo "Enable local connections"
|
|
sudo sed -i 's/peer/trust/' /etc/postgresql/16/main/pg_hba.conf
|
|
sudo sed -i 's/ident/md5/' /etc/postgresql/16/main/pg_hba.conf
|
|
|
|
echo "Starting PostgreSQL service..."
|
|
sudo systemctl start postgresql
|
|
|
|
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
|
|
|
|
echo "Enabling PostgreSQL to start on boot..."
|
|
sudo systemctl enable postgresql
|
|
|
|
echo "PostgreSQL installation and setup completed successfully!"
|
|
}
|
|
|
|
install_java_ubuntu() {
|
|
echo "Updating package list..."
|
|
sudo apt update
|
|
|
|
echo "Installing Java JDK 17..."
|
|
sudo apt install -y openjdk-17-jdk
|
|
|
|
echo "Checking Java version..."
|
|
java -version
|
|
|
|
echo "Java JDK 17 installation and setup completed successfully!"
|
|
}
|
|
|
|
install_tomcat_ubuntu() {
|
|
echo "Updating package list..."
|
|
sudo apt update
|
|
|
|
echo "Installing Tomcat 10..."
|
|
sudo apt install -y tomcat10 tomcat10-admin tomcat10-common tomcat10-examples
|
|
|
|
echo "Starting Tomcat service..."
|
|
sudo systemctl start tomcat10
|
|
|
|
echo "Enabling Tomcat to start on boot..."
|
|
sudo systemctl enable tomcat10
|
|
|
|
echo "Tomcat installation and setup completed successfully!"
|
|
}
|
|
|
|
install_activemq_ubuntu() {
|
|
echo "Updating package list..."
|
|
sudo apt update
|
|
|
|
echo "Downloading ActiveMQ..."
|
|
wget https://dlcdn.apache.org/activemq/5.18.5/apache-activemq-5.18.5-bin.tar.gz -O /tmp/apache-activemq-5.18.5-bin.tar.gz
|
|
|
|
echo "Extracting ActiveMQ..."
|
|
sudo mkdir -p /home/ubuntu/activemq
|
|
sudo tar xzvf /tmp/apache-activemq-5.18.5-bin.tar.gz -C /home/ubuntu/activemq --strip-components=1
|
|
|
|
echo "Setting permissions for ActiveMQ directories..."
|
|
sudo chown -R ubuntu:ubuntu /home/ubuntu/activemq
|
|
sudo chmod -R 755 /home/ubuntu/activemq
|
|
|
|
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=ubuntu
|
|
Group=ubuntu
|
|
|
|
Environment="JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64"
|
|
Environment="ACTIVEMQ_HOME=/home/ubuntu/activemq"
|
|
Environment="ACTIVEMQ_BASE=/home/ubuntu/activemq"
|
|
Environment="ACTIVEMQ_CONF=/home/ubuntu/activemq/conf"
|
|
Environment="ACTIVEMQ_DATA=/home/ubuntu/activemq/data"
|
|
|
|
ExecStart=/home/ubuntu/activemq/bin/activemq start
|
|
ExecStop=/home/ubuntu/activemq/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 "Enabling ActiveMQ service to start on boot..."
|
|
sudo systemctl enable activemq
|
|
|
|
echo "Apache ActiveMQ installation and setup completed successfully!"
|
|
}
|
|
|
|
install_solr_ubuntu() {
|
|
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
|
|
|
|
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=ubuntu
|
|
Group=ubuntu
|
|
|
|
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 "Enabling Solr service to start on boot..."
|
|
sudo systemctl enable solr
|
|
|
|
echo "SOLR has been configured"
|
|
}
|
|
|
|
install_transform_ubuntu() {
|
|
echo "Install Transform dependencies"
|
|
sudo apt install -y imagemagick libreoffice 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
|
|
|
|
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=ubuntu
|
|
Group=ubuntu
|
|
|
|
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 "Enabling Transform service to start on boot..."
|
|
sudo systemctl enable transform
|
|
|
|
echo "Transform has been configured"
|
|
}
|
|
|
|
install_nginx_ubuntu() {
|
|
echo "Updating system..."
|
|
sudo apt update
|
|
|
|
echo "Installing Nginx..."
|
|
sudo apt install -y nginx
|
|
|
|
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=NGINX web server
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=forking
|
|
|
|
ExecStart=/usr/sbin/nginx
|
|
ExecReload=/usr/sbin/nginx -s reload
|
|
ExecStop=/usr/sbin/nginx -s stop
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOL
|
|
|
|
echo "Reloading systemd daemon..."
|
|
sudo systemctl daemon-reload
|
|
|
|
echo "Starting Nginx service..."
|
|
sudo systemctl start nginx
|
|
|
|
echo "Enabling Nginx to start on boot..."
|
|
sudo systemctl enable nginx
|
|
|
|
echo "Nginx installation and configuration completed successfully!"
|
|
}
|
|
|
|
# Run the appropriate installation based on the OS
|
|
if [ "$OS" == "RHEL" ]; then
|
|
#download_files
|
|
#install_postgresql_rhel
|
|
#install_java_rhel
|
|
#install_tomcat_rhel
|
|
#install_activemq_rhel
|
|
install_alfresco_rhel
|
|
#install_solr_rhel
|
|
#install_transform_rhel
|
|
#install_nginx_rhel
|
|
elif [ "$OS" == "Ubuntu" ]; then
|
|
download_files
|
|
install_postgresql_ubuntu
|
|
install_java_ubuntu
|
|
install_tomcat_ubuntu
|
|
install_activemq_ubuntu
|
|
install_solr_ubuntu
|
|
install_transform_ubuntu
|
|
install_nginx_ubuntu
|
|
else
|
|
echo "Unsupported OS"
|
|
fi
|