Created
November 9, 2024 18:37
-
-
Save alexolinux/4a3088a18a28d01ff19961ddb4ef8718 to your computer and use it in GitHub Desktop.
Script to install additional repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Detect RHEL version | |
if [ -f /etc/os-release ]; then | |
. /etc/os-release | |
RHEL_VERSION=$(echo $VERSION_ID | cut -d '.' -f1) | |
else | |
echo "Unable to determine OS version." | |
exit 1 | |
fi | |
# Function to install EPEL | |
install_epel() { | |
echo "Installing EPEL repository for RHEL $RHEL_VERSION..." | |
sudo yum install -y epel-release | |
} | |
# Function to install RPM Fusion repositories | |
install_rpmfusion() { | |
echo "Installing RPM Fusion repositories for RHEL $RHEL_VERSION..." | |
if [[ "$RHEL_VERSION" == "8" ]]; then | |
sudo yum install -y \ | |
https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm \ | |
https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-8.noarch.rpm | |
elif [[ "$RHEL_VERSION" == "9" ]]; then | |
sudo yum install -y \ | |
https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-9.noarch.rpm \ | |
https://mirrors.rpmfusion.org/nonfree/el/rpmfusion-nonfree-release-9.noarch.rpm | |
else | |
echo "RHEL version $RHEL_VERSION is not supported by this script." | |
exit 1 | |
fi | |
} | |
# Install EPEL | |
install_epel | |
# Install RPM Fusion | |
install_rpmfusion | |
echo "EPEL and RPM Fusion repositories installed successfully." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://rpmfusion.org/Configuration