Saturday, November 26, 2016

FreeBSD Simple Info

FreeBSD Simple Info


1. ????.cshrc??



???????.cshrc??.





#csh .cshrc file



alias h history 25

alias j jobs -l

alias la ls -a

alias lf ls -FA

alias ll ls -lA

alias su su -m



setenv EDITOR vi

setenv EXINIT set autoindent

setenv PAGER more



set path = (~/bin /bin /usr/{bin,games} /usr/local/bin /usr/X11R6/bin)



if ($?prompt) then

# An interactive shell -- set some stuff up

set filec

set history = 1000

set ignoreeof

set mail = (/var/mail/$USER)

set mch = `hostname -s`

set prompt = "${mch:q}: {!} "

umask 2

endif



path??????shell????????????. ??????????

?????????????????. ?????????????.



???????????????????. ???????????. ??

??????????path????, ??????????????????

?.



?????????????, ??????????"./" . ??, ??

/usr/local/www/cgi-bin/?????????????. ???getdata.pl,

???getdata.pl, ?????????HTML??, ???????????

?, getdata.pl: Command not found. ??????path???????"."

??. ?????????????:



./getdata.pl



?????????HTML. ?????????, ????????????

?????.



?? TCSH ???



???????, tcsh?csh??????????????????????.

?????????tcsh????.cshrc?????:





#tcsh .tcshrc file



alias h history 25

alias j jobs -l

alias la ls -a

alias lf ls -FA

alias ll ls -lF

#alias su su -m -- bad for suing to root..



setenv EDITOR vim

setenv PAGER less



set path = ( ~/bin /usr/local/bin /bin /usr/{bin,games} /usr/sbin /sbin /usr/local/samba/bin /usr/X11R6/bin /usr/local/java/bin .)



setenv IRCNICK ringzero

setenv IRCSERVER irc2.magic.ca

setenv NNTPSERVER news.sentex.ca



if ($?prompt) then

# An interactive shell -- set some stuff up

set filec

set fignore = .o # ignore object files for filec

set showmatch # for programming

set history = 100

set savehist = 75 # tcsh version of history..

set ignoreeof

set mail = (/var/mail/$USER)

set prompt="vinyl:{%h}%~ %% " # tcsh version of above!



set watch = (1 gabor any mike any adrian any pwardrop any)



umask 2

endif



???????????setenv??. ??????, ???????????

???irc??????????. ??????????set fignore = .o , ?

??file completion(set filec)(???: ??tcsh????,??????file

completion ????bash????????,??????,???????)??

???".o"???. ??????C?????????, ??????????

".c"?????".o"??. set showmatch ? tcsh ??????file completion

??. ??????, ?????! set prompt ?????shell??????

??????. ???????????????. ???????:



mark:{123}~ % cd /usr/src

mark:{124}/usr/src %



?????????home??. ??????????tsch?csh???, ???

????,??????man tcsh! ????shells???(??tcsh?"watch"??)

??man page?. ?????????????????!



??:



????????.cshrc??, ????source .cshrc????

??????!



2. ??????????(Virtual Terminals)



(???: ?????????Virtual Terminals???????,

???????Pseudo terminals???????)



????????????????????????. ?????????

????, ??????????. ????????4?????, ???3?

??.?ALT?F2?F3(F1???????)????????????????.

??????????????, ???????????????????.

?ALT?F1???????.



????????, ????????????/dev??. ????MAKEDEV

??. MAKEDEV???shell??, ?????sh shell???????. ????

???:



cd /dev



sh MAKEDEV vty 16



??:



(???????MAKEDEV, ?????????)



????16??????. ?????ALT+F????. (???: ??F???12?)

???????????????/etc/ttys???????. ??/etc/?????

?vi???/etc/ttys??.



cd /etc



vi ttys



#

# $Id: ttys,v 1.2 1998/09/02 01:34:57 brian Exp $

# @(#)ttys 5.1 (Berkeley) 4/17/89

