FreeBSD - people.cs.nctu.edu.twhuanghs/course/... · TU 8 FreeBSD View of Disk (2) What is the...
Transcript of FreeBSD - people.cs.nctu.edu.twhuanghs/course/... · TU 8 FreeBSD View of Disk (2) What is the...
FreeBSD
changlp
Com
pute
r Cente
r, CS
, NC
TU
2
Outline
FreeBSD version
• 8.2-RELEASE
Installing FreeBSD
• From CD-ROM
FreeBSD Version
Com
pute
r Cente
r, CS
, NC
TU
4
FreeBSD Branches/Tags
Three parallel development branches:
• -RELEASE
Latest Release Version:
– 8.2 (Feb, 2011)
– http://www.freebsd.org/releases/
Upcoming 9.0
• -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/
Com
pute
r Cente
r, CS
, NC
TU
5
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/
FreeBSD Installation
Com
pute
r Cente
r, CS
, NC
TU
7
FreeBSD view of Disk (1)
D-Disk
NTFS
Linux Swap
MBR
Slice 1 (ad0s1)
Slice 2 (ad0s2)
Slice 3 (ad0s3)
Slice 4
(ad0s4)
Windows XP (NTFS)
bsdlabel
ad0s3a
ad0s3b
ad0s3c
ad0s3d
ad0s3e
/ (root)
swap
/home
Extended Partiton
Linux (EXT3FS)
Com
pute
r Cente
r, CS
, NC
TU
8
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)
Com
pute
r Cente
r, CS
, NC
TU
9
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
Com
pute
r Cente
r, CS
, NC
TU
10
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
Com
pute
r Cente
r, CS
, NC
TU
11
Installing FreeBSD –
2. Obtaining Installation File
FreeBSD installation CD
• ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-
RELEASE-amd64-bootonly.iso
• ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-
RELEASE-amd64-disc1.iso
• ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-
RELEASE-amd64-dvd1.iso.xz
• ftp://ftp.tw.freebsd.org/pub/ISO-IMAGES-amd64/8.2/FreeBSD-8.2-
RELEASE-amd64-memstick.img
• Burn CD, DVD, or USB!
Com
pute
r Cente
r, CS
, NC
TU
12
Installing FreeBSD –
3. Booting from CD (1)
Com
pute
r Cente
r, CS
, NC
TU
13
Installing FreeBSD –
3. Booting from CD (2)
Enter
Com
pute
r Cente
r, CS
, NC
TU
14
Installing FreeBSD –
3. Booting from CD (3)
Just use default or…
Com
pute
r Cente
r, CS
, NC
TU
15
Installing FreeBSD –
3. Booting from CD (4)
這丟係愛台灣啦!!!
Com
pute
r Cente
r, CS
, NC
TU
16
Installing FreeBSD –
3. Booting from CD (5)
Use USA ISO keymap because we don’t have our keyboard layout…
Com
pute
r Cente
r, CS
, NC
TU
17
Installing FreeBSD –
4. FreeBSD Installer
Being experts!
Com
pute
r Cente
r, CS
, NC
TU
18
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!
Com
pute
r Cente
r, CS
, NC
TU
19
If you have more than one disk…
• You can choose one to partition it.
Installing FreeBSD –
4. FreeBSD Installer: Partition (1)
Com
pute
r Cente
r, CS
, NC
TU
20
Create slice
• Press “C” to create a new slice / Press “A” to use entire disk
Installing FreeBSD –
4. FreeBSD Installer: Partition (2)
Com
pute
r Cente
r, CS
, NC
TU
21
Press “S” to toggle “freebsd” as bootable
Press “Q” to next step (Select Boot Manager)
Installing FreeBSD –
4. FreeBSD Installer: Partition (3)
Com
pute
r Cente
r, CS
, NC
TU
22
• 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)
Com
pute
r Cente
r, CS
, NC
TU
23
BSDlabel Editor
Installing FreeBSD –
4. FreeBSD Installer: Label (1)
Com
pute
r Cente
r, CS
, NC
TU
24
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)
Com
pute
r Cente
r, CS
, NC
TU
25
• Press “Q” to next step (back to custom installation options menu)
Installing FreeBSD –
4. FreeBSD Installer: Label (3)
Com
pute
r Cente
r, CS
, NC
TU
26
Custom
Installing FreeBSD –
4. FreeBSD Installer: Distributions (1)
Com
pute
r Cente
r, CS
, NC
TU
27
Installing FreeBSD –
4. FreeBSD Installer: Distributions (2)
Com
pute
r Cente
r, CS
, NC
TU
28
Installing FreeBSD –
4. FreeBSD Installer: Distributions (3)
Select
• base ; binary
• kernels ; Generic kernel supports SMP
• man ; Manual
• src ; FreeBSD Source Code
• ports ; FreeBSD Software Collection
Com
pute
r Cente
r, CS
, NC
TU
29
• Choose “1 CD/DVD” if you have 8.2 Release CD disk 1 or DVD
• Choose “3 FTP Passive” if your NIC is detected
• Choose “9 USB” if you have 8.2 memstick usb stick
Installing FreeBSD –
4. FreeBSD Installer: Media
Com
pute
r Cente
r, CS
, NC
TU
30
Install through FTP Passive
• Specify ftp server
Installing FreeBSD –
4. FreeBSD Installer: Media (2)
Com
pute
r Cente
r, CS
, NC
TU
31
• Select NIC
• IPv6 and DHCP
Installing FreeBSD –
4. FreeBSD Installer: Media (3)
Com
pute
r Cente
r, CS
, NC
TU
32
• Specify your IP information
Installing FreeBSD –
4. FreeBSD Installer: Media (4)
Com
pute
r Cente
r, CS
, NC
TU
33
Installing FreeBSD –
4. FreeBSD Installer: Commit (1)
Just do it!
Com
pute
r Cente
r, CS
, NC
TU
34
Last Chance!
• We can take no responsibility for lost disk contents!
• Don’t forget backup!
Installing FreeBSD –
4. FreeBSD Installer: Commit (2)
Com
pute
r Cente
r, CS
, NC
TU
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 (3)
Com
pute
r Cente
r, CS
, NC
TU
36
Installing FreeBSD –
5. Post Installation
Recommend you to do it!
• Root Password
• User and group management
• Time Zone Asia Taiwan
• Networking interfaces, sshd
Com
pute
r Cente
r, CS
, NC
TU
37
Installing FreeBSD –
5. Post Installation: Root Password
Com
pute
r Cente
r, CS
, NC
TU
38
Installing FreeBSD –
5. Post Installation: User Management (1)
Create a group for users
Create a user for yourself
• Least privilege
Com
pute
r Cente
r, CS
, NC
TU
39
Installing FreeBSD –
5. Post Installation: User Management (2)
Com
pute
r Cente
r, CS
, NC
TU
40
Installing FreeBSD –
5. Post Installation: User Management (3)
Com
pute
r Cente
r, CS
, NC
TU
41
Installing FreeBSD –
5. Post Installation: Time Zone
Com
pute
r Cente
r, CS
, NC
TU
42
Installing FreeBSD –
5. Post Installation: Networking (1)
Interfaces
Com
pute
r Cente
r, CS
, NC
TU
43
Installing FreeBSD –
5. Post Installation: Networking (2)
sshd
Com
pute
r Cente
r, CS
, NC
TU
44
Installing FreeBSD –
5. Post Installation: Done!
Be sure to remove booting media.
• You would not want restart whole process again…
Com
pute
r Cente
r, CS
, NC
TU
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
Com
pute
r Cente
r, CS
, NC
TU
46
Login
SSH (Secure Shell)
• PuTTY:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
• Chinese Environment:
http://www.cs.nctu.edu.tw/help/putty.html
Com
pute
r Cente
r, CS
, NC
TU
47
Play with Your FreeBSD
Useful commands
• passwd, chsh, chfn, chpass
• ls
• ps, top
• mkdir/rmdir
• cp/mv/rm
• write
• man
• login/exit/logout/screen
• Editor: ee, vim, joe, …etc.
• Connecting: ssh/telnet
• Email reader: mutt, …etc.
• News reader: tin
• File Transmittion: ftp, ncftp, lftp, scp, wget, curl, …etc.
• Compilers: gcc, g++, javac, …etc.
• Scripting: perl, php, ruby, python …etc.
Com
pute
r Cente
r, CS
, NC
TU
48
Help Yourself – man (1)
man pages (manual)
• Contain descriptions of
Individual command.
– % man cp
File format.
– % man rc.local
Library routines.
– % man strcpy
Com
pute
r Cente
r, CS
, NC
TU
49
Command
• % man [section] title
% man printf (printf command)
% man 3 printf (C Standard printf func.)
% man –k exit (keyword search)
Man pages organization
AT&T BSD Contents
1 1 User-Level commands and applications
2 2 System calls and kernel error code
3 3 Library calls
4 5 Standard file format
5 7 Miscellaneous files and documents
6 6 Games and demonstrations
7 4 Device Drivers and network protocols
1m 8 System administration commands
9 9 Obscure kernel specs and interfaces
%man man
Help Yourself – man (2)
Com
pute
r Cente
r, CS
, NC
TU
50
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