| |
제 목 : OS 재설치없이 FreeBSD 버전 업그레이드
작성자 : 좋은진호(truefeel)
작성일 : 2009.6.15(월)~
정리일 : 2009.7.6(월)
업그레이드 측면은 리눅스가 FreeBSD보다 편하다. 리눅스는 자동업데이트도 쉽게 할 수 있고, 수시 업데이트를 하더라도 명령 한 줄이면 바로 업데이트를 할 수가 있다. 업데이트된 커널을 바로 적용하지 않는다면 리부팅도 필요 없다. 나중에 서비스 중단해도 될 때에 리부팅을 해주면 된다. 이에 비해서 FreeBSD는 업데이트 과정에 반드시 리부팅을 필요로 하며, 순차적으로 진행해야하는 과정도 필요하다.
1. 대략적인 업데이트 과정
1) freebsd-update -r X.X-RELEASE upgrade
(X.X 는 업데이트할 버전이다. 6.4로 업그레이드하려면 6.4, 7.2로 하려면 7.2를 지정한다.)
실행하는 동안 로드가 조금 올라간다. 로드가 0.x -> 1.x까지 상승.
2) freebsd-update install
3) 리부팅
4) 리부팅 후에 다시 한번 freebsd-update install 를 실행해야 한다.
/etc/ 아래 환경파일이 기존의 수정된 파일과 새로운 환경파일이 깔끔하게 merging됨을 확인할 수 있다.
5) 커널은 기본적으로 제공되는 커널이므로 자신의 환경에 맞게 하려면 재컴파일이 필요하다.
(kernel만 함. buildworld는 필요없음)
cd /usr/src
make kernel
그리고, 리부팅
6) 이외 필요시, 설치된 패키지 업그레이드
2. FreeBSD 6.3 -> 6.4 또는 7.x -> 7.2 업그레이드
FreeBSD 6.3이상에서 업그레이드 하는 과정은 동일하다. 상세하게 살펴보자. 먼저 현재 버전을 확인한다.
| |
# uname -a
FreeBSD cnx01.coffeenix.net 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 14:37:25 UTC 2009 root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386
#
| |
freebsd-update를 실행한다.
| |
# freebsd-update -r 7.2-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update4.FreeBSD.org... done.
Fetching metadata signature for 7.1-RELEASE from update4.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
The following components of FreeBSD seem to be installed:
kernel/generic src/base src/bin src/cddl src/contrib src/crypto src/etc
src/games src/gnu src/include src/krb5 src/lib src/libexec src/release
src/rescue src/sbin src/secure src/share src/sys src/tools src/ubin
src/usbin world/base world/dict world/doc world/games world/info
world/manpages world/proflibs
The following components of FreeBSD do not seem to be installed:
world/catpages
Does this look reasonable (y/n)? y <-- y를 누른다.
Fetching metadata signature for 7.2-RELEASE from update4.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 7.1-RELEASE for merging... done.
Preparing to download files... done.
Fetching 31141 patches.....10....20....30.... <-- 실행하는데 시간이 걸림. 이때 서버 load가 올라감
... 생략 ...
....31120....31130....31140 done.
Applying patches...
done.
Fetching 586 files... done.
Attempting to automatically merge changes in files... done.
The following file could not be merged automatically: /etc/hosts
Press Enter to edit this file in vi and resolve the conflicts
manually...
<-- enter를 누른다.
... 생략 ...
Does this look reasonable (y/n)? y <-- y를 누른다.
The following files are affected by updates, but no changes have
been downloaded because the files have been modified locally:
/.cshrc
/root/.cshrc
The following files will be removed as part of updating to 7.2-RELEASE-p1:
/boot/kernel/ath_hal.ko
/boot/kernel/ath_hal.ko.symbols
... 생략 ...
The following files will be added as part of updating to 7.2-RELEASE-p1:
/boot/kernel/cpuctl.ko
/boot/kernel/cpuctl.ko.symbols
/boot/kernel/geom_part_ebr.ko
... 생략 ...
The following files will be updated as part of updating to 7.2-RELEASE-p1:
/.profile
/COPYRIGHT
/bin/[
... 생략 ...
| |
Fetching한 파일은 모두/var/db/freebsd-update/ 에 남는다. 가져온 파일(files/ 디렉토리), 어느 서버에서 가져올 것인지 서버 목록(serverlist*), 공개키(pub.ssl) 등이 저장된다. Fetching할 때 load가 조금 올라가는데, 서비스하지 않는 0.x load가 1.x까지 올라 갔다.
| |
2:39PM up 133 days, 5:40, 2 users, load averages: 1.31, 0.82, 0.40
2:39PM up 133 days, 5:40, 2 users, load averages: 1.29, 0.82, 0.40
| |
이제 freebsd-update install를 실행하고, 리부팅을 한다.
| |
# freebsd-update install
Installing updates...
Kernel updates have been installed. Please reboot and run
"/usr/sbin/freebsd-update install" again to finish installing updates.
#
# reboot
| |
리부팅하면 커널 버전이 변경되어 있을 것이다. 다시 한번 install을 한다. 이 후 /etc 아래의 환경 파일들을 보면, 새로운 OS버전의 환경 파일과 기존에 변경했던 환경 파일이 깔끔하게 merging되어 있는 것을 확인할 수 있다.
| |
# freebsd-update install
Installing updates...
Completing this upgrade requires removing old shared object files.
Please rebuild all installed 3rd party software (e.g., programs
installed from the ports tree) and then run "/usr/sbin/freebsd-update install"
again to finish installing updates.
| |
이 상태에서는 기본 상태의 커널이 것이므로, 자신의 환경에 맞게 재컴파일이 필요하다.
| |
# cd /usr/src
# make kernel
| |
3. FreeBSD 6.2 -> 6.4 업그레이드
FreeBSD 6.2의 freebsd-update는 오래된 버전이다. FreeBSD 6.3이상에서 진행한 과정으로 업데이트를 하려면 freebsd-update를 웹에서 받아와야 한다. 또는 6.3이상 버전에 있는 /usr/sbin/freebsd-update와 /etc/freebsd-update.conf 파일을 복사해서 사용해도 된다. (쉘스크립트로 되어 있는데, 웹에서 받는 것과 소스는 동일하다.)
freebsd-update.sh를 실행하는데, -f freebsd-update.conf 옵션만 추가되었을 뿐, 6.3 이상의 과정과 동일하게 진행하면 된다.
| |
# sh freebsd-update.sh -f freebsd-update.conf -r 6.4-RELEASE upgrade
Looking up update.FreeBSD.org mirrors... 2 mirrors found.
Fetching public key from update4.FreeBSD.org... done.
Fetching metadata signature for 6.2-RELEASE from update4.FreeBSD.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
... 생략 ...
| |
이후 sh freebsd-update.sh -f freebsd-update.conf install -> 리부팅 -> 다시 한번 install 명령 실행.
4. 패키지 업그레이드
OS는 업데이트가 완료되었고, 설치된 패키지를 업데이트할 것인지는 개인의 판단에 따라서 진행한다.
패캐지 업데이트 여부와 상관없이 ports 목록은 최신 것으로 업데이트한다. 그리고, pkg_version -vI (-I 옵션은 인덱스된 파일정보만으로 버전비교를 함)명령으로 설치된 버전과 최근 버전을 비교한다.
| |
# cd /usr/share/examples/cvsup
# cvsup -g -L 2 ports-supfile
#
# cd /usr/ports
# make fetchindex
#
# pkg_version -vI
| |
패키지 업그레이드는 꼭 자신의 환경을 살펴보고 판단을 해야하며, 업그레이드 방법은 다음과 같은 방법이 있을 것 같다.
1) 패키지 업그레이드를 하지 않는다. 필요시 한다.
2) 필요한 것만 설치하려면 'portupgrade 패키지명' 명령으로 업그레이드한다.
3) 설치된 전체 업그레이드하려면 portupgrade -af 명령을 내린다.
4) 설치된 패키지를 pkg_delete 로 지우고, 해당 포트 디렉토리에서 재컴파일해서 설치한다.
5) 설치된 패키지를 pkg_delete 로 지우고, 'pkg_add URL' 또는 'pkg_add 받아온패키지명'으로 설치한다.
5. 관련자료
* FreeBSD Handbook : Chapter 26 Updating FreeBSD
http://www.freebsd.org/doc/en/books/handbook/updating-freebsdupdate.html
* pkg_version man page
http://www.freebsd.org/cgi/man.cgi?query=pkg_version&sektion=1
* portupgrade man page
http://www.freebsd.org/cgi/man.cgi?query=portupgrade&sektion=1&apropos=0&manpath=FreeBSD+7.2-RELEASE+and+Ports
|