使用freebsd-update 升级FreeBSD从FreeBSD 14.1-RELEASE-p5到FreeBSD 14.2-RELEASE
先升级小版本
准备升级前,先把当前的小版本升级到顶,比如现在是FreeBSD 14.1-RELEASE-p5,先升级到最新的14.1版本,使用命令:
# freebsd-update fetch
# freebsd-update install
如果不顺利,可能需要源码更新。
几分钟之后升级完成。
但是uname -a看版本,还没变。那当然啊,还没重启啊.
升级到14.2版本
sudo freebsd-update upgrade -r 14.2-RELEASE
提示
src component not installed, skipped
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching metadata signature for 14.1-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Inspecting system... done.
The following components of FreeBSD seem to be installed:
kernel/generic kernel/generic-dbg world/base world/lib32
The following components of FreeBSD do not seem to be installed:
world/base-dbg world/lib32-dbg
Does this look reasonable (y/n)? y
Fetching metadata signature for 14.2-RELEASE from update1.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata patches. done.
Applying metadata patches... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Fetching files from 14.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 4047 patches.....10....20....30....40....50....60....70...
OK!升级完成!
The following files will be updated as part of updating to
14.2-RELEASE-p3:
/bin/[
/bin/cat
/bin/chflags
/bin/chio
/bin/chmod
/bin/cp
/bin/cpuset
/bin/csh
/bin/date
/bin/dd
/bin/df
/bin/domainname
/bin/echo
/bin/ed
/bin/expr
/bin/freebsd-version
/bin/getfacl
/bin/hostname
/bin/kenv
/bin/kill
/bin/link
/bin/ln
/bin/ls
/bin/mkdir
/bin/mv
/bin/nproc
/bin/pax
To install the downloaded upgrades, run 'freebsd-update [options] install'.
把最主要的资料打包备份
tar -xzvf backup.tar.gz backup/
scp backup.tar.gz 192.168.1.5:/home/xxx/
执行freebsd-update install
# freebsd-update install
重启!
# shutdown -r now
重启后uname -a 显示还是老版本:FreeBSD x250 14.1-RELEASE-p7 FreeBSD 14.1-RELEASE-p7 GENERIC amd64 。之所以这样,是因为重启之前忘记执行freebsd-update install 了。
总之在执行freebsd-update install之后还需要一次重启,重启之后还需要一次执行freebsd-update install
重启后再执行一次
# freebsd-update install
手册
官方升级手册:Chapter 26. Updating and Upgrading FreeBSD | FreeBSD Documentation Portal
Upgrades from one minor version of FreeBSD to another are called minor version upgrades. An example:
-
FreeBSD 13.1 to 13.2.
Major version upgrades increase the major version number. An example:
-
FreeBSD 13.2 to 14.0.
Both types of upgrade can be performed by providing freebsd-update
with a release version target.