# Is FreeBSD "pkg" command pointing to latest repository?



## ikevin8me (Sep 14, 2018)

I'm trying to install the current latest version of JDK 8.

When I searched on "https://www.freebsd.org/ports/index.html", I found JDK 8 update 181. And, looking into the "Age" of the files, it was updated only 3 days ago.

However, when I search from within FreeBSD using pkg search, I could only see JDK 8 update 172.

When isn't pointing to the latest repository, and how to find out and change which repository it is pointing to?

Thanks!


----------



## JAW (Sep 14, 2018)

You might be on the quarterly pkg repo rather than latest, check _/etc/pkg/FreeBSD.conf _


----------



## ikevin8me (Sep 14, 2018)

When does the "latest" become the "quarterly"? And how do we know that?


----------



## Lamia (Sep 14, 2018)

Ports are more recent than pkgs. Pkgs are built quarterly. So if you want to get the 'latest' pkgs, you will need to fetch the 'lastest' ports (using portsnap etc) and build the ports into pkgs for yourself. That is the reason many people use Poudriere and the likes.

You may find the repo, where the FBSD ports are tests and you could use it for your latest pkgs. There are also tonnes of poudriere instances out there that you can use for free so long there are using bleeding edge ports.


----------



## rigoletto@ (Sep 14, 2018)

ikevin8me said:


> When does the "latest" become the "quarterly"? And how do we know that?



Every three months as the name suggest. You can switch to the latest repository which is closer ( usually a few days behind ) of the ports.

Edit /usr/local/etc/pkg/repos/FreeBSD.conf:


```
FreeBSD: {
   url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
   mirror_type: "srv",
   signature_type: "fingerprints",
   fingerprints: "/usr/share/keys/pkg",
   enabled: no
}
```

Or install ports-mgmt/synth or ports-mgmt/poudriere, create and manage your own repository.


----------



## SirDice (Sep 14, 2018)

ikevin8me said:


> When isn't pointing to the latest repository, and how to find out and change which repository it is pointing to?


Run `pkg -vv` and you can see which repositories are enabled and where they are pointing to.


----------



## scottro (Sep 14, 2018)

Unless you've created a repo, the default is /etc/pkg/FreeBSD.conf which points to quarterly.  To make it the latest, manually create /usr/local/etc/pkg/repos/FreeBSD.conf to point to latest.  The description has been given above, or just copy the /etc/pkg/FreeBSD.conf to it and change quarterly to latest.


----------



## SirDice (Sep 14, 2018)

You don't need to set the whole thing, just the URL is enough:

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest"
}
```
The other values are taken from /etc/pkg/FreeBSD.conf (the two files are effectively merged).


----------



## nsayer (Sep 27, 2018)

Why is it preferred to make a local conf file instead of just editing /etc/pkg/FreeBSD.conf?

Not questioning it... you wouldn't have suggested if it there wasn't a good reason - just want to understand why.


----------



## rigoletto@ (Sep 27, 2018)

nsayer

Because it can eventually be overwritten after a system pkg(8) update/upgrade.


----------



## ShelLuser (Sep 28, 2018)

nsayer said:


> Why is it preferred to make a local conf file instead of just editing /etc/pkg/FreeBSD.conf?


Because that file is part of the base system and will eventually be overwritten during a system upgrade. See also /usr/src/etc (assuming you have the source code installed).

This basically applies to every other config file out there as well, even /etc/crontab (it's much more preferably to set up a per-user cron job instead). And of course also external software which you installed either from ports or packages. This is also why you'd encounter an example config file at best in /usr/local/etc after installing software rather than a ready out-of-the-box config file. The example config files are going to be removed while you deinstall the software, but any of your manually set up configuration will always be left alone.


----------

