這篇是以前大三修交大資工計算機系統管理課程中的投影片,從中取出紀錄的過程。當時使用的 FreeBSD 4.10 左右的作業系統,在此當作個筆記記錄回憶啦。比較新的方式可參考:[FreeBSD] 安裝 FreeBSD 與系統更新
我習慣用光碟安裝,所以以 6.1 來說,就是去抓光碟啦
至於安裝的套件就選:
- base : binary
- kernels(all) : Generic kernel and SMP kernel
- Man : Manual
- src : FreeBSD Source Code
- ports : FreeBSD Software Collection
- local : local additions
安裝完套件可以調的東西:
- Root Password
- Time Zone > Asia > Taiwan
- Mouse > enable
- Networking > sshd
- Packages (optional), ex: net/csup, editors/vim-lite
抓取更新系統的檔案:
- pkg_add ftp://freebsd.csie.nctu.edu.tw/pub/releases/i386/6.1-RELEASE/packages/net/csup-20060223_1.tbz
- 編寫 /usr/local/etc/cvsup-all 更新檔案
- Where to get source
- Where to put status file
- Where to put source
- Allow cvs to delete
- Compress before transmit
- *default host=freebsd.csie.nctu.edu.tw
*default base=/usr
*default prefix=/usr
*default delete use-rel-suffix
*default compress
*default release=cvs tag=RELENG_6
src-all
ports-all tag=. -
記得寫一下 /etc/make.conf 檔
MASTER_SITE_OVERRIDE?= \
ftp://freebsd.csie.nctu.edu.tw/pub/distfiles/${DIST_SUBDIR}/\
ftp://ftp.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp2.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp3.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp4.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp5.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp7.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/\
ftp://ftp8.tw.freebsd.org/pub/FreeBSD/distfiles/${DIST_SUBDIR}/WITHOUT_X11=YES
- # /usr/local/bin/csup -L 1 /usr/local/etc/cvsup-all > /var/log/csup.log
The “–L 1” tells cvsup to print out the details of all the file updates it is doing. from 0 (silent) to 2.
更新步驟:
-
make buildworld
-
# cd /usr/src
-
# make buildworld >& /var/log/world.log &
-
-
make buildkernel
-
# cd /usr/src/sys/i386/conf
-
# cp GENERIC “YOUR-NAME”
-
# edit config file
-
-
make installkernel
-
新的方式
# cd /usr/src
# make KERNCONF=YOUR-NAME buildkernel其他資訊
-
Note: This method of kernel building requires full source files. If you only installed the kernel source, use the traditional method.
-
Tip: By default, when you build a custom kernel, all kernel modules will be rebuilt as well. If you want to update a kernel faster or to build only custom modules, you should edit /etc/make.conf before starting to build the kernel:
MODULES_OVERRIDE = linux acpi sound/sound sound/driver/ds1 ntfs
-
-
舊的方式
@ /usr/src/sys/i386/conf/
# /usr/sbin/config YOUR-NAME
# cd ../compile/YOUR-NAME (or ../../compile/YOUR-NAME )
# make dependclean (6.1版會提醒你要作這步, 之前的只有提醒做 make depend)
# make depend
# make
# make install
-
-
reboot and boot in single user mode
-
使用 shutdown now 或
-
Press "4" 於開機選項
-
-
mergemaster -p
-
Pre-buildworld mode. Compares only files known to be essential to the success of {build|install}world, including /etc/make.conf.
-
-
make installworld
-
mergemaster
-
Synchronize /usr/src/etc with /etc
-
Choose “i” for most case, such as /etc/defaults/rc.conf, …
-
Press “enter” for certain file, such as master.passwd, hosts, csh.*
-
-
reboot
如果有任何錯誤的話:
-
Possible errors in building new kernel
-
Boot with old kernel
-
In 5.x ~
-
Press “6”
-
Type “boot /boot/kernel.old/kernel”
-
-
In 4.x
-
Hit any key other than “enter” when counting down
-
Type “unload”
-
Type “load /kernel.old”
-
Type “boot”
-
-
-
上述的一些過程可以當作更新系統的方法,但有些部分不適用於已安裝好的系統,即已安裝於系統的軟體並不會得到更新,必需額外使用軟體來進行更新,這是以前的文章(用的是 cvsup ,現在大多改用 csup ):
安裝所需的軟體
cvsup
# cd /usr/ports/net/cvsup-without-gui && make install portupgrade
# cd /usr/ports/sysutils/portupgrade && make install 打這個指令讓才剛裝好的程式立即可以使用:
rehash cvsup 是個工具,她可以幫我們至 FreeBSD 站台更新 Source-Tree 及 Ports-Tree 回來您的主機中。portupgrade 是 FreeBSD 中升級以 PORTS 安裝的軟體的一個套件(必須是您更新 Ports-Tree 之後)。 更新 PORTS-Tree 且升級已安裝的軟體
取回「更新 PORTS-Tree的設定檔」cvsupfile-ports:
fetch ftp://ftp.tw.freebsd.org/pub/CVSup/cvsupfile-ports 依據 cvsupfile-ports 中的定義,至 CVSup 站臺更新 PORTS-Tree
cvsup -g -L 2 cvsupfile-ports 先重建您系統中 PORTS 的 INDEX 資料庫
這個部份恐需時甚久,而且會令你覺得是不是當機了,所以請耐心等候。
portsdb -Uu 再接著是修補程式間的關連性,才能正確並有效率的升級已安裝的軟體
pkgdb -F 為了以防萬一,我們先做個升級的假動作:
portupgrade -ayn 如果剛剛的升級測試都沒有問題,現在就可以正式來一遍了:
portupgrade -ay 你可以寫一個批次檔讓此程式來執行:
#!/bin/sh
cvsup -g -L 2 cvsupfile-ports
portsdb -Uu
pkgdb -F
portupgrade -ayn 更詳細的資訊,您可以
man portupgrade