0

I downloaded a DVD image of RHEL 8 and I want to use only the packages therein. That image already contains indexed BaseOS and AppStream repos, so I just have mount it and put a local.repo file with baseurl=file:///whatever in /etc/yum.repos.d/. Until that part, I know what to do.

Now, I want to delete any reference to other repos that might exist or might have existed in my machine. So I wiped /etc/yum.repos.d/ off any other .repo file and wiped the /var/cache/dnf/. However, when I do a $ yum info or $ yum repolist, somehow, even without internet connection, /etc/yum.repos.d/redhat.repo comes back from the dead and /var/cache/dnf/ gets repopulated. And I get curl errors because I don't have that machine connected to the internet.

I want yum to have to deal only with the repos I configured in local.repo. How do I do that?

I'm coming from sudo yum repolist show repo not in /etc/yum.repo.d and Remove yum repo using yum so I already tried the $ dnf config-manager --disablerepo, --nopluggins and other stuff in those answers.

Katerl3s
  • 143
  • 1
  • 1
  • 5

2 Answers2

3

Do not delete other repo files. Just make sure that each entry /etc/yum.repos.d/*, for which you do not want to be used any more, has a line enabled=0. Then you add entries as you already did. My example of such repo file looks like this:

[c8-disk-BaseOS]
name=CentOS-BaseOS- - Media
baseurl=file:///CentOS/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[c8-media-AppStream]
name=CentOS-AppStream- - Media
baseurl=file:///CentOS/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

And here is an example of disabled default entry:

# CentOS-AppStream.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.
#
#

[AppStream]
name=CentOS-$releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

I do that very often, because I have CentOS computers in an isolated environment without internet access. In that way, I keep a copy of installation media on disk, and I can install whatever is provided with the that media.

nobody
  • 1,545
  • 12
  • 19
0

redhat.repo is managed by subscription-manager. If you do not want to be subscribed run subscription-manager remove and subscription-manager unregister.

msuchy
  • 1,408
  • 8
  • 6