OpenBSD全能服务器安装手册之系统安装篇
—基本系统安装
选择安装类型
|erase ^?, werase ^W, kill ^U, intr ^C, status ^T
|(I)nstall, (U)pgrade or (S)hell? i <then RETURN>;
#####################################################
其中
(I)nstall代表安装一个全新的系统
(U)pgrade代表升级原有的OpenBSD旧版本
(S)hell代表退出到命令行状态
我们要安装一个全新的OpenBSD系统,所以我们在这里输入I,并回车。(当然你也可以按下Ctrl+C退回到命令行状态,再次输入install回到安装程序,如果在安装程序时误操作,可以使用这种方法进入命令行状态然后再重新回到安装程序开始安装。)
#####################################################
选择终端类型
|Welcome to the OpenBSD/i386 3.6 install program.
|
|This program will help you install OpenBSD in a simple and rational way. At
|any prompt except password prompts you can run a shell command by typing
|'!foo',or escape to a shell by typing '!'. Default answers are shown in []'s
|and are selected by pressing RETURN. At any time you can exit this program by
|pressing Control-C and then RETURN, but quitting during an install can leave
|your system in an inconsistent state.
|
|Terminal Type? [vt220]回车
选择键盘布局类型
|Kbd(8)mapping? (‘L’for list)[none]l
(注意:我们在这里选择l查看有那些键盘类型主要是考虑到个人的需要,可以选择自己熟悉的键盘类型)
|Major tables:be br cf de dk es fr hu it nl no pl pt ru sf sg si sv tr ua uk us
这里我们选择默认
|Kbd(8)mapping? (‘L’for list)[none]
##########################################
对于我们大部分的中国用户而言,我们使用的都是标准的美式键盘,这也是OpenBSD默认的键盘布局,所以我们直接按回车继续。
###############################################
磁盘划分
|IS YOUR DATA BACKED UP? As with anything that modifies disk contents,this
|program can cause SIGNIFICANT data loss.
|
|It is often helpful to have the installation notes handy. For complex disk
|configurations, relevant disk hardware manuals and a calculator are useful.
|
|Proceed with install? [no] yes回车
###########################
安装程序提示是否开始安装,我们直接输入y,并回车
#######################################
|Cool! Let's get to it...
|
|You will now initialize the disk(s) that OpenBSD will use. To enable all
|available securty features you should configure the disk(s) to allow the
|creation of separate filesystems for /, /tmp, /var, /usr, and /home.
(注意:系统在这里提示我们那些分区是必要的,在下面的分区时需要注意)
|Available disks are: wd0.
|Which one is the root disk? (or 'done') [wd0] 回车
################################
在OpenBSD系统中对于IDE接口的硬盘的命名方式是wd0,wd1,wd2……依次类推,而SCSI接口的硬盘则是sd0,sd1,sd2……依次类推。
#############################################
|Do you want to use *all* of wd0 for OpenBSD? [no] yes回车
#####################################
系统询问是否将检测到的整个硬盘都给OpenBSD使用,默认是no,但是我们在这里是要将OpenBSD作为服务器来用,所以我们在这里输入yes,并回车。
########################################
|Putting all of wd0 into an active OpenBSD MBR partition (type 'A6') ...
|wd0: no disk label
|done.
|
|You will now create an OpenBSD disklabel inside the OpenBSD MBR
|partition. The disklabel defines how OpenBSD splits up the MBR partition
|into OpenBSD partitions in which filesystems and swap space are created.
|
|The offsets used in the disklabel are ABSOLUTE, i.e. relative to the
|start of the disk, NOT the start of the OpenBSd MBR partition.
|
|# using MBR partition 3: type A6 off 63 (0x3f) size 8385687 (0x7ff54b)
|
|Treating sectors 63-8385930 as the OpenBSD portion of the disk.
|You can use the 'b' command to change this.
|Initial label editor (enter '?' for help at any prompt)
###################################
在>;提示符下输入?将显示帮助,
命令p:用来显示当前硬盘分区的划分情况
命令d:用来删除现有的分区(注意:c分区被OpenBSD系统保留使用,不能被删除或者被变更),
命令z:用来清空OpenBSD的分区表,
命令a:用来创建新的OpenBSD分区。
命令“d x”:表示删除文件系统,其中,xx0c一定不可以被删除,即便你执行“d c”,也不会成功;
命令“a x”:表示增加文件系统,其中,xx0c一定不可以被覆盖,即便你执行“a c”,也不会成功;
注意:b分区默认是留给swap分区的,并且swap分区无需mount point。在OpenBSD系统中,xx0a一定是"/"文件系统,xx0b一定是swap文件系统,xx0c一定表示整个硬盘,在这三个文件系统的基础上,你可以进行xx0d、xx0e...等文件系统的划分。partition是分区编号,从a分区开始,c分区跳过。offset是指每一个分区的偏移地址。size是分区大小。可以直接输入分区的偏移地址也可以直接输入m为单位的数值,比如我们在size项输入200m,系统回应说这个值近似于的偏移地址为409185。FS type是文件系统类型。mount point是挂载点。
##################################
显示当前硬盘分区的划分情况(下面的输出结果因机器的硬件不同而不同,应根据实际情况而定。注:本次采用的是虚拟机)
|>; p 回车
|device: /dev/rwd0c
|type: ESDI
|disk: ESDI/IDE disk
|label: VMware Virtual I
|bytes/sector: 512
|sectors/track: 63
|tracks/cylinder: 16
|sectors/cylinder: 1008
|cylinders: 8332
|total sectors: 8388608
|free sectors: 8385867
|rpm: 3600
|
|16 partitions:
|# size offset fstype [fsize bsize cpg]
| a: 8385867 63 unused 0 0
| c: 8388608 0 unused 0 0
|>; d a回车 (删除默认的分区)
|>; a a回车 (新建分区,前面已经提到分区从a开始,a就代表着根分区)
|offset: [63] 回车 (选择分区类型的数字编号,在这里选择默认的编号,也是openbsd的默认分区格式,具体的分区编号所代表的意思可以查看相关文档)
|size: [8385867] 1024M 回车 (在这里设置根分区的空间大小,我的设置是1024M)
|Rounding to nearest cylinder: 262017
|FS type: [4.2BSD] 回车
|mount point: [none] / 回车 (输入分区的挂载点)
|>; a b回车 (建立扩展分区)
|offset: [262080] 回车
|size: [8123850] 1024M 回车
|Rounding to nearest cylinder: 524160
|FS type: [swap] 回车
|>; a d回车
|offset: [786240] 回车
|size: [7599690] 2048M回车
|Rounding to nearest cylinder: 262080
|FS type: [4.2BSD] 回车
|mount point: [none] /tmp回车 (设置临时文件所在的分区)
|>; a e回车
|offset: [1048320] 回车
|size: [7337610] 10240M回车
|Rounding to nearest cylinder: 1048320
|FS type: [4.2BSD] 回车
|mount point: [none] /var回车
|>; a f回车
|offset: [2096640] 回车
|size: [6289290] 10240M 回车
|Rounding to nearest cylinder: 回车
|FS type: [4.2BSD] 回车
|mount point: [none] /usr 回车
|>; a g 回车
|offset: [6290928] 回车
|size: [2095002] 回车 (注意在这里并没有设置分区的大小,其实是将剩余的空间全部分给了/home)
|FS type: [4.2BSD] 回车
|mount point: [none] /home回车
|>; p 回车 (查看现有的分区的分区情况)
|device: /dev/rwd0c
|type: ESDI
|disk: ESDI/IDE disk
|label: VMware Virtual I
|bytes/sector: 512
|sectors/track: 63
|tracks/cylinder: 16
|sectors/cylinder: 1008
|cylinders: 8332
|total sectors: 8388608
|free sectors: 8385867
|rpm: 3600
|
|16 partitions:
|# size offset fstype [fsize bsize cpg]
| a: 2096892 63 4.2BSD 2048 16384 16 # /
| b: 2096955 262080 swap
| c: 83886080 0 unused 0 0
| d: 4093910 4093910 4.2BSD 2048 16384 16 # /tmp
| e: 20971440 8387820 4.2BSD 2048 16384 16 # /var
| f: 20971440 29359260 4.2BSD 2048 16384 16 # /usr
| g: 2095002 50330700 4.2BSD 2048 16384 16 # /home
|>; w 回车 (保存分区方案)
|>; q 回车 (退出)
|No label changes.
|Mount point for wd0d (size=131040k)>; (or 'none' or 'done')[/tmp] 回车
|Mount point for wd0e (size=524160k)>; (or 'none' or 'done') [/var] 回车
|Mount point for wd0f (size=2097144k)>; (or 'none' or 'done') [/usr] 回车
|Mount point for wd0g (size=1047501k)>; (or 'none' or 'done') [/home] 回车
|Mount point for wd0d (size=131040k)>; (or 'none' or 'done') [/tmp] done回车(确认)
|No more disks to initialize.
|
|OpenBSD filesystems:
|wd0a /
|wd0d /tmp
|wd0e /var
|wd0f /usr
|wd0g /home
|
|The next step *DESTORYS* all existing data on these partitions!
|Are you reallysure that you're ready to proceed? [no] yes <then RETURN>;
网络配置
|System hostname? (short form, e.g. 'foo') www.inter7.org 回车 (在这里我沿用了FreeBSD的命名方法,因为本系统设计的初衷是工作于公网下)
#######################
配置主机名
#######################
|Configure the network? [yes] 回车
|Available interfaces are: le1 le2
|Which on do you wish to initialize? (or 'done') [pcn0] 回车
|Symbolic (host) name for le1? [www] 回车
|IPv4 address for pcn0? (or 'none' or 'dhcp') 192.168.0.122回车
|Netmask? [255.255.255.0] 回车
|Available interfaces are: pcn0
|Which on do you wish to initialize? (or 'done') [pcn0] 回车
|Symbolic (host) name for pcn0? [bsd010ids] 回车
|IPv4 address for le2? (or 'none' or 'dhcp') 192.168.0.122回车
|Netmask? [255.255.255.0] 回车
|No more interfaces to initialize.
|DNS domain name? (e.g. 'bar.com') [inter7.org] inter7.org
|DNS nameserver? (IP address or 'none') [none] 202.99.96.68回车
|Use the nameserver now? [yes] 回车
|Default IPv4 route? (IPv4 address, 'dhcp' or 'none') 192.168.0.1回车
|add net default: gateway 192.168.0.1
|Edit hostswith ed? [no] 回车
|Do you want to do any manual network configuration? [no] 回车
1.7.设置root口令
|Password for root account? (will not echo) <enter your password then回车>;
|Password for root account? (again) <enter your password again then回车>;
选择需要安装的系统文件
|You will now specify the locatiob and names of the install sets you wangt to
|load. You will be able to repeat this step until all of your sets have been
|successfully loaded. If you are not sure what sets to install, refer to the
|installatio notes for details on the contents of each.
|
|Sets can be located on a (m)ounted filesystem; a (c)drom, (d)isk or (t)ape
|device; or a (f)tp, (n)fs or (h)ttp server.
|Where are the install sets? (or 'done') c <then回车>;
|Available CD-ROMs are cd0.
|Which one contains the install media? (or 'done') [cd0] <回车>;
#####################################
安装程序询问用哪种方式安装,我们输入c,从cdrom上安装,然后选择第一个cdrom设备cd0,回车继续。
#######################################
|
|Pathname to the sets? (or 'done') [3.6/i386] <回车>;
|
|The following sets are available. Enter a filename, 'all' to select
|all the sets, or 'done'. You may de-select a set by prepending a '-'
|to its name.
|
| [X]bsd
| [X]bsd.rd
| [ ]bsd.mp
| [X]base36.tgz
| [X]etc36.tgz
| [X]misc36.tgz
| [X]comp36.tgz
| [X]man36.tgz
| [X]game36.tgz
| [ ]xbase36.tgz
| [ ]xetc36.tgz
| [ ]xshare36.tgz
| [ ]xfont36.tgz
| [ ]xserv36.tgz
|
|File name? (or 'done') [bsd.mp] -game36.tgz回车
(注意:在这里通过‘+’、‘-’加、减号来设置具体需要安装那些软件包。all是安装全部软件包 File Name? (or 'done') [bsd.mp] all //若你是第一次安装,请尽量安装所有安装包,输入all是选择所有安装包,输入文件名,就会选择相应的包,输入“-”(减法号)后紧跟文件名,可以减去相应的包,使用“+”(加法号)紧跟文件名,可以添加相应的包,在文件名中可以使用通配符“*”或“?”,比如说:-x*,就会把所有x开头的包去掉。)
|
|The following sets are available. Enter a filename, 'all' to select
|all the sets, or 'done'. You may de-select a set by prepending a '-'
|to its name.
|
| [X]bsd
| [X]bsd.rd
| [ ]bsd.mp
| [X]base36.tgz
| [X]etc36.tgz
| [X]misc36.tgz
| [X]comp36.tgz
| [X]man36.tgz
| [ ]game36.tgz
| [ ]xbase36.tgz
| [ ]xetc36.tgz
| [ ]xshare36.tgz
| [ ]xfont36.tgz
| [ ]xserv36.tgz
|
|File name? (or 'done') [bsd.mp] done <then RETURN>;
|Ready to install sets? [yes] <RETURN>;
Ready to install sets? [yes] 回车 //问你是否准备好安装了,默认是“yes”是的
Getting bsd ...
100% |**************************************************| 5157 KB 00:08
Getting bsd.rd ...
100% |**************************************************| 4549 KB 00:02
Getting bsd.mp ...
100% |**************************************************| 5202 KB 00:03
Getting base38.tgz ...
100% |**************************************************| 35928 KB 00:25
Getting etc38.tgz ...
100% |**************************************************| 1123 KB 00:01
Getting misc38.tgz ...
100% |**************************************************| 2222 KB 00:01
Getting comp38.tgz ...
100% |**************************************************| 20522 KB 00:17
Getting man38.tgz ...
100% |**************************************************| 7234 KB 00:05
Location of sets? (cd disk ftp http or 'done') [done] 回车
|Sets can be located on a (m)ounted filesystem; a (c)drom, (d)isk or (t)ape
|device; or a (f)tp, (n)fs or (h)ttp server.
|Where are the install sets? (or 'done') done回车
这里解释一下OpenBSD的系统包的安装情况:
“x”开动的系统包,是X Window使用的基本包(我不用这东西,没装);
其余的包,除“bsd.mp”、“game36.tgz”外,都是系统必须的包,要装;
“bsd.mp”我不知道是什么,也没查,我感觉应该是SMP用的,缺省就没选,我也没装;
“game36.tgz”,这个我肯定是不装。
1.9.系统服务配置
|Start sshd(8 ) by default? [yes] 回车
|Do you expect to run the X Window System? [yes] no回车
|Change the default console to com0? [no] 回车
|Saving configuration files...done.
|Generating initial host.random file...done.
|What timezone are you in? ('?' for list) [Canada/Mountain] ? 回车 (设置时区我们在这里输入问号以显示所有的时区)
|Africa/ Chile/ GB-Eire Israel NZ-CHAT Turkey
|America/ Cuba GMT Jamaica Navajo UCT
|Antarctica/ EET GMT+0 Japan PRC US/
|Arctic/ EST GMT-0 Kwajalein PST8PDT UTC
|Asia/ EST5 EDT GMT0 Libya Pacific/ Universal
|Atlantic/ Egypt Greenwich MET Poland W-SU
|Australia/ Eire HST MST Portugal WET
|Brazil/ Etc/ Hongkong MST7MDT ROC Zulu
|CET Europe/ Iceland Mexico/ ROK posix/
|CST6CDT Factory Indian/ Mideast/ Singapore posixrules
|Canada/ GB Iran NZ SystemV/ right/
|What timezone are you in? ('?' for list) [Canada/Mountain] Asia/ 回车
What sub –timezone of ‘Asia’ are you in ? (‘?’ for list ) ?
Aden Chungking Kamchatka Phnom_Penh Tbilisi
Almaty Colombo Karachi Pontianak Tehran
Amman Dacca Kashgar Pyongyang Tel_Aviv
Anadyr Damascus Katmandu Qatar Thimbu
Aqtau Dhaka Krasnoyarsk Qyzylorda Thimphu
Aqtobe Dili Kuala_Lumpur Rangoon Tokyo
Ashgabat Dubai Kuching Riyadh Ujung_Pandang
Ashkhabad Dushanbe Kuwait Riyadh87 Ulaanbaatar
Baghdad Gaza Macao Riyadh88 Ulan_Bator
Bahrain Harbin Macau Riyadh89 Urumqi
Baku Hong_Kong Magadan Saigon Vientiane
Bangkok Hovd Makassar Sakhalin Vladivostok
Beirut Irkutsk Manila Samarkand Yakutsk
Bishkek Istanbul Muscat Seoul Yekaterinburg
Brunei Jakarta Nicosia Shanghai Yerevan