#

# name gettytype status comments

#

# This entry needed for asking password when init goes to single-user mode

# If you want to be asked for password, change "secure" to "insecure" here

console noneunknown off secure

#

ttyv0 "/usr/libexec/getty Pc" cons25 on secure

# Virtual terminals

ttyv1 "/usr/libexec/getty Pc" cons25 on secure

ttyv2 "/usr/libexec/getty Pc" cons25 on secure

#ttyv3 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure

ttyv3 "/usr/libexec/getty Pc" cons25 on secure

ttyv4 "/usr/libexec/getty Pc" cons25 on secure

ttyv5 "/usr/libexec/getty Pc" cons25 on secure

ttyv6 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure

# Serial terminals

# The dialup keyword identifies dialin lines to login, fingerd etc.

ttyd0 "/usr/libexec/getty std.9600" dialup off secure

ttyd1 "/usr/libexec/getty std.9600" dialup off secure

ttyd2 "/usr/libexec/getty std.9600" dialup off secure

ttyd3 "/usr/libexec/getty std.9600" dialup off secure

# Pseudo terminals

ttyp0 none network secure

ttyp1 none network secure

ttyp2 none network secure

ttyp3 none network

(???: ???????, ?????/etc/ttys?????)



?????X window, ??????????????. ?????,

ttyv4 ????.



?????Virtual Terminals???????. ??????16???

?????, ??????16?????????. ?????/etc/ttys

?????16???????????; ?????4?. ???????

????????:



ttyv2 "/usr/libexec/getty Pc" cons25 on secure



?????????yy???j???????12p???????12?.??

???ttyv2?12???, ????????????. ?4??,???5,6,

7,8,9,a,b,c,d,e,f.



??????/etc/ttys?????ttyv1 - ttyvf??????.



?vi??????????????,??????????????r??

?????????,???j?????????????.



??????ZZ??vi. ?????init??. ?????????:

kill -HUP 1



????????????????.



3. ??????



??????????. ????????, ?????????.(??,

??????????????). ??????????.



??????FreeBSD,FreeBSD???????????????. ????

???"-c"??reboot. ?????????visual config????????

??. ????????????????????????IDE??????

???,?????SCSI??????????????SCSI???. ????

??????*??*?????, ???visual config????????. ?

????????????????????.



????????????, ?????????dmesg. ????????

??.



/usr/> dmesg | more



??????SCSI???, ????????SCSI BIOS?????????

SCSI termination.



??????????, ?????FreeBSD?????.



******************************************************************



???????????????????????. ??????????

????????????????DOS FAT????. ??????, ???

??????????sd1, ??????????SCSI???(?SCSI ID 1).

???????FAT??:



dd if=/dev/zero of=/dev/rsd1 count=100



???????????"disk label". ???????????FreeBSD?

??:



disklabel -Brw sd1 auto



*?rsd1?sd1?????????,???????????????????.

????????????, ?FreeBSD????????. ??????????

??fdisk.



??????FreeBSD???????????, ????? disklabel ???

??????????, ???????disklabel???????????.??

???????????????, ??.



?????IDE??disklabel:



disklabel -e wd0



# /dev/rwd0c:

type: ESDI

disk: wd0s1

label:

flags:

bytes/sector: 512

sectors/track: 51

tracks/cylinder: 13

sectors/cylinder: 663

cylinders: 722

sectors/unit: 479298

rpm: 3600

interleave: 1

trackskew: 0

cylinderskew: 0

headswitch: 0 # milliseconds

track-to-track seek: 0 # milliseconds

drivedata: 0



8 partitions:

# size offset fstype [fsize bsize bps/cpg]

a: 65536 0 4.2BSD 0 0 0 # (Cyl. 0 - 98*)

b: 85936 65536 swap # (Cyl. 98*- 228*)

c: 479298 0 unused 0 0 # (Cyl. 0 - 722*)

