wake-up-neo.net

Installieren Sie neue Kopien von Centos 7-Basis-Repos

Ich verwende Centos 7. Während einiger Tests habe ich versehentlich alle Dateien in yum.repo.d entfernt. Gibt es eine Möglichkeit, alle grundlegenden Repos in Centos 7 herunterzuladen und zu konfigurieren

5
Shafiq

Unter der Annahme, dass Sie CentOS-7.3 ausführen, können Sie die Repo-Dateien folgendermaßen erhalten:

# ReInstall the centos-release rpm
~]#  rpm -Uvh --force \
     http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-3.1611.el7.centos.x86_64.rpm

# Clean YUM cache
~]# yum clean all

# Try an update
~]# yum update

centos-release RPM enthält alle Repo-Dateien,

~]#  rpm -qlp \
     http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-3.1611.el7.centos.x86_64.rpm 2>/dev/null | grep repo
/etc/yum.repos.d/CentOS-Base.repo
/etc/yum.repos.d/CentOS-CR.repo
/etc/yum.repos.d/CentOS-Debuginfo.repo
/etc/yum.repos.d/CentOS-Media.repo
/etc/yum.repos.d/CentOS-Sources.repo
/etc/yum.repos.d/CentOS-Vault.repo
/etc/yum.repos.d/CentOS-fasttrack.repo
9
iamauser
#!/bin/bash

install-centos-release() {
 releasever="$(rpm -q --qf '%{VERSION}' "$(rpm -q --whatprovides centos-release)")" \
 && releasever="$(printf "%s" "$releasever" | sed -e 's/\..*$//g')" \
 && basearch="$(uname -m)" \
 && reposurl=$(printf "%s" "http://mirror.centos.org/centos/$releasever/os/$basearch/Packages/") \
 && releaserpm=$(curl --silent "$reposurl" | grep -oP '(?<=")centos-release.*.rpm(?=")') \
 && releaseuri=$(printf "%s%s" "$reposurl" "$releaserpm") \
 && rpm -Uvh --force "$releaseuri"
}

Verwendungszweck:

# Either launch a new terminal and copy `install-centos-release` into the current Shell process, 
# or create a Shell script and add it to the PATH to enable command invocation with bash.

install-centos-release

# Refresh YUM repository(ies)
yum clean all
yum -y update
4
ecwpz91

Altes gutes Kopieren und Einfügen hat ein Recht zu leben:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&Arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
#released updates 

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&Arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&Arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&Arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
0
Oleg Neumyvakin