Skip to main content

Centos-vault container image

Preparation (Mandatory)

To ensure stable resolution of the package mirror, ensure the hosts file is configured with correct domain name resolution before configuration. If not added, add the following content to the /etc/hosts file before configuring the package mirror.

cat >> /etc/hosts << EOF
10.251.102.1 mirrors.shanhe.com
EOF

Introduction

CentOS-Vault.repo corresponds to the yum source version released with this container image; using this package mirror allows downloading the yum source from the release time.

Download URL:https://mirrors.shanhe.com/centos-vault/

Official Homepage:https://vault.centos.org/

Configuration Method

First, back up the files in /etc/yum.repos.d/.

mkdir /etc/yum.repos.d/bak
cp /etc/yum.repos.d/*.repo /etc/yum.repos.d/bak

Determine the required minor version. Unless otherwise specified, use the last minor version of the major version, such as 6.10 or 5.11. We denote this as $minorver, which you need to replace in subsequent commands.

Modify the CentOS-Vault.repo file: uncomment lines starting with baseurl, and comment out lines starting with mirrorlist. In the file,replace http://mirror.centos.org with http://mirrors.shanhe.com. You can refer to the following command:

# Centos 6
minorver=6.10 # System minor version
sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/centos/\$releasever|baseurl=https://mirrors.shanhe.com/centos-vault/$minorver|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo

# CentOS 8
minorver=8.5.2111 # System minor version
sudo sed -e "s|^mirrorlist=|#mirrorlist=|g" \
-e "s|^#baseurl=http://mirror.centos.org/\$contentdir/\$releasever|baseurl=https://mirrors.shanhe.com/centos-vault/$minorver|g" \
-i.bak \
/etc/yum.repos.d/CentOS-*.repo

Note the * wildcard. If you only need to replace sources in specific files, add or delete as needed. Note that to enable certain repos, change enabled=0 to enabled=1.

Refresh the cache by executing the following command:

yum makecache