e: 61440 151472 4.2BSD 0 0 0 # (Cyl. 228*- 321*)

f: 266386 212912 4.2BSD 0 0 0 # (Cyl. 321*- 722*)





?????????,????????. ?????????,???????

???????????????????(cylinders)?. size ???????

?. offset ?????????????. ?? a ???0??. ??????

??????????????????. ??????????, tracks/cylinder

(???????)??sectors/cylinder(???????)??????????

???.(???*???*???=????) ??offset????, ??????

???????offset.(Size+Offset=?????Offset)



fstype????????????????. FreeBSD??????????

4.2BSD. swap????????????. FAT?DOS?????????.??a

???????,????????????.



?? b ???????. ????offset 0??. ???????????

?. ?? e ???offset 0 ???????????, ??????????

?? e ???.



?? c ?????. ????c??????????.



????newfs?????????????. ???????????, ??

?disklabel ?????c??.



newfs /dev/rsd1c



c????????? - ????????????????????????.



??????????, ???????????newfs???????,???

???.



??,???mount???. ??????????mkdir???"mount point"

/d2 .



mount /dev/sd1c /d2



????, ???????????:



#vinyl % df -k



Filesystem 1K-blocks Used Avail Capacity Mounted on

/dev/sd0a 31775 13530 15703 46% /

/dev/sd0s1f 1913091 1086207 673837 62% /usr

/dev/sd0s1e 29727 12663 14686 46% /var

procfs 4 4 0 100% /proc

/dev/sd1c 4108717 616594 3163426 16% /d2



?????/etc/fstab????????????????????mount.

???????????mount. ????????????fstab??,??

????.



?????man page???: fstab mount disklabel dmesg dd ? newfs





4. ????????



4.1 ???????????

4.2 ??????

4.3 (??)??daemon & NFS??

4.4 ????????

4.5 ??????(NIS)??

4.6 ??????

4.7 ???????

4.8 ??????

4.9 Allow local configuration override at the very end here



??:



?????????????????. ??????????



4.1 ???????????



swapfile="NO"



# ?????????,??????????????.

# Set to name of swapfile if aux swapfile desired.



apm_enable="NO"



??????APM(??????)??YES



pccard_enable="NO"



???PCCARD??????YES.



pccard_mem="DEFAULT"



??ccard_enable=YES, ????????.



pccard_ifconfig="NO"



???pccard?????(?? NO).



local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d"



??????.?????,FreeBSD???????,????????

??.???Windows??"??"???.local_startup???????

????????????.???????,???????.????

?????,?????????.???/etc/rc.local???????

????.





4.2. ??????



??????:



hostname="myname.my.domain"



???????. ?????Internet?????????.????

???????DNS??.



nisdomainname="NO"



?? NIS ? ???? NIS (?? NO).



firewall="NO"



????? (?? /etc/rc.firewall) ?? NO.



tcp_extensions="YES"



# ?? RFC1323 & RFC1544 ?? (?? NO).



network_interfaces="lo0"



??????????????.?????????.lo0

???(loopback)?????"localhost".??,??ed0

(NE2000)?fxp0(Intel Ether Express)?????.



ifconfig_lo0="inet 127.0.0.1"



???????????????.



ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff"



??lo0?localhost??????.



4.3. (??)??daemon & NFS??:



syslogd_enable="YES"



Syslog ???????.??????????/var/log/.??

/etc/syslog.conf???.



syslogd_flags=""



# syslogd ????? (?????).



inetd_enable="YES"



??????????. ??????????telnet??????

?. ???/etc/inetd.conf???. ??????????, ???

?????????????, ??: finger, telnet,rlogin, ftp,

pop3 ??...



inetd_flags=""



# inetd ???.



named_enable="NO"



??????Internet????, ???, BIND. ?????????

DNS?????????.??? /etc/namedb/named.boot???, ??

?????????. ????????DNS servers.



named_flags="-b /etc/namedb/named.boot"



