相应镜像提供以下 Gentoo 资源:
相应镜像不提供 ebuild,需要搭配 Gentoo Portage 镜像或 Gentoo Portage Git 镜像使用。
在 /etc/portage/make.conf 中加入:
GENTOO_MIRRORS="https://mirrors.tuna.tsinghua.edu.cn/gentoo"配置好 Portage 与 Distfiles 后,执行 emerge --sync 进行更新。
Gentoo 官方二进制包仓库(binhost)提供预编译并签名的二进制包。
以下配置使用当前的 23.0 profile,具体路径见 amd64 二进制包目录和 arm64 二进制包目录。
较新的 Stage 3 已在 /etc/portage/binrepos.conf/ 中预配置官方 binhost。所以只需要编辑 [gentoo] 配置中的镜像地址;若没有 [gentoo] 配置,则新增它。
[gentoo]
priority = 1
sync-uri = https://mirrors.tuna.tsinghua.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64
location = /var/cache/binhost/gentoo
verify-signature = trueGentoo Binhost 项目目前支持使用 GNU 工具链(glibc、GCC 和 binutils)的 amd64 和 arm64。其他架构和工具链也会发布二进制包,但仅限 Release Engineering 构建 Stage 3 所用的包缓存。
sync-uri 指向包含 Packages 文件的目录。上方配置使用常规 amd64 的 x86-64 二进制包;常规 arm64 系统可将其改为 https://mirrors.tuna.tsinghua.edu.cn/gentoo/releases/arm64/binpackages/23.0/arm64。
对于常规 amd64 系统,官方建议 CPU 支持 x86-64-v3 时使用对应的二进制包,以获得针对该指令集的优化。检查 CPU 是否支持:
ld.so --helpld.so --help输出中包含 x86-64-v3 (supported, searched) 即表示支持。可将配置改为:
sync-uri = https://mirrors.tuna.tsinghua.edu.cn/gentoo/releases/amd64/binpackages/23.0/x86-64-v3在有合适的二进制包时自动下载并使用:
FEATURES="${FEATURES} getbinpkg"FEATURES="${FEATURES} getbinpkg"如果没有合适的二进制包,Portage 会照常从源码编译。
单次使用二进制包安装:
emerge --ask --getbinpkg <package>根据 Portage binpkg changes,新版 Portage 默认验证远程二进制包的签名,并将其缓存到 location 指定的目录。官方 binhost 用户不再需要启用 FEATURES="binpkg-request-signature";首次下载时,Portage 会自动运行 getuto 创建可信密钥环。
参考 Gentoo Binary Host Quickstart,高级配置参考 Binary package guide。
在运行 Bootstrap 脚本之前,可通过设置以下环境变量选择 Bootstrap 过程中使用的镜像。
export GENTOO_MIRRORS="https://mirrors.tuna.tsinghua.edu.cn/gentoo"
export SNAPSHOT_URL="https://mirrors.tuna.tsinghua.edu.cn/gentoo/snapshots"
# export GNU_URL="http://mirror/gnu"GNU_URL 的具体设置可以参考 GNU 帮助。
Bootstrap 成功后,若对 Gentoo Portage 和 Distfiles 换源,可参照以上几节,只需将 /etc 换成 $EPREFIX/etc。