How To edit repository file to use a specific URL or Mirror

Tags: #<Tag:0x00007f5b1f0617e8> #<Tag:0x00007f5b1f061680> #<Tag:0x00007f5b1f0614a0>

This How To article applies to all current versions of OM Lx including Cooker, Rolling, and Rock/Lx 4. Lx 4 is meant to reference all Lx 4 versions such as Lx 4.0, 4.1, and 4.2.

Sometimes a user may wish to use a specific URL or MIrror to upgrade their system and install software.

This is easy to do using graphical test editor like Kate or Kwrite. We will use Kwrite in Rock x86_64 for these examples.

You will need to know what repository file you are using and if you have enabled any i686 repos that is a separate file and you’ll need to edit that as well.

If you have repositories enabled in more than one file and it’s matching i686 file you have a broken system and need to fix that first. Ask for help in Support forum if you don’t know how to fix this.

Cooker and Rolling users should be knowledgeable enough to know how to do this or figure out how to do this so we will focus on the Stable release currently Rock/Lx 4.1. The repo files are in directory /etc/yum.repos.d. The file or files to edit for Rock are:

For x86_64:
openmandriva-rock-x86_64.repo

and if you use i686 also:
openmandriva-rock-i686.repo

For znver1:
openmandriva-rock-znver1.repo

and if you use i686 also:
openmandriva-rock-i686.repo

To be safe copy the file you are going to edit to another location so you will have it if there any problems.

$ sudo cp /etc/yum.repos.d/openmandriva-rock-x86_64.repo /etc/yum.repos.d/openmandriva-rock-x86_64.repo.bak

Now open kwrite or kate and navigate to the file you need to edit:

Next to enable a specific URL or Mirror we need to disable the default mirror list function. To do this go to first entry in list and highlight the word “mirrorlist” that a select Edit>replace in tool menu:

Now in the line that says Replace you put “# mirrorlist” then select “Replace all”. Notice the change, now “mirrorlist” is commented out with the # sign so that line will be ignored.

Next we do the same in the next line with “fastestmirror” so file ends up looking like this:

Now we need to enable the line for “baseurl” to enable the use of a specific URL or Mirror. Highlight “# baseurl” and replace that with simply “baseurl”:

And now we replace the URL in “baseurl” line with the URL we wish to use again we highlight what we want to replace and use Edit>Replace to replace the URL:

and finally to save our changes in the Tool Menu select “Save” enter your root/administrator password and select “OK”. Now any enabled repositories in that file should be using the new URL.

To check our work we can use this command:

$ dnf repolist -v

Where the line Repo-baseurl tells us the exact URL used for each enabled repository. For this example we see:

So we now know we were successful.