FreeBSD 12 使用 latest 软件源

FreeBSD pkg 包管理器的官方源配置是 /etc/pkg/FreeBSD.conf ,请先检查该文件内容。注意其中的 url 参数配置了官方仓库的地址,我们需要把它替换为镜像站的地址。

该配置文件是 FreeBSD 基本系统的一部分,会随着 freebsd-update 更新,请不要直接修改,而是创建 /usr/local/etc/pkg/repos/FreeBSD.conf 覆盖配置,文件内容如下:

sudo mkdir -p /usr/local/etc/pkg/repos/
sudo cp /etc/pkg/FreeBSD.conf /usr/local/etc/pkg/repos/

现在 /usr/local/etc/pkg/repos/FreeBSD.conf 的内容为:

# $FreeBSD: releng/12.2/usr.sbin/pkg/FreeBSD.conf.quarterly 346780 2019-04-27 04:00:50Z cperciva $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#

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

如果要使用滚动更新的 latest 仓库,把 url 配置最后的 quarterly 换成 latest 即可。之后使用 sudo pkg update -f 强制更新 pkg 索引。

pengjiayou@freebsd-s-1vcpu-1gb-sfo3-01:~ % sudo pkg update -f
Updating FreeBSD repository catalogue...
pkg: Repository FreeBSD has a wrong packagesite, need to re-create database
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   6.4MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 30336 packages processed.
All repositories are up to date.
pengjiayou@freebsd-s-1vcpu-1gb-sfo3-01:~ % sudo pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01
Fetching packagesite.txz: 100%    6 MiB   6.4MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 30336 packages processed.
All repositories are up to date.
pengjiayou@freebsd-s-1vcpu-1gb-sfo3-01:~ % sudo pkg upgrade
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
New version of pkg detected; it needs to be installed first.
The following 1 package(s) will be affected (of 0 checked):

Installed packages to be UPGRADED:
	pkg: 1.16.1 -> 1.16.2

Number of packages to be upgraded: 1

7 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/1] Fetching pkg-1.16.2.txz: 100%    7 MiB   6.9MB/s    00:01
Checking integrity... done (0 conflicting)
[1/1] Upgrading pkg from 1.16.1 to 1.16.2...
[1/1] Extracting pkg-1.16.2: 100%
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
All repositories are up to date.
Checking for upgrades (11 candidates): 100%
Processing candidates (11 candidates): 100%
The following 12 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
	libyaml: 0.2.5

Installed packages to be UPGRADED:
	nano: 5.4 -> 5.5
	py37-acme: 1.10.1,1 -> 1.11.0,1
	py37-certbot: 1.10.1,1 -> 1.11.0,1
	py37-certbot-nginx: 1.10.1 -> 1.11.0
	py37-markupsafe: 1.1.1 -> 1.1.1_1
	py37-pytz: 2020.1,1 -> 2020.5,1
	py37-yaml: 5.3.1 -> 5.3.1_1
	readline: 8.0.4 -> 8.1.0
	vim-console: 8.2.2263 -> 8.2.2263_1
	wget: 1.20.3_1 -> 1.21
	zstd: 1.4.5_1 -> 1.4.8

Number of packages to be installed: 1
Number of packages to be upgraded: 11

The process will require 1 MiB more space.
9 MiB to be downloaded.

Proceed with this action? [y/N]: y
[1/12] Fetching zstd-1.4.8.txz: 100%  504 KiB 516.6kB/s    00:01
[2/12] Fetching wget-1.21.txz: 100%  676 KiB 691.7kB/s    00:01
[3/12] Fetching vim-console-8.2.2263_1.txz: 100%    6 MiB   6.3MB/s    00:01
[4/12] Fetching readline-8.1.0.txz: 100%  362 KiB 370.5kB/s    00:01
[5/12] Fetching py37-yaml-5.3.1_1.txz: 100%  154 KiB 157.3kB/s    00:01
[6/12] Fetching py37-pytz-2020.5,1.txz: 100%  159 KiB 162.3kB/s    00:01
[7/12] Fetching py37-markupsafe-1.1.1_1.txz: 100%   20 KiB  20.7kB/s    00:01
[8/12] Fetching py37-certbot-nginx-1.11.0.txz: 100%   64 KiB  65.7kB/s    00:01
[9/12] Fetching py37-certbot-1.11.0,1.txz: 100%  382 KiB 391.3kB/s    00:01
[10/12] Fetching py37-acme-1.11.0,1.txz: 100%   65 KiB  66.3kB/s    00:01
[11/12] Fetching nano-5.5.txz: 100%  543 KiB 556.3kB/s    00:01
[12/12] Fetching libyaml-0.2.5.txz: 100%   71 KiB  72.9kB/s    00:01
Checking integrity... done (0 conflicting)
[1/12] Upgrading readline from 8.0.4 to 8.1.0...
[1/12] Extracting readline-8.1.0: 100%
[2/12] Upgrading py37-pytz from 2020.1,1 to 2020.5,1...
[2/12] Extracting py37-pytz-2020.5,1: 100%
[3/12] Upgrading py37-acme from 1.10.1,1 to 1.11.0,1...
[3/12] Extracting py37-acme-1.11.0,1: 100%
[4/12] Upgrading py37-certbot from 1.10.1,1 to 1.11.0,1...
[4/12] Extracting py37-certbot-1.11.0,1: 100%
[5/12] Installing libyaml-0.2.5...
[5/12] Extracting libyaml-0.2.5: 100%
[6/12] Upgrading zstd from 1.4.5_1 to 1.4.8...
[6/12] Extracting zstd-1.4.8: 100%
[7/12] Upgrading wget from 1.20.3_1 to 1.21...
[7/12] Extracting wget-1.21: 100%
[8/12] Upgrading vim-console from 8.2.2263 to 8.2.2263_1...
[8/12] Extracting vim-console-8.2.2263_1: 100%
[9/12] Upgrading py37-yaml from 5.3.1 to 5.3.1_1...
[9/12] Extracting py37-yaml-5.3.1_1: 100%
[10/12] Upgrading py37-markupsafe from 1.1.1 to 1.1.1_1...
[10/12] Extracting py37-markupsafe-1.1.1_1: 100%
[11/12] Upgrading py37-certbot-nginx from 1.10.1 to 1.11.0...
[11/12] Extracting py37-certbot-nginx-1.11.0: 100%
[12/12] Upgrading nano from 5.4 to 5.5...
[12/12] Extracting nano-5.5: 100%

Leave a comment

Your email address will not be published. Required fields are marked *