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
+123
View File
@@ -0,0 +1,123 @@
#!/bin/bash
# Exit immediately if a command exits with a non-zero status
set -e
HOST_FQDN=$(hostname -f)
SERVER_CERT="CERT_${HOST_FQDN}.crt"
SERVER_KEY="KEY_${HOST_FQDN}.pem"
# Update system packages
echo "Updating system packages..."
sudo dnf update -y
# Install Apache HTTP Server
echo "Installing Apache HTTP Server..."
sudo dnf install -y httpd
# Enable and start Apache
echo "Enabling and starting Apache..."
sudo systemctl enable httpd
sudo systemctl start httpd
# Install MariaDB (MySQL fork)
echo "Installing MariaDB..."
sudo dnf install -y mariadb-server
# Enable and start MariaDB
echo "Enabling and starting MariaDB..."
sudo systemctl enable mariadb
sudo systemctl start mariadb
# Secure MariaDB installation
echo "Securing MariaDB installation..."
sudo mysql_secure_installation
# Install PHP and required extensions
echo "Installing PHP and required extensions..."
subscription-manager repos --enable codeready-builder-for-rhel-8-$(arch)-rpms
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo dnf install -y php php-mysqlnd php-pdo php-gd php-mbstring php-intl php-json php-xml php-zip libzip
sudo dnf install -y php-pecl-zip php-*
# Enable and start PHP-FPM
echo "Enabling and starting PHP-FPM..."
sudo systemctl enable php-fpm
sudo systemctl start php-fpm
# Download OwnCloud
echo "Downloading OwnCloud..."
wget https://download.owncloud.com/server/stable/owncloud-latest.zip
# Extract OwnCloud
echo "Extracting OwnCloud..."
sudo unzip owncloud-latest.zip -d /var/www/html/
# Set ownership and permissions
echo "Setting ownership and permissions..."
sudo chown -R apache:apache /var/www/html/owncloud
sudo chmod -R 755 /var/www/html/owncloud
# Create a new Apache configuration file for OwnCloud
echo "Creating Apache configuration for OwnCloud..."
sudo bash -c 'cat > /etc/httpd/conf.d/owncloud.conf <<EOF
<VirtualHost *:80>
DocumentRoot "/var/www/owncloud"
ServerName owncloud.example.com
<Directory "/var/www/owncloud">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/owncloud_error.log
CustomLog /var/log/httpd/owncloud_access.log combined
</VirtualHost>
EOF'
# Restart Apache to apply changes
echo "Restarting Apache to apply changes..."
sudo systemctl restart httpd
# Create OwnCloud database and user
echo "Creating OwnCloud database and user..."
sudo mysql -u root -p -e "CREATE DATABASE owncloud;"
sudo mysql -u root -p -e "CREATE USER 'ownclouduser'@'localhost' IDENTIFIED BY 'owncloudpassword';"
sudo mysql -u root -p -e "GRANT ALL PRIVILEGES ON owncloud.* TO 'ownclouduser'@'localhost';"
sudo mysql -u root -p -e "FLUSH PRIVILEGES;"
# Create a new Apache SSL configuration file for OwnCloud
echo "Creating Apache SSL configuration for OwnCloud..."
sudo cat << EOF > /etc/httpd/conf.d/owncloud-ssl.conf
<VirtualHost *:443>
DocumentRoot "/var/www/html/owncloud"
ServerName owncloud.example.com
SSLEngine on
SSLCertificateFile /etc/pki/tls/certs/$SERVER_CERT
SSLCertificateKeyFile /etc/pki/tls/private/$SERVER_KEY
<Directory "/var/www/html/owncloud">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/owncloud_error.log
CustomLog /var/log/httpd/owncloud_access.log combined
</VirtualHost>
EOF
# Restart Apache to apply changes
echo "Restarting Apache to apply changes..."
sudo systemctl restart httpd
# Firewall configuration to allow HTTP and HTTPS traffic
echo "Configuring firewall to allow HTTP and HTTPS traffic..."
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
echo "OwnCloud installation is complete. Please navigate to https://owncloud.example.com to complete the setup through the web interface."