??????named?????.



kerberos_server_enable="NO"



# ????kerberos????? (?? NO).

# Run a kerberos master server(or NO).



rwhod_enable="NO"



# ?? rwho daemon (?? NO).



amd_enable="NO"



# ?$amd_flags??amd??. (?? NO).



amd_flags="-a /net -c 1800 -k i386 -d my.domain -l syslog /host /etc/amd.map"



??



nfs_client_enable="NO"



# ??????? NFS ??? (?? NO).



nfs_client_flags="-n 4"



# nfsiod ??? (?????).



nfs_server_enable="NO"



# ??????? NFS ??? (?? NO).



nfs_server_flags="-u -t 4"



# nfsd ??? (?????).



weak_mountd_authentication="NO"



# ?? PCNFSD / ?? non-root nfsd (?? NO).



nfs_reserved_port_only="NO"



# ?????????NFS (?? NO).



rpc_lockd_enable="NO"



# ?? NFS rpc.lockd (*broken!*) ?? nfs_server.



rpc_statd_enable="YES"



# ?? NFS rpc.statd ?? nfs_server (or NO).



portmap_enable="YES"



# ?? portmapper ?? (?? NO).



portmap_flags=""



# portmap ???(?????).



xtend_enable="NO"



# ?? X-10 ????? daemon.



xtend_flags=""



# xtend ???(?????).



4.4. ????????:



timed_enable="NO"



???? daemon (?? NO).



timed_flags=""



timed ???(?????).



ntpdate_enable="NO"



??ntpdate ????? (or NO).



ntpdate_flags=""



ntpdate ???(?????).



xntpd_enable="NO"



?? xntpd ?????? (?? NO).



xntpd_flags=""



xntpd ???(?????).



tickadj_enable="NO"



?? tickadj (?? NO).



tickadj_flags="-Aq"



tickadj ???(?????).



4.5. ??????(NIS)??:



nis_client_enable="NO"



?????NIS??? (?? NO).



nis_client_flags=""



ypbind ??? (?????).



nis_ypset_enable="NO"



??????ypset (?? NO).



nis_ypset_flags=""



ypset ???(?????).



nis_server_enable="NO"



????NIS??? (?? NO).



nis_server_flags=""



ypserv ???(?????).



nis_ypxfrd_enable="NO"



?????rpc.ypxfrd(?? NO).



nis_ypxfrd_flags=""



rpc.ypxfrd ???(?????).



nis_yppasswdd_enable="NO"



?????rpc.yppasswdd(?? NO).



nis_yppasswdd_flags=""



rpc.yppasswdd ???(?????).



4.6. ??????:



defaultrouter="NO"



??????????.?????Internet?????IP??.??

???????,????ping?????????.????IP??

?10.1.1.3,?????255.255.255.0,?????10.1.1.2???

??10.1.2.2,???????????.



static_routes=""



???????????????????????????.



gateway_enable="NO"



???????????????YES.??????????????

???????,??,ipnat?????????????YES.



router_enable="YES"



??? YES ???????daemon.



router="routed"



?????,????daemon???.



router_flags="-q"



??daemon???.



mrouted_enable="NO"



? multicast routing (?? /etc/mrouted.conf).



ipxgateway_enable="NO"



?? YES ??? IPX ??.



ipxrouted_enable="NO"



?? YES ??? IPX ?? daemon.



ipxrouted_flags=""



IPX ?? daemon???.



arpproxy_all=""



?????????? ARP_PROXY_ALL. ??????????.



4.7. ???????



keymap="NO"



