# Change ftp server for downloading faster



## fernandobsd (Apr 11, 2015)

When I fetch a package it takes too much time, it is not my internet because when I download with Linux it is very fast.

I am from Mexico.


----------



## getopt (Apr 11, 2015)

Here is a list of mirrors to fetch from:
https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mirrors-ftp.html

If ftp is slow you might try http for fetching on some servers like this one:
http://ftp.freebsd.org/pub/FreeBSD/


----------



## fernandobsd (Apr 18, 2015)

getopt said:


> Here is a list of mirrors to fetch from:
> https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/mirrors-ftp.html
> 
> If ftp is slow you might try http for fetching on some servers like this one:
> http://ftp.freebsd.org/pub/FreeBSD/



How can I fetch from those mirrors? What do I need to do?


----------



## hukadan (Apr 18, 2015)

Hi,
If you use ports to build your packages, the ports-mgmt/fastest_sites port can help you to find the fastest mirrors for ports.


----------



## User7 (Apr 19, 2015)

For PKG:

/etc/pkg/FreeBSD.conf or  /usr/local/etc/pkg.conf

Change: `url: "pkg+http://pkg.[B]eu[/B].FreeBSD.org/${ABI}/latest",` to one of them:

```
Mirrors you may use instead of the global pkg.FreeBSD.org:

  pkg.eu.FreeBSD.org
  pkg.us-east.FreeBSD.org
  pkg.us-west.FreeBSD.org
```

Now update PKG `pkg update` and `pkg update -f`

Or search the web for another mirror.

https://lists.freebsd.org/pipermail/freebsd-pkg/2013-October/000107.html
https://www.freebsd.org/cgi/man.cgi?query=pkg&sektion=7


----------



## kpa (Apr 19, 2015)

User7 said:


> For PKG:
> 
> /etc/pkg/FreeBSD.conf or  /usr/local/etc/pkg.conf
> 
> ...




It's better to create a /usr/local/etc/pkg/repos/FreeBSD.conf file where you override the defaults that are in /etc/pkg/FreeBSD.conf so you don't have to edit the latter. Using the /usr/local/etc/pkg.conf file for defining repositories is deprecated and strongly discouraged, you will get a warning from pkg(8) if you try to do that. This is how you would change the official FreeBSD repository to use pkg+http://pkg.eu.FreeBSD.org (save this snippet as /usr/local/etc/pkg/repos/FreeBSD.conf):


```
FreeBSD: {
    url: "pkg+http://pkg.eu.FreeBSD.org/${ABI}/latest",
}
```

Edit: Removed the incorrect mirror_type override.


----------



## User7 (Apr 19, 2015)

Sorry. Not work


```
FreeBSD: {
  url: "http://pkg.eu.FreeBSD.org/${ABI}/latest",
  mirror_type: HTTP,
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```


```
root@handy:/usr/home/handy # pkg update -f
Updating FreeBSD repository catalogue...
Repository FreeBSD has a wrong packagesite, need to re-create database
pkg: http://pkg.eu.FreeBSD.org/FreeBSD:10:amd64/latest/meta.txz: No address record
```


----------



## kpa (Apr 19, 2015)

User7 said:


> Sorry. Not work
> 
> 
> ```
> ...



Aah yes, you still need the SRV for mirror_type so leave that out. I wasn't aware that pkg.eu.freebsd.org was yet another redirection via SRV site.


```
% drill _http._tcp.pkg.eu.freebsd.org SRV
;; ->>HEADER<<- opcode: QUERY, rcode: NOERROR, id: 54034
;; flags: qr rd ra ; QUERY: 1, ANSWER: 3, AUTHORITY: 3, ADDITIONAL: 6 
;; QUESTION SECTION:
;; _http._tcp.pkg.eu.freebsd.org.       IN      SRV

;; ANSWER SECTION:
_http._tcp.pkg.eu.freebsd.org.  60      IN      SRV     20 10 80 pkg0.nyi.freebsd.org.
_http._tcp.pkg.eu.freebsd.org.  60      IN      SRV     50 10 80 pkg0.isc.freebsd.org.
_http._tcp.pkg.eu.freebsd.org.  60      IN      SRV     10 10 80 pkg0.bme.freebsd.org.
```


----------



## korneliov (Apr 1, 2021)

The question remains though. How can one change the default http mirrors and use ftp ones?


----------



## SirDice (Apr 2, 2021)

The package repositories are not available through FTP.

http://pkg.freebsd.org/


----------

