FreeBSD - Ports is fetching from slow servers

Ports randomly gets it's source server list from /usr/ports/Mk/bsd.sites.mk, as defined by the port maintainer. But the top 1st choice of the list may not be the one physically near to us and thus the download speed is much desirable. Most of the time compiling ports doesn't necessary takes a long time (like my 3 years AMD athlon 1.8Ghz perform fairly good). In fact, downloading of the sources is the one that takes a long time.

In this case, we'll need to tune the ports so that it fetches the sources from the nearest (physically) server. A nearer server normally means less latency and less latency means faster connection (this may not be the whole truth but truth is in it. :p)

The port "fastest_sites" will test the latency of the server listed in /usr/ports/Mk/bsd.sites.mk and output to a file. The file is suitable to be included in /etc/make.conf which tell ports where to fetch the sources from.

Here it is how to:
  1. Installing "fastest_sites"
    portsnap fetch update; portmanager ports-mgmt/fastest_sites -l
  2. Execute the command :
    /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf
  3. Include the updated faster server list into /etc/make.conf :
    echo ".include "/usr/local/etc/ports_sites.conf"" >> /etc/make.conf
  4. Proceed to install port(s) and it will download from a faster server.
  5. Should you want to regularly test the source servers, schedule it in cron :
    0 6 * * * /usr/local/bin/fastest_sites > /usr/local/etc/ports_sites.conf

In my case, after "fastest_sites" executed and /etc/make.conf updated on the first time, the next 300++ ports (compiling KDE4) that i compile, gets it's sources from (very)fast servers. Thus, the scheduling part is optional.

Shalom !!!

No comments: