Presentation is loading. Please wait.

Presentation is loading. Please wait.

SA-NA Junction FreeBSD. Computer Center, CS, NCTU 2 Outline  FreeBSD version  Installing FreeBSD  Update source and make world  Rebuild kernel.

Similar presentations


Presentation on theme: "SA-NA Junction FreeBSD. Computer Center, CS, NCTU 2 Outline  FreeBSD version  Installing FreeBSD  Update source and make world  Rebuild kernel."— Presentation transcript:

1 SA-NA Junction FreeBSD

2 Computer Center, CS, NCTU 2 Outline  FreeBSD version  Installing FreeBSD  Update source and make world  Rebuild kernel

3 Computer Center, CS, NCTU 3 FreeBSD Branches/Tags  Three parallel development branches: -RELEASE  Latest Release Version: –7.2 (May 2009), http://wiki.freebsd.org/Releng/7.3TODO –8.0 (November 2009) –http://www.freebsd.org/releases/http://www.freebsd.org/releases/ -STABLE  Tested new features and bug fixes –ABI-compatibility  MFC: Merge From Current -CURRENT  Working space for FreeBSD developers  Current version: –9.0-CURRENT –http://www.freebsd.org/releng/http://www.freebsd.org/releng/

4 Computer Center, CS, NCTU 4 FreeBSD version  FreeBSD-A.B.C – Type A: major version Number B: minor version Number C: slight patch version number Type: version type  PRERELEASE  BETA  RC  RELEASE  STABLE  CURRENT  Choosing the FreeBSD Version That Is Right For You: http://www.freebsd.org/doc/en/articles/version-guide/

5 Computer Center, CS, NCTU 5 FreeBSD Development Branches  Simultaneous parallel development  Divergence based on feature maturity  “MFC” merges changes from CURRENT to STABLE branches http://www.watson.org/~robert/freebsd/2007asiabsdcon/20070310-asiabsdcon2007-how-freebsd-works.pdf 5

6 Computer Center, CS, NCTU 6 FreeBSD Release Cycle  Most of the tome open development  Release cycle on STABLE branches Code slush Code freeze Beta series, branching (-BETA) Release candidate series (-RC) Release (-RELEASE) Errata/Security advisories  Big "dot zero" release less frequently http://www.watson.org/~robert/freebsd/2007asiabsdcon/20070310-asiabsdcon2007-how-freebsd-works.pdf 6

7 Computer Center, CS, NCTU 7 FreeBSD Release Engineering  Release Engineering Information http://www.freebsd.org/releng/  Upcoming Release Schedule March 2010FreeBSD 7.3 To be definedFreeBSD 8.1  Code-Freeze Status BranchStatusContactNotes HEADOpencommittersActive development branch for 9-CURRENT. RELENG_8OpencommittersDevelopment branch for 8-STABLE. RELENG_8_0Frozensecurity-officer@FreeBSD.orgFreeBSD 8.0 supported errata fix branch. RELENG_7Frozenre@FreeBSD.orgDevelopment branch for 7-STABLE. RELENG_7_2Frozensecurity-officer@FreeBSD.orgFreeBSD 7.2 supported errata fix branch. 7

8 Computer Center, CS, NCTU 8 Documentation  Handbook http://www.freebsd.org/doc/en/books/handbook/  Chinese resources http://freebsddoc.twbbs.org https://opensvn.csie.org/traccgi/freebsddoc  Wiki http://wiki.freebsd.org 8

9 Computer Center, CS, NCTU 9 Getting FreeBSD  http://www.freebsd.org/where.html  Taiwan Official Mirror Site ftp.tw.FreeBSD.org ftp://FreeBSD.cs.nctu.edu.tw  FTP site layout pub/FreeBSD/  ISO-IMAGES-*/ –(linked to ISO-IMAGES under release/ )  branches/ –7.0-stable/  releases/ –amd64/ –i386/ »7.2-RELEASE/ »ISO-IMAGES/7.2/ 7.2-RELEASE- -disk1.iso

10 Computer Center, CS, NCTU 10 Installing FreeBSD  Steps 1.Booting from CD/usb-stick 2.sysinstall main menu 3.Custom Installation Options 1.Partition 2.Label 3.Distribution 4.Media 5.Commit 4.Post Installation configurations

