Skip to content

Instantly share code, notes, and snippets.

@NotYusta
Created August 10, 2024 04:32
Show Gist options
  • Save NotYusta/72bdb4a715a93ad02c826fd0e6754713 to your computer and use it in GitHub Desktop.
Save NotYusta/72bdb4a715a93ad02c826fd0e6754713 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Backup the original repository files
echo "Backing up original repo files..."
sudo cp -r /etc/yum.repos.d /etc/yum.repos.d.backup
# Update the repository configuration
echo "Updating repository configuration..."
sudo sed -i 's|mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/*.repo
sudo sed -i 's|#baseurl=http://dl.rockylinux.org/$contentdir/$releasever|baseurl=https://rocky-linux-asia-southeast1.production.gcp.mirrors.ctrliq.cloud/pub/rocky/$releasever|g' /etc/yum.repos.d/*.repo
# Clean the yum cache
echo "Cleaning yum cache..."
sudo yum clean all
# Update the system
echo "Updating the system..."
sudo yum update -y
echo "Repository mirror update complete!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment