Menjalankan script untuk mengganti repolist dari centos yang telah kadaluarsa
#!/bin/bash # Nama file repositori dan log file REPO_FILE="/etc/yum.repos.d/CentOS-Vault.repo" LOG_FILE="repo_update.log" # Backup file repositori yang ada echo "Membackup file repositori yang ada..." | tee -a $LOG_FILE mkdir -p /etc/yum.repos.d-backup mv /etc/yum.repos.d/*.repo /etc/yum.repos.d-backup/ | tee -a $LOG_FILE # Menambahkan repositori CentOS 7 arsip echo "Menambahkan repositori CentOS 7 arsip ke $REPO_FILE..." | tee -a $LOG_FILE cat <<EOF > $REPO_FILE [base] name=CentOS-7 - Base baseurl=http://vault.centos.org/7.9.2009/os/\$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 [updates] name=CentOS-7 - Updates baseurl=http://vault.centos.org/7.9.2009/updates/\$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 [extras] name=CentOS-7 - Extras baseurl=http://vault.centos.org/7.9.2009/extras/\$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=1 [centosplus] name=CentOS-7 - Plus baseurl=http://vault.centos.org/7.9.2009/centosplus/\$basearch/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 enabled=0 EOF # Perbarui cache yum echo "Memperbarui cache yum..." | tee -a $LOG_FILE yum clean all | tee -a $LOG_FILE yum makecache | tee -a $LOG_FILE echo "Selesai! Lihat $LOG_FILE untuk detail perubahan."
pertama buat script dulu
vi script-update-repo.sh
Masukkan isi script di atas kedalam file
Kemudian tambahkan permission execute
chmod +x script-update-repo.sh
Jalankan script untuk mengupdate repository
./script-update-repo.sh