11 Computer Center, CS, NCTU 11 Installing FreeBSD – 1. Booting from CD (1)

12 Computer Center, CS, NCTU 12 Installing FreeBSD – 1. Booting from CD (2) Just press Enter “loader prompt”: some custom/special settings Ex: loading modules, loader tunables

13 Computer Center, CS, NCTU 13 Installing FreeBSD – 1. Booting from CD (3) Just use default or…

14 Computer Center, CS, NCTU 14 Installing FreeBSD – 1. Booting from CD (4) 這丟係愛台灣啦 !!!

15 Computer Center, CS, NCTU 15 Installing FreeBSD – 1. Booting from CD (5) Use USA ISO keymap because we don’t have our keyboard layout…

16 Computer Center, CS, NCTU 16 Installing FreeBSD – 2. sysinstall Main Menu  Being experts!

17 Computer Center, CS, NCTU 17 Installing FreeBSD – 3. Custom Installation Options  6 major steps 1.Change installation variables 2.Partition your disk 3.Label your disk 4.Choose what to install 5.Choose how to install 6.Do it!

18 Computer Center, CS, NCTU 18 Installing FreeBSD – 3. Custom Installation – options Only change things when you know what you're doing

19 Computer Center, CS, NCTU 19 Installing FreeBSD – 3. Custom Installation – partition (1)  If you have more than one disk … You can choose one to partition it.

20 Computer Center, CS, NCTU 20 Installing FreeBSD – 3. Custom Installation – partition (2)  Press “ A ” to use entire disk, and press “ S ” to toggle ad0s1 as bootable

21 Computer Center, CS, NCTU 21 Installing FreeBSD – 3. Custom Installation – partition (3) Choose boot manager  BootMgr  Install a simple boot manager to disk MBR  Standard  Write to disk MBR  None  Leave it unchanged After press OK, it will back to Custom Installation Options menu

22 Computer Center, CS, NCTU 22 More than 1 HDD Be aware which disk is your right target! 22 Installing FreeBSD – 3. Custom Installation – partition (4)

23 Computer Center, CS, NCTU 23 Installing FreeBSD – 3. Custom Installation – Label (1)  Disklabel Editor Move blue bar to select slice Press “C” to create disk label  swap, / ( and /home, /var, … ) –Specify size –Choose type (either swap or FS) –Specify mount point Press “S” to toggle SoftUpdates (async written to disk) Press “Q” to next step (back to custom installation options menu)

24 Computer Center, CS, NCTU 24 Installing FreeBSD – 3. Custom Installation – Label (2)  Create label in ad0s1 and specify size Swap: typically 2x~2.5x of your memory size, but this is not the absolute rule! Data storage: For learning, ‘/’ is enough.

25 Computer Center, CS, NCTU 25 Installing FreeBSD – 3. Custom Installation – Label (3) Complete disklabel

26 Computer Center, CS, NCTU 26 Installing FreeBSD – 3. Custom Installation – distri. (1)  Choose Distributions Menu Choose “Custom”

27 Computer Center, CS, NCTU 27 Installing FreeBSD – 3. Custom Installation – distri. (2)  Select base; binary kernels; Generic kernel supports SMP man; Manual src; FreeBSD Source Code ports; FreeBSD Software Collection local; local additions Minimum requirement: base and kernels Also be good: src and ports

28 Computer Center, CS, NCTU 28 Installing FreeBSD – 3. Custom Installation – distri. (3)

29 Computer Center, CS, NCTU 29 Installing FreeBSD – 3. Custom Installation – Media (1) Choose CD/DVD if you have 7.2 Release CD disk 1 Choose FTP if your NIC is detected  Choose FTP Passive if you in private network

30 Computer Center, CS, NCTU 30 Installing FreeBSD – 3. Custom Installation – Media (2)  Install through FTP Specify ftp server

31 Computer Center, CS, NCTU 31 Installing FreeBSD – 3. Custom Installation – Media (3) Select NIC IPv6 and DHCP

32 Computer Center, CS, NCTU 32 Installing FreeBSD – 3. Custom Installation – Media (4) Specify your IP information Press “OK” to next step

33 Computer Center, CS, NCTU 33 Installing FreeBSD – 3. Custom Installation – Commit (1)  Start to format disk 、 make file system and install software  You can press “ Alt + F2 ” to see the install detail  There is a shell start in “ Alt + F4 ”

34 Computer Center, CS, NCTU 34 Installing FreeBSD – 3. Custom Installation – Commit (2)  Last Chance! We can take no responsibility for lost disk contents! Don’t forget backup!

35 Computer Center, CS, NCTU 35 Installing FreeBSD – 4. Post Installation (1)  Recommend you to do it! Root Password User and group management Time Zone  Asia  Taiwan Networking  interface, sshd

36 Computer Center, CS, NCTU 36 Installing FreeBSD – 4. Post Installation (2)

37 Computer Center, CS, NCTU 37 Installing FreeBSD – 4. Post Installation (3) User and group management

38 Computer Center, CS, NCTU 38 Installing FreeBSD – 4. Post Installation (4)

39 Computer Center, CS, NCTU 39  Is BIOS time UTC? No.  Asia  Taiwan  CST? Yes. Installing FreeBSD – 4. Post Installation (5)

40 Computer Center, CS, NCTU 40 Installing FreeBSD – 4. Post Installation (6)  Interfaces  sshd

41 Computer Center, CS, NCTU 41 Installing FreeBSD – 4. Post Installation (7)

42 Computer Center, CS, NCTU 42 Installing FreeBSD – 4. Post Installation (8)  Be sure to remove booting media. You would not want restart whole process again…

43 Keeping Updating Build world and kernel

44 Computer Center, CS, NCTU 44 FreeBSD source  Maintained in a CVS repository in California  Use CSup to keep our FreeBSD source up-to-date with any FreeBSD mirror sites Edit supfiles Update source  Up-to-date your system Build world & kernel using the updated source Upgrade 3 rd party softwares

45 Computer Center, CS, NCTU 45 FreeBSD source CSup Configuration file (1)  Example csup supfile /usr/share/examples/cvsup/standard-supfile /usr/share/examples/cvsup/ports-supfile  Create your own supfile Edit /usr/local/etc/src-supfile Edit /usr/local/etc/ports-supfile

46 Computer Center, CS, NCTU 46 FreeBSD source CSup Configuration file (2)  /usr/local/etc/src-supfile *default host=freebsd.cs.nctu.edu.twWhere to get source *default base=/usrWhere to put status file *default prefix=/usrWhere to put source *default delete use-rel-suffixAllow cvs to delete *default compressCompress before transmit *default release=cvs tag=RELENG_7_2 src-all

47 Computer Center, CS, NCTU 47 FreeBSD source CSup Configuration file (3)  CVS tags Branch Tags .(FreeBSD-CURRENT)  RELENG_8(FreeBSD 8-STABLE)  RELENG_7(FreeBSD 7-STABLE) Release Tags  RELENG_8_0(FreeBSD 8.0-RELEASE)  RELENG_7_2(FreeBSD 7.2-RELEASE) To refer to a specific point in time  RELENG_8_0_0_RELEASE  RELENG_7_2_0_RELEASE http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvs-tags.html

48 Computer Center, CS, NCTU 48 FreeBSD source CSup Configuration file (4)  /usr/local/etc/ports-supfile *default host=freebsd.cs.nctu.edu.tw *default base=/usr *default prefix=/usr *default delete use-rel-suffix *default compress *default release=cvs tag=. ports-all

49 Computer Center, CS, NCTU 49 FreeBSD source CSup Configuration file (5)  you can put them all together in /usr/local/etc/all-supfile *default host=freebsd.cs.nctu.edu.tw *default base=/usr *default prefix=/usr *default delete use-rel-suffix *default compress *default release=cvs tag=RELENG_7_2 src-all ports-all tag=.

50 Computer Center, CS, NCTU 50 FreeBSD source Update source using CSup  Update both src and ports % /usr/bin/csup -L 1 /usr/local/etc/all-supfile > /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

51 Computer Center, CS, NCTU 51 Rebuilding world & kernel – Prepare make.conf (1)  Example make.conf /usr/share/examples/etc/make.conf5.x ~ Everything add in make.conf is used every time you run make KERNCONF=NABSD CPUTYPE?=core2 man make.conf has detail descriptions of it Available CPUTYPE: See /usr/share/mk/bsd.cpu.mk

