ArchLabs Linux

Reflector versus pacman-mirrors --fasttrack

Gentlemen, a bit of help again, please :wink:

As I told you in an earlier post, I come from Manjaro and in it I was using the
pacman-mirrors --fasttrack
to rank my mirrorlist.
I don’t know how to use reflector. Actually I never used reflector before.
Thus how can I enable
pacman-mirrors --fasttrack
or, if it’s impossible, teach me how to use reflector, please.

Best idea is just to read up at the wiki

https://wiki.archlinux.org/index.php/reflector

There are a couple of examples there how to use it :smiley:

2 Likes

And may I apply here what I learn there?

Of course. ArchLabs is essentially Arch Linux with our additions.

reflector --verbose --latest 5 --sort rate --save /etc/pacman.d/mirrorlist should to the trick for you.

2 Likes

I have this function in my ~/.zshrc (or equivalent for your shell) that will work for both reflector and rankmirrors (part of pacman-contrib). You’ll find it in your ~/.zsh/settings/functions.zsh or ~/.bash/functions.bash

mir() # update pacman mirror list
{
	if hash reflector >/dev/null 2>&1; then
		su -c 'reflector --score 100 -l 50 -f 10 --sort rate --save /etc/pacman.d/mirrorlist --verbose'
	elif hash rankmirrors >/dev/null 2>&1; then
		local s="https://www.archlinux.org/mirrorlist/?country=US&country=CA&use_mirror_status=on"
		su -c "curl -L '$s' | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -v -t -n 10 - > /etc/pacman.d/mirrorlist"
	else
		printf "this requires reflector or rankmirrors installed\n"; return 1
	fi
}

Mind the hardcoded bit for rankmirrors in the actual mirror source ?country=US&country=CA you’ll want to change these to country codes near you, for example NZ and AU would use ?country=NZ&country=AU. This only matters if you don’t have reflector.

So you can just open a shell and run mir you’ll be prompted for password then a list of all the mirrors it’s sorting followed by the ranked list and the fastest 10 are dumped to /etc/pacman.d/mirrorlist

You can also just change the name of the function if you prefer something more familiar.

4 Likes

Hi,i use hook the wiki arch reflector,posted form @Dobbie,i also find it useful when mirrorlist updates arrive.

1 Like