把 FreeBSD 9.1 的套件管理機制從 pkg 轉到 pkgng

pkgng 是 FreeBSD 10.0 開始才有的套件管理機制

有鑑於 FreeBSD 9.1 上的 “pkg_install EOL is scheduled for 2014-09-01” 訊息不斷跳出來提醒 …

終於決定開始著手轉換至新的套件管理機制

方法參照:5.4. Using pkgng for Binary Package Management

FreeBSD 8.4 以後的版本可以直接執行(更早的版本需手動安裝ports-mgmt/pkg):
/usr/sbin/pkg

然後會出現:

The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]:

當然就回答 y 繼續

接下來就會開始bootstrap…

Bootstrapping pkg please wait
_http._tcp.pkg.FreeBSD.org
Installing pkg-1.2.7_1… done
If you are upgrading from the old package format, first run:

# pkg2ng
Usage: pkg [-v] [-d] [-l] [-N] [-j |-c ] [-C ] [-R ] []

Global options supported:
-d Increment debug level
-j Execute pkg(8) inside a jail(8)
-c Execute pkg(8) inside a chroot(8)
-C Use the specified configuration file
-R Directory to search for individual repository configurations
-l List available commands and exit
-v Display pkg(8) version
-N Test if pkg(8) is activated and avoid auto-activation

Commands supported:
add Registers a package and installs it on the system
annotate Add, modify or delete tag-value style annotations on packages
audit Reports vulnerable packages
autoremove Removes orphan packages
backup Backs-up and restores the local package database
check Checks for missing dependencies and database consistency
clean Cleans old packages from the cache
config Display the value of the configuration options
convert Convert database from/to pkgng
create Creates software package distributions
delete Deletes packages from the database and the system
fetch Fetches packages from a remote repository
help Displays help information
info Displays information about installed packages
install Installs packages from remote package repositories
lock Locks package against modifications or deletion
plugins Manages plugins and displays information about plugins
query Queries information about installed packages
register Registers a package into the local database
remove Deletes packages from the database and the system
repo Creates a package repository catalogue
rquery Queries information in repository catalogues
search Performs a search of package repository catalogues
set Modifies information about packages in the local database
ssh ssh packages to be used via ssh
shell Opens a debug shell
shlib Displays which packages link against a specific shared library
stats Displays package database statistics
unlock Unlocks a package, allowing modification or deletion
update Updates package repository catalogues
updating Displays UPDATING information for a package
upgrade Performs upgrades of packaged software distributions
version Displays the versions of installed packages
which Displays which package installed a specific file

Commands provided by plugins:

For more information on the different commands see ‘pkg help ‘.

接著執行:
pkg2ng 來轉換套件資料庫,花費時間滿明顯跟現有的資料量呈正比 …

中間可能會出現類似這樣的訊息 …

pkg: PACKAGESITE in pkg.conf is deprecated. Please create a repository configuration file

這部分則參照這邊先修掉:pkgng – FreeBSD Wiki

把 /usr/local/etc/pkg.conf 裡面諸如 PACKAGESITE, MIRROR_TYPE, PUBKEY 等 “repository-specific configuration” 拿掉,如果都拿掉會讓這份檔案空掉的話就直接把檔案砍!

建立 repos 資料夾::mkdir -p /usr/local/etc/pkg/repos

寫設定到 /usr/local/etc/pkg/repos/FreeBSD.conf (以tw為例):

FreeBSD: {
url: "pkg+http://pkg.tw.FreeBSD.org/${ABI}/latest",
mirror_type: "srv",
enabled: yes
}

然後繼續剛剛的 pkg -> pkgng 轉換~

把這一行:
WITH_PKGNG= yes
寫到這裡面: /etc/make.conf

如果之前有寫類似 “NO_WARNING_PKG_INSTALL_EOL=yes” 這類過渡期的設定記得先拿掉…

到這邊差不多就完成了!

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。