52 Computer Center, CS, NCTU 52  /etc/make.conf SUP_UPDATE=yes SUP=/usr/bin/csup SUPFLAGS=-L 2 SUPFILE=/usr/local/etc/src-supfile PORTSSUPFILE=/usr/local/etc/ports-supfile KERNCONF=NABSD CPUTYPE?=core2 Rebuilding world & kernel – Prepare make.conf (2)

53 Computer Center, CS, NCTU 53 Rebuilding world & kernel The canonical steps to update system (Read /usr/src/UPDATING) cd /usr/src make update mergemaster -p (Pre-buildworld mode) make -s buildworld make -s kernel (buildkernel, installkernel) (reboot and boot in single user mode) make installworld mergemaster (or mergemaster -Ui) (make check-old, make delete-old) reboot  usr/src/Makefile, mergemaster(8)

54 Computer Center, CS, NCTU 54 Rebuilding world & kernel – make buildkernel (1)  Why rebuild kernel? Faster boot time.  Probe only necessary device Lower memory usage  Smaller kernel image Additional hardware support.

55 Computer Center, CS, NCTU 55 Rebuilding world & kernel – make buildkernel (2)  Edit kernel config file cd /usr/src/sys/{i386,amd64}/conf  GENERIC may not have all for your system  LINT has every options %use “ make LINT ” to generte the LINT file cp GENERIC “YOUR-NAME”  We often use hostname to be “ YOUR-NAME ” edit config file  Depend on your system  Be attention to related options  Following the explanation of http://www.freebsd.org/doc/en_US.ISO8859- 1/books/handbook/kernelconfig-config.html http://www.freebsd.org/doc/en_US.ISO8859- 1/books/handbook/kernelconfig-config.html

56 Computer Center, CS, NCTU 56 Rebuilding world & kernel – make buildkernel (3)  Build kernel % cd /usr/src % make KERNCONF=NABSD buildkernel If the KERNCONF=“YOUR-NAME” has been set in your make.conf You can use “make buildkernel” instead

57 Computer Center, CS, NCTU 57 Rebuilding world & kernel – make installkernel  Install kernel % cd /usr/src % make KERNCONF=NABSD installkernel make buildkernel && make installkernel = make buildkernel installkernel = make kernel

58 Computer Center, CS, NCTU 58 Rebuilding world & kernel – reboot into single user mode  Boot in single user mode Press “4” Or % shutdown now  For a running system, this will drop it to single user mode

59 Computer Center, CS, NCTU 59 Rebuilding world – make installworld  Mount filesystems % mount -a  Install the built world % make installworld

60 Computer Center, CS, NCTU 60 Rebuilding world – mergemaster  mergemaster [ -U ] 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.* -U Attempt to auto upgrade files that have not been user modified.

61 Computer Center, CS, NCTU 61 Reboot  Reboot and enjoy it % reboot  Check % uname –ai  Handbook Chapter 8 Configuring the FreeBSD Kernel  http://www.freebsd.org/doc/en/books/handbook/kernelconfig.html http://www.freebsd.org/doc/en/books/handbook/kernelconfig.html 23.4 Rebuilding “world”  http://www.freebsd.org/doc/en/books/handbook/makeworld.html http://www.freebsd.org/doc/en/books/handbook/makeworld.html

62 Computer Center, CS, NCTU 62 If Something Goes Wrong … (1)  Possible errors in building new kernel Configuration file  % cd /usr/src/sys/i386/conf/  % config SABSD make fail Install fail Kernel does not boot  Boot with old kernel, recompile kernel Kernel works, but ps does not work  Rebuild world

63 Computer Center, CS, NCTU 63 If Something Goes Wrong … (2)  Boot from old kernel “6. Escape to loader prompt” Boot /boot/kernel.old/kernel cd /boot cp -R kernel.old kernel.ok rm -rf kernel mv kernel.old kernel  Handbook 8.7 If Something Goes Wrong  http://www.freebsd.org/doc/en/books/handbook/kernelconfig- trouble.html http://www.freebsd.org/doc/en/books/handbook/kernelconfig- trouble.html

