Difference between revisions of "Centos 7 repositories does not work anymore"

From Kolmisoft Wiki
Jump to navigationJump to search
 
Line 72: Line 72:
If you have a custom repo config and want to leave it, you can prevent the repo fix script from running when we do updates. Just add:
If you have a custom repo config and want to leave it, you can prevent the repo fix script from running when we do updates. Just add:
  yum_repo_check = 0
  yum_repo_check = 0
In system.conf file (the file is in /etc/mor or /etc/m2 directory depending on the switch (MOR or M2/M4).
In system.conf file. The file is in /etc/mor or /etc/m2 directory depending on the switch (MOR or M2/M4).

Latest revision as of 11:06, 5 July 2024

Centos 7 EOL

Centos 7 reached EOL (End of Life) on 30 June 2024. mirrorlist.centos.org is already unreachable. yum update will show errors:

[root@localhost ~]# yum update
Loaded plugins: fastestmirror
Determining fastest mirrors
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=os&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=updates&infra=stock error was
14: curl#6 - "Could not resolve host: mirrorlist.centos.org; Unknown error"

How to fix repositories

If MOR/M2/M4 is already installed on the system, the easiest way is to use our script:

/usr/src/k_framework/maintenance/c7_repo_fix.sh

Or manually change repositories:

cd /etc/yum.repos.d/
sed -i s%^mirrorlist=http%#mirrorlist=http%g Cent*.repo
sed -i s%mirror.centos.org%vault.centos.org%g Cent*.repo
sed -i s%^#.*baseurl=http%baseurl=http%g Cent*.repo
yum clean all && yum makecache
cd -

Main repo file /etc/yum.repos.d/CentOS-Base.repo looks like this after changes:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
baseurl=http://vault.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://vault.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://vault.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://vault.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

Switch updates

Every time we update the switch on Centos 7, the script /usr/src/k_framework/maintenance/c7_repo_fix.sh will be executed automatically. If you have a custom repo config and want to leave it, you can prevent the repo fix script from running when we do updates. Just add:

yum_repo_check = 0

In system.conf file. The file is in /etc/mor or /etc/m2 directory depending on the switch (MOR or M2/M4).