Download presentation
Presentation is loading. Please wait.
Published byAshley Elliott Modified over 8 years ago
1
FreeBSD
2
Computer Center, CS, NCTU 2 Outline FreeBSD version 8.1-RELEASE Installing FreeBSD From CD-ROM Build world and kernel Update source Rebuild world Rebuild kernel Software installation Appendix Csup
3
Computer Center, CS, NCTU 3
4
FreeBSD Version
5
Computer Center, CS, NCTU 5 FreeBSD Branches/Tags Three parallel development branches: -RELEASE Latest Release Version: –8.1 (July, 2010) –http://www.freebsd.org/releases/http://www.freebsd.org/releases/ -STABLE Tested new features and bug fixes 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/
6
Computer Center, CS, NCTU 6 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/
7
FreeBSD Installation
8
Computer Center, CS, NCTU 8 FreeBSD View of Disk (1) D-Disk NTFSLinux Swap MBR Partition 1 Partition 2 Partition 3 Partition 4 Windows 7 (NTFS) bsdlabel Label a Label b Label c Label d Extended Partiton Linux (EXT3FS) FreeBSD Here!!!
9
Computer Center, CS, NCTU 9 FreeBSD View of Disk (2) What is the meaning of ad0s1a Disk name ad:IDE, SATA da:SCSI, usb stick Slice is equal to the partition of common use Primary partition: s1 ~ s4 Extended partition: s5 ~ sn Label in each slice a: root partition / b: swap c: entire slice defgh: /usr, /home, … MBR Slice 1 (/dev/ad0s1) Slice 2 (/dev/ad0s2) Slice 3 (/dev/ad0s3) Slice 4 (/dev/ad0s4) Slice 5 (/dev/ad0s5) Slice 6 (/dev/ad0s6)
10
Computer Center, CS, NCTU 10 Installing FreeBSD Steps 1.Knowing your hardware 2.Obtaining installation file 3.Booting from CD/DVD/usb-stick 4.FreeBSD installer: sysinstall 1.Partition 2.Label 3.Distribution 4.Media 5.Commit 5.Post-installation configurations
11
Computer Center, CS, NCTU 11 Installing FreeBSD – 1. Knowing Your Hardware CPU 32bit or 64bit Intel 、 AMD Architecture: amd64, i386 (, ia64, pc98, powerpc, sparc64) RAM Size HD Size, amount, SCSI or IDE VGA Brand, ram size Sound Brand Network Interface Card Brand IP 、 Netmask 、 Default gateway 、 Hostname 、 DNS Other Special device pciconf -lv
12
Computer Center, CS, NCTU 12 Installing FreeBSD – 2. Obtaining Installation File FreeBSD installation CD ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-bootonly.isoftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-bootonly.iso ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-disc1.isoftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-disc1.iso ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-dvd1.iso.gzftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-dvd1.iso.gz ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-memstick.imgftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.1/FreeBSD-8.1- RELEASE-amd64-memstick.img Burn CD, DVD, or USB!
13
Computer Center, CS, NCTU 13 Installing FreeBSD – 3. Booting from CD (1)
14
Computer Center, CS, NCTU 14 Installing FreeBSD – 3. Booting from CD (2) Enter
15
Computer Center, CS, NCTU 15 Installing FreeBSD – 3. Booting from CD (3) Just use default or…
16
Computer Center, CS, NCTU 16 Installing FreeBSD – 3. Booting from CD (4) 這丟係愛台灣啦 !!!
17
Computer Center, CS, NCTU 17 Installing FreeBSD – 3. Booting from CD (5) Use USA ISO keymap because we don’t have our keyboard layout…
18
Computer Center, CS, NCTU 18 Installing FreeBSD – 4. FreeBSD Installer Being experts!
19
Computer Center, CS, NCTU 19 Installing FreeBSD – 4. FreeBSD Installer: Custom 5 major steps 3.Partition your disk 4.Label your disk 5.Choose what to install 6.Choose how to install 7.Do it!
20
Computer Center, CS, NCTU 20 If you have more than one disk … You can choose one to partition it. Installing FreeBSD – 4. FreeBSD Installer: Partition (1)
21
Computer Center, CS, NCTU 21 Create slice Press “ C ” to create a new slice / Press “ A ” to use entire disk Installing FreeBSD – 4. FreeBSD Installer: Partition (2)
22
Computer Center, CS, NCTU 22 Press “ S ” to toggle “freebsd” as bootable Press “ Q ” to next step (Select Boot Manager) Installing FreeBSD – 4. FreeBSD Installer: Partition (3)
23
Computer Center, CS, NCTU 23 Choose boot manager Standard Write to disk MBR BootMgr Install a simple boot manager to disk MBR None Leave it unchanged Installing FreeBSD – 4. FreeBSD Installer: Partition (4)
24
Computer Center, CS, NCTU 24 BSDlabel Editor Installing FreeBSD – 4. FreeBSD Installer: Label (1)
25
Computer Center, CS, NCTU 25 Create label in ad0s1 and specify size Press “C” to create bsdlabel swap, / ( and /home, /var, … ): size 、 type 、 mount point Press “S” to toggle SoftUpdates (async written to disk) Installing FreeBSD – 4. FreeBSD Installer: Label (2)
26
Computer Center, CS, NCTU 26 Press “Q” to next step (back to custom installation options menu) Installing FreeBSD – 4. FreeBSD Installer: Label (3)
27
Computer Center, CS, NCTU 27 Custom Installing FreeBSD – 4. FreeBSD Installer: Distributions (1)
28
Computer Center, CS, NCTU 28 Select base; binary kernels; Generic kernel supports SMP man; Manual src; FreeBSD Source Code ports; FreeBSD Software Collection Installing FreeBSD – 4. FreeBSD Installer: Distributions (2)
29
Computer Center, CS, NCTU 29 Installing FreeBSD – 4. FreeBSD Installer: Distributions (3)
30
Computer Center, CS, NCTU 30 Choose “1 CD/DVD” if you have 8.1 Release CD disk 1 or DVD Choose “3 FTP Passive” if your NIC is detected Choose “9 USB” if you have 8.1 memstick usb stick Installing FreeBSD – 4. FreeBSD Installer: Media
31
Computer Center, CS, NCTU 31 Install through FTP Passive Specify ftp server Installing FreeBSD – 4. FreeBSD Installer: Media (2)
32
Computer Center, CS, NCTU 32 Select NIC IPv6 and DHCP Installing FreeBSD – 4. FreeBSD Installer: Media (3)
33
Computer Center, CS, NCTU 33 Specify your IP information Installing FreeBSD – 4. FreeBSD Installer: Media (4)
34
Computer Center, CS, NCTU 34 Last Chance! We can take no responsibility for lost disk contents! Don’t forget backup! Installing FreeBSD – 4. FreeBSD Installer: Commit (1)
35
Computer Center, CS, NCTU 35 Start to format disk and install operating system You can press “ Alt + F2 ” to see the install detail There is a shell start in “ Alt + F4 ” Installing FreeBSD – 4. FreeBSD Installer: Commit (2)
36
Computer Center, CS, NCTU 36 Installing FreeBSD – 5. Post Installation Recommend you to do it! Root Password User and group management Time Zone Asia Taiwan Networking interfaces, sshd
37
Computer Center, CS, NCTU 37 Installing FreeBSD – 5. Post Installation: Root Password
38
Computer Center, CS, NCTU 38 Installing FreeBSD – 5. Post Installation: User Management (1) Create a group for users Create a user for yourself Least privilege
39
Computer Center, CS, NCTU 39 Installing FreeBSD – 5. Post Installation: User Management (2)
40
Computer Center, CS, NCTU 40 Installing FreeBSD – 5. Post Installation: User Management (3)
41
Computer Center, CS, NCTU 41 Installing FreeBSD – 5. Post Installation: Time Zone
42
Computer Center, CS, NCTU 42 Installing FreeBSD – 5. Post Installation: Networking (1) Interfaces
43
Computer Center, CS, NCTU 43 Installing FreeBSD – 5. Post Installation: Networking (2) sshd
44
Computer Center, CS, NCTU 44 Installing FreeBSD – 5. Post Installation: Done! Be sure to remove booting media. You would not want restart whole process again…
45
Computer Center, CS, NCTU 45 FreeBSD Handbook Chapter 2 Installing FreeBSD http://www.tw.freebsd.org/doc/en/books/handbook/install.html Chinese resources http://www.tw.freebsd.org/doc/zh_TW/books/handbook/install.html http://freebsddoc.twbbs.org https://opensvn.csie.org/traccgi/freebsddoc
46
Build world and kernel
47
Computer Center, CS, NCTU 47 Build World and Kernel Update source /etc/make.conf make update Build world mergemaster –p make buildworld Build and install kernel make buildkernel installkernel Install world make installworld mergemaster
48
Computer Center, CS, NCTU 48 Build World & Kernel – Prepare make.conf (1) Example make.conf /usr/share/examples/etc/make.conf Everything add in make.conf is used every time you run make # cp /usr/share/examples/etc/make.conf /etc/ # chmod u+w /etc/make.conf Edit /etc/make.conf
49
Computer Center, CS, NCTU 49 Build World & Kernel – Prepare make.conf (2) CPU optimization CPUTYPE?=core2
50
Computer Center, CS, NCTU 50 Update source SUP_UPDATE=yes SUP=/usr/bin/csup SUPFLAGS=-g –L 2 SUPHOST=cvsup.tw.freebsd.org SUPFILE=/usr/share/examples/cvsup/standard-supfile PORTSSUPFILE=/usr/share/examples/cvsup/ports-supfile Build World & Kernel – Prepare make.conf (3)
51
Computer Center, CS, NCTU 51 The canonical steps to update system # cd /usr/src && make update # mergemaster -p (Pre-buildworld mode) # cd /usr/src && make -s buildworld # cd /usr/src && make -s kernel (buildkernel, installkernel) Reboot and boot in single user mode # mount -u / # cd /usr/src && make -s installworld # mergemaster (or mergemaster -UFi) # reboot See build(7), mergemaster(8) Build World & Kernel – Canonical steps
52
Computer Center, CS, NCTU 52 Build World & Kernel – make buildworld Build FreeBSD entire system % make –s –j 5 buildworld >& /var/log/world.log & make –j n buildworld Spawn multiple (n) processes to do make. The compiling processes of make world is I/O bound.
53
Computer Center, CS, NCTU 53 Build World & Kernel – make buildkernel (1) Why rebuild kernel? Faster boot time. Probe only necessary device Lower memory usage Smaller kernel image Additional hardware support.
54
Computer Center, CS, NCTU 54 Build World & Kernel – make buildkernel (2) Edit kernel configuration file # cd /usr/src/sys/{i386,amd64}/conf GENERIC must have too much for your system # cp GENERIC YOUR_NAME We often use hostname to be YOUR_NAME Ex. # cp GENERIC SABSD 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
55
Computer Center, CS, NCTU 55 Build World & Kernel – make buildkernel (3) Set KERNCONF in /etc/rc.conf KERNCONF=SABSD Build kernel # make -s buildkernel
56
Computer Center, CS, NCTU 56 Build World & Kernel – make installkernel Install kernel # make -s installkernel make buildkernel && make installkernel = make buildkernel installkernel = make kernel
57
Computer Center, CS, NCTU 57 Build 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
58
Computer Center, CS, NCTU 58 Build World & Kernel – make installworld Install the built world % make installworld
59
Computer Center, CS, NCTU 59 Build World & Kernel – mergemaster mergemaster [ -UFi ] 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. -F Install the new file if the files differ only by VCS Id. -i Automatically install any files that do not exist.
60
Computer Center, CS, NCTU 60 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
61
Computer Center, CS, NCTU 61 If Something Goes Wrong … (1) Possible errors in building new kernel Configuration file # cd /usr/src/sys/{i386,amd64}/conf/ Edit YOUR_NAME Build fail? Install fail? Kernel does not boot Boot with old kernel, recompile kernel Kernel works, but ps does not work Rebuild world
62
Computer Center, CS, NCTU 62 If Something Goes Wrong … (2) Boot from old kernel “6. Escape to loader prompt” OK 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
63
Computer Center, CS, NCTU 63 Play with Your FreeBSD Useful commands passwd, chsh, chfn, chpass ls ps, top mkdir/rmdir cp/mv/rm write Manual: man, info, …etc. Email reader: mutt, …etc. News reader: tin Connecting: ssh/telnet Editor: vim, joe, ee, …etc. File Transmittion: ftp, ncftp, lftp, scp, wget, curl, …etc. Compilers: gcc, g++, javac, …etc. Scripting: perl, php, ruby, python …etc. login/exit/logout/screen
64
Computer Center, CS, NCTU 64 Help Yourself – man (1) man pages (manual) Contain descriptions of Individual command. –% man cp File format. –% man rc.local Library routines. –% man strcpy
65
Computer Center, CS, NCTU 65 Command % man [section] title % man printf(printf command) % man 3 printf (C Standard printf func.) % man –k exit(keyword search) Man pages organization AT&TBSDContents 11 User-Level commands and applications 22 System calls and kernel error code 33 Library calls 45 Standard file format 57 Miscellaneous files and documents 66 Games and demonstrations 74 Device Drivers and network protocols 1m8 System administration commands 99 Obscure kernel specs and interfaces %man man Help Yourself – man (2)
66
Computer Center, CS, NCTU 66 Conventions Syntax of commands: Anything between “[” & “]” – are optional. Anything followed by “…” – can be repeated. {a | b} – you should choose one of them. Example: bork [-x] { on | off } filename … bork on /etc/hosts ○ bork –x off /etc/hosts /etc/passwd ○ bork –x /etc/hosts X bork -h /etc/hosts X
67
Software Installation
68
Computer Center, CS, NCTU 68 Using FreeBSD Ports (1) Using ports Steps of install software (1) Figure out the path to the software –% cd /usr/ports –% make search key=mutt –% cd /usr/ports/chinese/mutt (2) Fetch and compile the source –% make install Uninstall % make deinstall
69
Computer Center, CS, NCTU 69 Using FreeBSD Ports (2) Ports cd /usr/ports make search make install clean ports-mgmt/psearch make search ports-mgmt/portmaster Use “portmaster chinese/mutt” to install.
70
Computer Center, CS, NCTU 70 Installing Useful Tools Try to install some software, such as: vim:editors/vim mutt:chinese/mutt wget:ftp/wget screen:sysutils/screen
71
Appendix
72
Computer Center, CS, NCTU 72 FreeBSD source Maintained in a CVS repository in California The tool to get the latest FreeBSD source CSup We can use CSup keep our FreeBSD source up-to-date with any FreeBSD mirror sites Edit CSup supfile Update source using CSup Up-to-date your system Build world & kernel using the updated source. Install softwares. Upgrade softwares.
73
Computer Center, CS, NCTU 73 FreeBSD source CSup Configuration file (1) Example csup supfiles /usr/share/examples/cvsup/standard-supfile /usr/share/examples/cvsup/ports-supfile Create your own supfiles Edit /usr/local/etc/src-supfile Edit /usr/local/etc/ports-supfile Edit /etc/make.conf to set your own supfiles
74
Computer Center, CS, NCTU 74 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_8_1 src-all host can be remained CHANGE_THIS.freebsd.org if you run make update, and you have SUPHOST in /etc/make.conf
75
Computer Center, CS, NCTU 75 FreeBSD source CSup Configuration file (3) CVS tags Branch Tags .(FreeBSD-CURRENT) RELENG_8(FreeBSD 8.1-STABLE) Release Tags RELENG_8_1(FreeBSD 8.1-RELEASE) To refer to a specific point in time RELENG_8_1_0_RELEASE http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/cvs-tags.html
76
Computer Center, CS, NCTU 76 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=.. means the latest ports tree ports-all
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.