Author Topic: [How To] Get the fastest possible servers using Rankmirrors  (Read 2210 times)

0 Members and 1 Guest are viewing this topic.

verityproductions

  • Guest
[edit:] The wiki page that Carl links to below has had its tutorial bought up to date with our new repo structure. So it is all about using the Terminal command sudo pacman-mirrors -g now.

If need be, please see the wiki for the modified how-to. I expect that Carl will modify this post when he gets back to Manjaro.

handy

_____________________

Since the release of Manjaro 0.8.1 two new servers have become available (one in Brazil and a third in Germany). In addition, those of you who installed Manjaro 0.8.2 using the Beginners' guide may not be aware that the Manjaro server located in the United Kingom was set by default, irrespective of your country of residence.

However, a new guide is available on our wiki to ensure that you can set the fastest possible server(s) for the fastest possible download speeds: http://wiki.manjaro.org/index.php/Rankmirrors_to_Set_the_Fastest_Download_Server

A greater emphasis has been placed on simplicity and user-friendliness, so things are done a little differently in our guide than that provided by the Archwiki.


Note: At the time of posting, the German mycraft.eu server is still down for maintainence. As such, it may therefore be worthwhile either waiting, or running the rankmirrors command again after it comes back up... just to make sure!
« Last Edit: 28. April 2013, 01:10:26 by handy »

Online philm

  • Core Team
  • *****
  • Posts: 5638
    • Manjaro Linux
  • Kernel: Maintainer - so all ;)
  • Desktop: XFCE
  • Branch: Unstable
  • GPU Card: Geforce GTX 650
  • GPU driver: non-free
  • Skill: Guru
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #1 on: 26. November 2012, 20:49:20 »
Great tutorial Carl  ;D

Offline dicktater

  • Held Mitglied
  • *****
  • Posts: 973
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #2 on: 12. December 2012, 02:54:52 »
Bumpity, bump, bump.

Yes. Excellent tutorial.

I was having trouble with server timeouts and failed updates whilst updating a laptop not used in over two weeks. In a quick search of the forum, I saw in another post where Carl had provided a link to this wiki article:

rankmirrors command.
This will automatically detect the fastest servers available and consequently update the mirrorlist file with them
http://wiki.manjaro.org/index.php/Rankmirrors_to_Set_the_Fastest_Download_Server.

Just pushing it back to the forefront again. My updates completed.
« Last Edit: 12. December 2012, 03:05:16 by dicktater »
HOT TIP: For the fastest and most comprehensive response to your problem(s), please report issues properly! http://forum.manjaro.org/index.php?topic=1327.0

Offline Esclapion

  • Support Team
  • ****
  • Posts: 2530
  • Kernel: 3.13.6-2
  • Desktop: Xfce
  • Branch: testing
  • GPU Card: Ati 6870
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #3 on: 13. December 2012, 13:09:19 »
Hello,

Great, thank you.

Yesterday I was just looking for something like this, and I did not know this command.  :)
Venez nous rejoindre sur l'IRC francophone, ICI
Patrice - Violence is the last refuge of the incompetent (Asimov)

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #4 on: 17. December 2012, 23:06:50 »
I added this to my ~/.bashrc

Code: [Select]
# The following command needs to be in /root/.bashrc as it must be run
# from root = after "sudo su". Its purpose being to find the fastest
# Manjaro mirror. Check out the Manjaro wiki for details.
# Run sudo pacman -Syy to sync mirrors after ranking them: 
alias mirror="rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist"

I quite often tell myself a little story when I create an alias, the reason being I often look in .bashrc to refresh my fading memory.  :'(
« Last Edit: 17. December 2012, 23:50:58 by handy »
Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules

Offline dicktater

  • Held Mitglied
  • *****
  • Posts: 973
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #5 on: 17. December 2012, 23:10:47 »
One of these days handy, I'm gonna make time to comb through your ~/.bashrc to get the benefit of your nifty tricks.  :)
HOT TIP: For the fastest and most comprehensive response to your problem(s), please report issues properly! http://forum.manjaro.org/index.php?topic=1327.0

Online philm

  • Core Team
  • *****
  • Posts: 5638
    • Manjaro Linux
  • Kernel: Maintainer - so all ;)
  • Desktop: XFCE
  • Branch: Unstable
  • GPU Card: Geforce GTX 650
  • GPU driver: non-free
  • Skill: Guru
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #6 on: 17. December 2012, 23:15:18 »
maybe you start a new thread titled Handy's .bashrc ;) Or we should create a wiki part with .bashrc tricks - some like that.

Online philm

  • Core Team
  • *****
  • Posts: 5638
    • Manjaro Linux
  • Kernel: Maintainer - so all ;)
  • Desktop: XFCE
  • Branch: Unstable
  • GPU Card: Geforce GTX 650
  • GPU driver: non-free
  • Skill: Guru
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #7 on: 17. December 2012, 23:23:09 »
I recommend to create allservers file from our git-repos like this:

Code: [Select]
wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /tmp/mirrorlist-git
cat /tmp/mirrorlist-git | grep "Server" | sed s'/# Server/Server/'g > /tmp/allservers
sudo mv /tmp/allservers /etc/pacman.d/allservers

Example:

Code: [Select]
[phil@manjaro dev]$ wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /tmp/mirrorlist-git
--2012-12-17 23:20:42--  http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist
Resolving git.manjaro.org (git.manjaro.org)... 176.9.38.148
Connecting to git.manjaro.org (git.manjaro.org)|176.9.38.148|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 616 [text/plain]
Saving to: ‘/tmp/mirrorlist-git’

100%[======================================>] 616         --.-K/s   in 0s     

2012-12-17 23:20:42 (57.7 MB/s) - ‘/tmp/mirrorlist-git’ saved [616/616]

[phil@manjaro dev]$ cat /tmp/mirrorlist-git | grep "Server" | sed s'/# Server/Server/'g > /tmp/allservers
[phil@manjaro dev]$ cat /tmp/allservers
Server = http://manjaro.fis.unb.br/$repo/$arch
Server = http://manjarolinux.polymorf.fr/$repo/$arch
Server = http://mirrors.mycraft.eu/manjaro/$repo/$arch
Server = http://ftp.halifax.rwth-aachen.de/manjaro/$repo/$arch
Server = http://mirror.vinzv.de/manjaro/repo/$repo/$arch
Server = http://ftp.cc.uoc.gr/mirrors/linux/manjaro/$repo/$arch
Server = http://repo.manjaro.org.uk/$repo/$arch
Server = http://mirror.dacentec.com/manjaro/$repo/$arch

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #8 on: 17. December 2012, 23:48:23 »
I just put your commands into a simple (the only type I'm good for) script Phil, works like a charm. Called it allservers.sh .

Code: [Select]
#!/bin/bash
# 1. Downloads the most recent Manjaro mirror list to /tmp/mirrorlist-git
# 2. Formats & copies it to /tmp/allservers
# 3. Then moves it to /etc/pacman.d/allservers:

wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /tmp/mirrorlist-git
cat /tmp/mirrorlist-git | grep "Server" | sed s'/# Server/Server/'g > /tmp/allservers
sudo mv /tmp/allservers /etc/pacman.d/allservers

For anyone starting out with scripts (like me) don't forget to make it executable.

chmod +x <file-name>
« Last Edit: 17. December 2012, 23:55:51 by handy »
Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules

Offline Esclapion

  • Support Team
  • ****
  • Posts: 2530
  • Kernel: 3.13.6-2
  • Desktop: Xfce
  • Branch: testing
  • GPU Card: Ati 6870
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #9 on: 18. December 2012, 00:12:30 »
Thank you, it works very well for me too.  :)

Sent to the French forum  ;)
Venez nous rejoindre sur l'IRC francophone, ICI
Patrice - Violence is the last refuge of the incompetent (Asimov)

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #10 on: 18. December 2012, 00:35:47 »
If you want, you can add the following line to the end of the allservers.sh script:

Code: [Select]
rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist
It will then rank the mirrors in the new /etc/pacman.d/allservers file that the previous commands had just created.

To run it that way you must first go to root with the sudo su command.

Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #11 on: 18. December 2012, 01:06:47 »
I keep the above (reply_8) allservers.sh script in the /home/handy/data/scripts/ directory which was not in the systems search path. So when running the script as root, instead of having to type in that long path, I modified the /etc/profile path line, adding my path to the end of it like so:
Code: [Select]
# Set our default path
PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/handy/data/scripts"
export PATH

This effects the root path, it is not normally somewhere we would need to modify.

It is far more common for someone to want to modify the path for a single user account which is done via that user's ~/.bash_profile file like so:

Code: [Select]
PATH=$PATH:/data/scripts
export PATH

Some distros may vary from this, which is worth remembering.
Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #12 on: 18. December 2012, 12:58:59 »
Revised the allservers.sh script:
Code: [Select]
#!/bin/bash

# allservers.sh MUST be run as root = after sudo su
# 1. Downloads the most recent Manjaro mirror list to /tmp/mirrorlist-git
# 2. Formats & copies it to /tmp/allservers
# 3. Then moves it to /etc/pacman.d/allservers
# 4. Rankmirrors tests then updates /etc/pacman.d mirrorlist
# 5. Syncs the mirrors with your machine:

if [[ `whoami` != "root" ]];
then
  echo "Must use sudo su before you run this script."
  exit
fi

wget http://git.manjaro.org/packages-sources/basis/blobs/raw/master/pacman-mirrorlist/mirrorlist -O /tmp/mirrorlist-git
cat /tmp/mirrorlist-git | grep "Server" | sed s'/# Server/Server/'g > /tmp/allservers
mv /tmp/allservers /etc/pacman.d/allservers
rankmirrors -n 3 /etc/pacman.d/allservers > /etc/pacman.d/mirrorlist
pacman -Syy

& I've just made a new /root/.bashrc alias ('cause I'm lazy):

Code: [Select]
alias as="allservers.sh"

So now after typing in sudo su , I just have to enter as at the prompt & the allservers.sh script does its things. :)

I'll see if I can get the sudo su into the script tomorrow, but I might be pushing it. lol

edit:
Added the sudo su warning to the script & the new alias.
« Last Edit: 18. December 2012, 13:24:29 by handy »
Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules

Offline Esclapion

  • Support Team
  • ****
  • Posts: 2530
  • Kernel: 3.13.6-2
  • Desktop: Xfce
  • Branch: testing
  • GPU Card: Ati 6870
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #13 on: 18. December 2012, 13:24:23 »
Hi,

if [[ `whoami` != "root" ]];
then


may be ?

[ $EUID -ne 0 ] && { echo Must be root to run this script.; exit 1; }

(a bit faster, one process less)
« Last Edit: 18. December 2012, 13:27:51 by Esclapion »
Venez nous rejoindre sur l'IRC francophone, ICI
Patrice - Violence is the last refuge of the incompetent (Asimov)

Offline handy

  • Global Moderator
  • *****
  • Posts: 3850
  • Old experiential pantheist/animist/gnostic...
  • Kernel: x86_64 Linux 3.13.9-1
  • Desktop: Openbox 3.5.2-6 (custom setup: Worker based, Alsa, Auto-login, No windows/icons, tiny Ob menu...)
  • Branch: Testing
  • GPU Card: nVidia GTX 660 Ti
  • GPU driver: non-free
  • Skill: Intermediate
Re: [How To] Get the fastest possible servers using Rankmirrors
« Reply #14 on: 18. December 2012, 13:27:32 »
Thanks. I was editing whilst you were posting I think. :)

I grabbed the whoami from another script I had & just modified the warning.

What I'd like is to be able to incorporate sudo su at the beginning of the script, so it asks for the password, gives you su status & then proceeds to run the rest of the script.
Forget about them, all they do is bring the world down. Ignore them & you are bringing the world up, just by ignoring them.  ;D

A species of conscience, or an evolutionary mishap?

The Forum Rules