Created
January 20, 2025 23:07
-
-
Save lamoboos223/b329997a75c596fb6e412b1cc8c23bde to your computer and use it in GitHub Desktop.
This is for centos7 old mirror repository
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 | |
# Backup existing repo files | |
echo "Creating backup of existing repo files..." | |
cd /etc/yum.repos.d/ | |
mkdir -p backup | |
mv CentOS-* backup/ | |
# Create new CentOS-Base.repo file | |
echo "Creating new CentOS-Base.repo file..." | |
cat > /etc/yum.repos.d/CentOS-Base.repo << 'EOL' | |
[base] | |
name=CentOS-7 - Base | |
baseurl=https://vault.centos.org/7.9.2009/os/$basearch/ | |
gpgcheck=1 | |
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | |
[updates] | |
name=CentOS-7 - Updates | |
baseurl=https://vault.centos.org/7.9.2009/updates/$basearch/ | |
gpgcheck=1 | |
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | |
[extras] | |
name=CentOS-7 - Extras | |
baseurl=https://vault.centos.org/7.9.2009/extras/$basearch/ | |
gpgcheck=1 | |
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 | |
EOL | |
# Clean and update yum cache | |
echo "Cleaning yum cache..." | |
yum clean all | |
echo "Making new cache..." | |
yum makecache | |
# Install EPEL repository | |
echo "Installing EPEL repository..." | |
yum install -y epel-release | |
# Install nano | |
echo "Installing nano..." | |
yum install -y nano | |
echo "Script completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment