I'm using fedora 23 and I want to change the default settings in dnf in order to use a specific server mirror from here.
3 Answers
There are multiple options, you can hard code it (/etc/yum.repos.d/fedora.repo) or using fastmirror.
In order to use fastmirror you must first activate it:
in /etc/dnf/dnf.conf add fastestmirror=true
then using this command dnf config-manager --add-repo add the mirror you want to use, you can add multiple mirrors and the fastest one will be used.
Example:
sudo dnf config-manager --add-repo http://ftp.byfly.by/pub/fedoraproject.org/linux/releases/23/Everything/x86_64/os/
You must use the path /linux/releases/23/Everything/x86_64/os/ for fedora 23 releases and for fedora 23 updates /linux/updates/23/x86_64/ otherwise will not work.
- 102
I grew tired of how dnf interacted with my firewall and so wrote this script to change the files. You may need to add or subtract a section depending on what you have enabled.
It makes a backup of the repo config first, and you probably want to make your own as well. The script can set a new mirror from the command line or add it to the script itself if it will rarely change.
I call it set_fedora_mirrors.sh:
#!/usr/bin/bash -eux
Look for /pub prefix, many don't have. Keep trailing slash!
DEFAULT_REPO=https://mirror.foo.net/
LOCAL_REPO=${1:-$DEFAULT_REPO}
make backups, idempotent:
BASE_DIR=/etc/yum.repos.d
sudo mkdir --parents $BASE_DIR/bak
sudo cp
--preserve=mode,ownership,timestamps
--no-clobber
"$BASE_DIR"/*.repo
"$BASE_DIR"/bak/
|| true # if already there, not an error
echo
pin to specific local mirror
FILES=("$BASE_DIR"/fedora*.repo)
sudo
sed --in-place
-e 's ^metalink= #metalink= '
-e "s ^#baseurl=http://download.example/pub/ baseurl=$LOCAL_REPO "
"${FILES[@]}"
echo
don't change host but pin to current
FILES=("$BASE_DIR"/rpmfusion*.repo)
sudo
sed --in-place
-e 's ^metalink= #metalink= '
-e "s ^#baseurl= baseurl= "
"${FILES[@]}"
- 1,394
To change Fedora Mirror and some setting to reach highest speed do this
Edit the dnf configuration file
sudo nano /etc/dnf/dnf.conf
Add the following lines:
deltarpm=false
keepcache=true
ip_resolve=4
It depends on your own that you like DeltaRPM or not (true or false). Google it to find what exactly it does.
In the /etc/yum.repos.d/ directory there are files that need a small edit.
The main file is fedora-updates.repo
Add country=us (use your own country code) to the end of all of the "metalink" lines for the fedora repo files in /etc/yum.repos.d/
It's better to use de, nl or any european country that have the strong, fast servers. Bandwith capacity matters and not ping.
- 1
- 37