64 Make FreeBSD More Usable Install 3 rd party softwares

65 Computer Center, CS, NCTU 65 FreeBSD ports/package  Package Pre-built ports pkg_add, pkg_delete, pkg_deinstall, pkg_info, pkg_version  Ports cd /usr/ports, make search, make install clean ports/ports-mgmt/portupgrade  portinstall, portupgrade, portversion  /usr/local/etc/pkgtools.conf Ports/ports-mgmt/portmaster 65

66 Computer Center, CS, NCTU 66 CVSup Configuration File  /usr/share/examples/cvsup/ ports-supfile *default host=cvsup.tw.FreeBSD.org *default base=/var/db *default prefix=/usr *default release=cvs tag=. *default delete use-rel-suffix 66

67 Computer Center, CS, NCTU 67 Updating Ports Tree  Update your ports tree every time you want to install/upgrading software  Read /usr/ports/UPDATING  CVSup  csup  cd /usr/ports && make update && make fetchindex 67

68 Computer Center, CS, NCTU 68 portsnap  /etc/portsnap.conf portsnap.freebsd.org -> portsnap.tw.freebsd.org  first time portsnap fetch extract  update portsnap fetch update  portsnap(8) 68

69 Computer Center, CS, NCTU 69 Ports system  Find your application cd /usr/ports make search name=program name make search key=string  change to the directory for the port you want to install  Type "make install clean" to install your application make make install make clean  /usr/ports/Mk/bsd.port.mk "Default targets and their behaviors" 69

70 Computer Center, CS, NCTU 70 Package System  pkg_add(1) pkg_add pkg_name  # pkg_add lsof-4.56.4.tgz pkg_add -r pkg_name  If you don't have a source of local packages  If you are using FreeBSD-CURRENT or FreeBSD-STABLE, pkg_add will download the latest version of your application  If your are using FreeBSD-RELEASE, it will grab the version of the package that was built with your release  PACKAGESITE environment variable 70

71 Computer Center, CS, NCTU 71  pkg_info(1)  pkg_version(1)  pkg_delete(1) # pkg_delete xchat-1.7.1 x:~ -lwhsu- pkg_info adns-1.4 Easy to use, asynchronous-capable DNS client library and ut amap-5.2 Application mapper apache-2.2.6_1 Version 2.2 of Apache web server with prefork MPM. apr-gdbm-db42-1.2.7_1 The Apache Group's Portability Library autoconf-2.61_2 Automatically configure source code on many Un*x platforms x:~ -lwhsu- pkg_version -IvL = adns-1.4 < needs updating (index has 1.4_1) apache-2.2.6_1 < needs updating (index has 2.2.9) apr-gdbm-db42-1.2.7_1 < needs updating (index has 1.3.3.1.3.4) autoconf-2.61_2 < needs updating (index has 2.62) Managing Packages

72 Computer Center, CS, NCTU 72 More port utilities  All under "ports-mgmt" catalog  Search ports Psearch  Delete unnecessary ports pkg_cutleaves pkg_rmleaves  Upgrading portsupgrade Portmaster  Security portaudit 72

73 Miscellaneous

74 Computer Center, CS, NCTU 74 __FreeBSD_version values  /usr/src/sys/sys/param.h  http://www.freebsd.org/doc/en_US.ISO8859-1/ books/porters-handbook/freebsd-versions.html /* * __FreeBSD_version numbers are documented in the Porter's Handbook. * If you bump the version for any reason, you should update the documentation * there. * Currently this lives here: * * doc/en_US.ISO8859-1/books/porters-handbook/book.sgml * * scheme is: Rxx * 'R' is 0 if release branch or x.0-CURRENT before RELENG_*_0 * is created, otherwise 1. */ #undef __FreeBSD_version #define __FreeBSD_version 701100 /* Master, propagated to newvers */

75 Computer Center, CS, NCTU 75 Maintenance  Root Mails Daily run output Security run output  packages with security vulnerabilities Monthly run output  Read mailing-lists -announce -stable -ports -cvs -svn 75


Download ppt "SA-NA Junction FreeBSD. Computer Center, CS, NCTU 2 Outline  FreeBSD version  Installing FreeBSD  Update source and make world  Rebuild kernel."

Similar presentations


Ads by Google