Yum source backup Pattern¶
The Yum Source Backup Pattern is a procedural step used in system administration and DevOps workflows, specifically when modifying the YUM package manager configuration on CentOS-based systems^[600-developer__docker__yum-aliyun.md]. It ensures that the default or current repository configuration is preserved before applying changes to alternative sources, such as the Aliyun mirrors^[600-developer__docker__yum-aliyun.md].
Implementation¶
The pattern is executed using the mv (move) command to rename the active repository configuration file. The standard operation targets CentOS-Base.repo and appends a .backup extension^[600-developer__docker__yum-aliyun.md].
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
This action effectively disables the original source by changing its filename, as YUM typically only processes files ending in .repo within the /etc/yum.repos.d/ directory^[600-developer__docker__yum-aliyun.md].
Workflow Context¶
This backup step is the initial phase of the Yum Source Change (變更yum源) workflow^[600-developer__docker__yum-aliyun.md]. It is followed by downloading a new configuration file (e.g., wget -O /etc/yum.repos.d/CentOS-Base.repo ...) and generating a new cache^[600-developer__docker__yum-aliyun.md].
Sources¶
^[600-developer__docker__yum-aliyun.md]