what's a local yum repository? And what's its use?

Joined
Apr 16, 2023
Messages
172
Reaction score
20
Credits
1,677
Does it mean I can download softwares without using internet once the local yum repository is set up?
Please explain what does it mean? And how to setup in centos 7?
Here's an article but it confused. I've how to do this in RHEL9. But not sure what'd be equivalent command for centos 7.

Code:
[HEADING=3]Explanation[/HEADING]
1. To mount the “RHEL-9.iso” file to the mount point “/opt” as a loop device, allowing you to access the contents of the ISO file as if it were a physical CD or DVD, run:
# mount -o loop RHEL-9.iso /opt
Note that
· The "-o loop" option specifies that the ISO file should be mounted as a loop device.
[LIST]
[*]A loop device is a pseudo-device that makes the ISO file accessible as a block device.
[*]You should have a RHEL-9.iso file available on your system to mount it to "/opt".
[/LIST]
To keep the mount persistent, append the mount line to the file "/etc/fstab", with the following command:
# echo "path/to/RHEL-9.iso /opt iso9660 loop 0 0" >> /etc/fstab
To mount all file systems specified in the "/etc/fstab" file, run:
# mount -a
2. To copy the file “/opt/media.repo“ to “/etc/yum.repos.d/rhel9.repo”, run:
# cp /opt/media.repo /etc/yum.repos.d/rhel9.repo
3. To set the file “rhel9.repo” permissions to allow the owner to read and write the file, users in the same group as the owner to read the file, and all other users to read the file, run:
# chmod 644 /etc/yum.repos.d/rhel9.repo
4. To edit the “rhel9.repo” file, run:
# vim etc/yum.repos.d/rhel9.repo
5. Replace the data in the file with this data:
[InstallMedia-BaseOS]
name=RHEL 9 - BaseOS
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=file:///opt/BaseOS/
[InstallMedia-AppStream]
name=RHEL 9 - AppStream
metadata_expire=-1
gpgcheck=0
enabled=1
baseurl=file:///opt/AppStream/
6. Press Esc to switch to command, then type ":wq" followed by Enter to save and quit.
7. To clean yum/dnf and the subscription-manager cache, use:
# dnf clean all
# subscription-manager clean
Note that
[LIST]
[*]You may receive a "This system is not registered" warning message. To prevent this warning message, edit the file "/etc/yum/pluginconf.d/subscription-manager.conf" and change the value of the "enabled" parameter from "1" to "0".
[/LIST]
8. To list available repositories for the system, use:
# dnf repolist
 


The purpose of having a local repository is when you have many local machines all needing these updates. Instead of 500 machines all updating from the internet you save all that bandwidth by having a local copy those machines can access.
 
The purpose of having a local repository is when you have many local machines all needing these updates. Instead of 500 machines all updating from the internet you save all that bandwidth by having a local copy those machines can access.
Can you convert the RHEL9 code equivalent for centos 7? I tried chatgpt but it was not working properly.
I still don't understand the point of local yum repository.
So you mean if I've two servers connected to each other, I can download stuffs from the server containing local yum repository without requiring internet?
 
So you mean if I've two servers connected to each other, I can download stuffs from the server containing local yum repository without requiring internet?

One server would fetch the updates, one with a local repo configured.

At that point, any other devices could fetch their updates from that server.

As mentioned above, this is useful when you have a large number of computers. Rather than waste bandwidth having them all update over the 'net, just one server does that and you then use that server as your repo.

This is also useful for exercising some version control. Those devices won't update until the repo has the software for them to update. So, you can more easily test updates before pushing them into production.

You can even not include some software in your local repo, meaning people wouldn't be able to install that software.
 

Staff online

Members online


Latest posts

Top