Replacing CentOS Repository to Vault

Preface

Change CentOS package repository from the expired/unsupported one into the legacy vault using sed.

Prerequisite

  • Root access to the CentOS server.

Procedure

Run this script:

sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*