/usr/share/syscons/keymaps/* ??keymap (?? NO).



keyrate="NO"



??????: slow, normal, fast (?? NO).



keybell="NO"



bell to duration.pitch or normal or visual (or NO).



keychange="NO"



??????? (?? NO).



cursor="NO"



???? {normal|blink|destructive} (?? NO).



scrnmap="NO"



/usr/share/syscons/scrnmaps/* ??????(?? NO).



font8x16="NO"



/usr/share/syscons/fonts/* ??8x16??(?? NO).



font8x14="NO"



/usr/share/syscons/fonts/* ??8x16??(?? NO).



font8x8="NO"



/usr/share/syscons/fonts/* ??8x8??(?? NO).



blanktime="NO"



blank time (in seconds) or "NO" to turn it off.



saver="NO"



????: blank/daemon/green/snake/star/NO. ????X???

????????.



moused_type="NO"



rc.conf(Cool ?man page ?????????.



moused_port="/dev/cuaa0"



???????? (??,mousetype ???).



moused_flags=""



moused ?????.



4.8. ??????



cron_enable="YES"



???????daemon. Cron ???????? "daemon". ??????

??????????: /etc/daily /etc/weekly ? /etc/montly.

????????????????



lpd_enable="YES"



??????? daemon. ???????????. ???/etc/printcap

??.



lpd_flags=""



lpd ???(?????).



sendmail_enable="YES"



?? sendmail daemon (?? NO). ????????e-mail???????

?????daemon. ???/etc/sendmail.cf???.



sendmail_flags="-bd -q30m"



-bd is pretty mandatory.



savecore_enable="NO"



??crash???????? (?? NO).



dumpdev="NO"



Device name to crashdump to (if enabled).



check_quotas="NO"



?????? (?? NO).



accounting_enable="NO"



?????? (?? NO).



ibcs2_enable="NO"



?????Ibcs2 (SCO) ??? (?? NO).



linux_enable="NO"



?????Linux ??? (or NO). ????Linux?????.



rand_irqs="NO"



Stir the entropy pool (like "5 11" or NO).



4.9. Allow local configuration override at the very end here



if [ -f /etc/rc.conf.local ]; then

. /etc/rc.conf.local

fi





5. ???????



?FreeBSD???/???????.FreeBSD?????"packages",??????

??????????????????????????. ??????CD, ??

??#1??,??????(???packages???..), ???"/stand/sysinstall"

??,?Post Configuration,????Packages. ???????????packages

??????????.



??,???ftp?ftp.freebsd.org?????package????? -

ftp://ftp.freebsd.org/pub/FreeBSD/packages-stable ????????.???

?????package,??? .tgz??.??????untar/???. ?????

"pkg_add".



??: ??????? spaz-1.32.tgz ?package





1. su to root (?????root ??? packages)



2. pkg_add spaz-1.32.tgz



????!????package????????????. ????csh?tcsh,??

?rehash????shell???????? bin ??...



??package?????/var/db/pkg??? - ?? cd ???????????

????????????packages. ?????????package,???

pkg_delete??????: pkg_delete spaz-1.32.tgz (?/var/db/pkb??)



FreeBSD?ports????????, ??port????????????????

???. ????ports????"???",?????.??????Internet??,

?????ports tree(???FreeBSD?????????)?? cd ?/usr/ports

???.



?????/usr/ports/net/spaz?????port:



1. su root



2. cd /usr/ports/net/spaz



3. make



??:



??make???????port!



4. make install (?????make????,?????????????

??? bin/lib ??,??????)



5. make clean (???????????????????????)



????,?/var/db/pkg???pkg_delete??????ports.





6. ????Linux???



Linux?????????FreeBSD?????Linux??????.??????

???.??????????????:



* ??????



* ????????????(lkm)



???????, ??????ports collection???Linux?.



cd /usr/ports/emulators/linux_lib



make install



??????Linux????/usr/compat. ??????/usr/bin/linux,??

??Linux????????????????.



??????lkm???Linux???, ?????????/etc/rc.conf???

????.



linux_enable="YES" # Linux emulation loaded at startup (or NO).



????????Linux???. ???????????????Linux???,

???? linux.(??root??)



????lkm,?????????????????,??????



options COMPAT_LINUX



Linux?????????.???????rc.conf??.


Available link for download