OpenBSD安裝(轉)

amyz發表於2007-08-10
OpenBSD安裝(轉)[@more@]

  OpenBSD, NetBSD, FreeBSD是同門三兄弟!OpenBSD以安全著稱, 支援的平臺很多!現在主要有三個分支:stable, release, current. 每六個月出一個release! 主要版本號是:3.1stable, 3.3release, 3.4 current. 3.4release 11月1日發行!

  stable是非常穩定的版本, release是發行版, 還有一些錯誤, 慢慢會發展成stable版, current是新功能版, 屬最新技術的版本! 一般主要使用的是release, stable, current不支援使用, 它的錯誤較多, 一般使用者使用不方便!具體資訊可檢視OpenBSD主站上的介紹!

  主要安裝方式:CD-ROM, FTP, LocalFilesystem等!

  安裝前的準備

  一、 下載所需要的檔案:floppy33.fs, 這可從一般的OpenBSD FTP站點上下載!

  國內的OpenBSD很少, 我一個都沒找到! 在安裝時從國外的站點上下載檔案很慢, 我上次晚上安裝時到了那裡就不管理它了, 到第二天早上才去繼續安裝!

  下面說說啟動盤的映象檔案:floppy33.fs, floppyB33.fs, floppyC33.fs

  floppy33.fs 桌面PC版本, 它支援一般的PCI, ISA NICs, IDE, SCSI介面, 還有一些PCMCIA介面。

  floppyB33.fs 伺服器版本, 支援很多的RAID, 和一些SCSI。但一些基本的SCSI, ISA NICs, EISA都刪除了!

  floppyC33.fs 膝上型電腦版本, 支援Cardbus, PCMCIA.

我想, 一般都是桌面PC, 我自己的就是, 下載floppy33.fs.

  下面是安裝所需要的一些基本檔案, 我把它下載下來放到內部網的FTP上了, 這樣安裝起來快一些:

  bsd, bsd.rd, base33.tgz, etc33.tgz, comp33.tgz, man33.tgz, misc33.tgz, game33.tgz, xbase33.tgz,xfont33.tgz, xserv33.tgz, xshare33.tgz.

我還下載了ports.tar.gz, src.tar.gz, sys.tar.gz, 系統安裝後這些ports tree, 核心原始碼都沒安裝, 要自己手動安裝的。

  二、製作啟動盤

  現在我們已下載了軟盤映象, 開始製作啟動盤

  1. Unix 下:

  我是在slackware上製作的, 我在windows 下用rawrite2.exe沒作成功!

  # fdformat /dev/fd0

  # dd if=floppy33.fs of=/dev/fd0 bs=32k

2. windows下(請參考OpenBSD主站上的安裝指南)

  主要工具都放在FTP站點上的TOOLS目錄裡, 主要有: rawrite, fdimage, ntrw, rawrite不能在windows NT, windows 2000 or XP下使用!

  相關操作可自己找資料, 都很簡單, 在DOS下操作!

  現在我們要收集自己計算機上的資訊:什麼平臺, 硬碟上的資料要不要備份?, 網路卡資訊(IP,subnet masks, gateway, DNS) 一些isa卡可以安裝時以dmesg檢視!

  已下載了安裝所需要的檔案!現在我們進行的是FTP安裝, 我將下載的檔案放在FTP上, 目錄是openbsd/OpenBSD下!這樣安裝快很多!

  安裝過程

  用軟盤啟動系統!我們會看到藍色背景的字!這裡是OpenBSD的開機資訊!然後我們會看到下面的這個:

  erase ^?, werase ^W, kill ^U, intr ^C, status ^T

  (I)nstall, (U)pgrade or (S)hell? I

  選擇I, 安裝新系統, 如果是從原來的系統上升級則選擇U, 或者你可以選擇S, 在SHELL下操作, 其實當你在安裝過程式中自己有某些設定錯誤Ctrl + c中止後, 也是回到這個SHEEL下操作的!在SHEEL下執行install就是安裝系統。

  Welcome to the OpenBSD/i386 3.3 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.

  Specify terminal type: [vt220] Enter

  Do you wish to select a keyboard encoding table? [n] y

選擇鍵盤型別, 一些都是US。

  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? [n] y

下面我們繼續安裝:

  Cool! Let's get to it...

  You will now initialize the disk(s) that OpenBSD will use. To enable all

  available security 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] Enter

是否整個硬碟都安裝OpenBSD, 是.

  Do you want to use *all* of wd0 for OpenBSD? [no] yes

  Treating sectors 63-6303024 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)

  > ?

現在我們來進行硬碟分割槽, 這裡打入?尋求幫助!

  Available commands:

  p [unit] - print label.

  M - show entire OpenBSD man page for disklabel.

  e - edit drive parameters.

  a [part] - add new partition.

  b - set OpenBSD disk boundaries.

  c [part] - change partition size.

  d [part] - delete partition.

  D - set label to default.

  g [d|b] - Use [d]isk or [b]ios geometry.

  m [part] - modify existing partition.

  n [part] - set the mount point for a partition.

  r - recalculate free space.

  u - undo last change.

  s [path] - save label to file.

  w - write label to disk.

  q - quit and save changes.

  x - exit without saving changes.

  X - toggle expert mode.

  z - zero out partition table.

  ? [cmnd] - this message or command specific help.

  Numeric parameters may use suffixes to indicate units:

  'b' for bytes, 'c' for cylinders, 'k' for kilobytes, 'm' for megabytes,

  'g' for gigabytes or no suffix for sectors (usually 512 bytes).

  Non-sector units will be rounded to the nearest cylinder.

  Entering '?' at most prompts will give you (simple) context sensitive help.

  >

我分了五個區, a 根分割槽 200M, b 交換分割槽 300M , d 100M /tmp, e 100M /var , f 最後的全給 /usr,

  使用 d刪除分割槽,a 建立分割槽,p 檢視分割槽情況,q 退出!

  d a 刪除a分割槽

  a a 建立a分割槽

  p g 檢視分割槽, 大小以G顯示

  p m 檢視分割槽, 大小以M顯示

  下面我們掛載分割槽:

  The root filesystem will be mounted on wd0a.

  wd0b will be used for swap space.

  Mount point for wd0d (size=122976k), none or done? [/tmp] Enter

  Mount point for wd0e (size=82152k), none or done? [/var] Enter

  Mount point for wd0g (size=2097144k), none or done? [/usr] Enter

  Mount point for wd0h (size=4194288k), none or done? [/home] Enter

  Mount point for wd0d (size=122976k), none or done? [/tmp] done

  Done - no available disks found.

  You have configured the following partitions and mount points:

  wd0a /

  wd0d /tmp

  wd0e /var

  wd0g /usr

  wd0h /home

格式化分割槽:

  The next step creates a filesystem on each partition, ERASING existing data.

  Are you really sure that you're ready to proceed? [n] y

  /dev/rwd0a: 307440 sectors in 305 cylinders of 16 tracks, 63 sectors

  200MB in 20 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)

  /dev/rwd0b: 245952 sectors in 244 cylinders of 16 tracks, 63 sectors

  300MB in 16 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)

  /dev/rwd0d: 164304 sectors in 163 cylinders of 16 tracks, 63 sectors

  100MB in 11 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)

  /dev/rwd0e: 4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors

  100MB in 261 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)

  /dev/rwd0f: 8388576 sectors in 8322 cylinders of 16 tracks, 63 sectors

  2300MB in 521 cyl groups (16 c/g, 7.88MB/g, 1920 i/g)

  /dev/wd0a on /mnt type ffs (rw, asynchronous, local, ctime=Thu Oct 10 21:

  50:36 2 002)

  /dev/wd0h on /mnt/home type ffs (rw, asynchronous, local, nodev, nosuid,

  ctime=Thu Oct 10 21:50:36 2002)

  /dev/wd0d on /mnt/tmp type ffs (rw, asynchronous, local, nodev, nosuid,

  ctime=Thu Oct 10 21:50:36 2002)

  /dev/wd0g on /mnt/usr type ffs (rw, asynchronous, local, nodev, ctime=Th

  u Oct 10 21:50:36 2002)

  /dev/wd0e on /mnt/var type ffs (rw, asynchronous, local, nodev, nosuid,

  ctime=Th u Oct 10 21:50:36 2002)

配置主機名

  Enter system hostname (short form, e.g. 'foo'): OpenBSD

配置網路:

  Configure the network? [y] Enter

  Available interfaces are: ne3.

  Which one do you wish to initialize? (or 'done') [ne3] Enter

  Symbolic (host) name for fxp0? [puffy] Enter

  The default media for fxp0 is

  media: Ethernet autoselect (100baseTX full-duplex)

  Do you want to change the default media? [n] Enter

  IP address for fxp0? (or 'dhcp') 202.116.92.235

  Netmask? [255.255.255.0] 255.255.254.0

  Done - no available interfaces found.

  DNS domain name? (e.g. 'bar.com') [my.domain] OpenBSD.localhost

  DNS nameserver? (IP address or 'none') [none] 202.116.64.1

  Use the nameserver now? [y] Enter

  Default route? (IP address, 'dhcp' or 'none') 202.116.92.1

  add net default: gateway 202.116.92.1

  Edit hosts with ed? [n] Enter

  Do you want to do any manual network configuration? [n] Enter

設定root密碼, 不會顯示出來的!

  Password for root account? (will not echo)

  Password for root account? (again)

現在我們選擇安裝方式, 我是FTP安裝!硬碟安裝就設定相應的東西就行了!

  You will now specify the location and names of the install sets you want 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

  installation 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? f

下面我們設定FTP伺服器的地址! 是否要設定代理? FTP, HTTP安裝都一樣, 如果需要設定一下!

  HTTP/FTP proxy URL? ( e.g. ‘’, or ‘none’ ) [ none ] Entry

檢視FTP列表:

  Do you want to see a list of potential ftp servers? [ y ] n

設定FTP的地址

  Server IP address, or hostname ? 我的FTP地址

  Does the server support passive mode ftp? [ y ]

設定放置安裝檔案的目錄, 根據自己的設定寫目錄

  Server directory? [ pub/OpenBSD/3.3/i386 ] openbsd/OpenBSD

是否匿名登陸, 不是, 則輸入使用者名稱, 密碼!

  Login? [ anonymous ] usernme

  Password? [ will no echo ] password

下面是選擇要安裝的軟體包:我試過, 如果你的FTP上有幾個包它會顯示幾個包, 但有幾個包是一定要的:bsd, base33.tgz, etc33.tgz, comp33.tgz, man33.tgz. 打入all將選擇全部安裝:

  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

  [ ] bsd.rd

  [X] base33.tgz

  [X] etc33.tgz

  [X] misc33.tgz

  [X] comp33.tgz

  [X] man33.tgz

  [X] game33.tgz

  [ ] xbase33.tgz

  [ ] xshare33.tgz

  [ ] xfont33.tgz

  [ ] xserv33.tgz

  File Name? (or 'done') [bsd.rd] all

  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

  [X] base33.tgz

  [X] etc33.tgz

  [X] misc33.tgz

  [X] comp33.tgz

  [X] man33.tgz

  [X] game33.tgz

  [X] xbase33.tgz

  [X] xshare33.tgz

  [X] xfont33.tgz

  [X] xserv33.tgz

  File Name? (or 'done') [done] doen

選擇好包後, 開始下載安裝:

  Ready to install sets? [y] Enter

  Getting bsd ...

  100% |**************************************************| 4472 KB 00:03

  Getting bsd.rd ...

  100% |**************************************************| 4190 KB 00:02

  Getting base33.tgz ...

  100% |**************************************************| 30255 KB 00:21

  Getting etc33.tgz ...

  100% |**************************************************| 1469 KB 00:01

  Getting misc33.tgz ...

  100% |**************************************************| 1828 KB 00:01

  Getting comp33.tgz ...

  100% |**************************************************| 16207 KB 00:13

  Getting man33.tgz ...

  100% |**************************************************| 5921 KB 00:04

  Getting game33.tgz ...

  100% |**************************************************| 2545 KB 00:01

  Getting xbase33.tgz ...

  100% |**************************************************| 9073 KB 00:06

  Getting xshare33.tgz ...

  100% |**************************************************| 1574 KB 00:02

  Getting xfont33.tgz ...

  100% |**************************************************| 30666 KB 00:21

  Getting xserv33.tgz ...

  100% |**************************************************| 14948 KB 00:11

  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

現在基本包安裝完成!設定一下時區, 還有你以後要不要執行X:

  Extract more sets? [n] Enter

  Do you expect to run the X Window System? [y] y

  Saving configuration files......done.

  Generating initial host.random file ......done.

  What timezone are you in? ('?' for list) [US/Pacific] ? 尋求幫助!

  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/ EST5EDT 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) [US/Pacific] Asia

  然後輸入:Shanghai,

  Making all device nodes...done.

  Installing boot block...

  boot: /mnt/boot

  proto: /usr/mdec/biosboot

  device: /dev/rwd0c

  /usr/mdec/biosboot: entry point 0

  proto bootblock size 512

  room for 12 filesystem blocks at 0x16f

  Will load 7 blocks of size 8192 each.

  Using disk geometry of 63 sectors and 240 heads.

  0: 9 @(203 150 55) (3078864-3078872)

  1: 63 @(203 151 1) (3078873-3078935)

  2: 24 @(203 152 1) (3078936-3078959)

  3: 16 @(203 8 47) (3069910-3069925)

  /mnt/boot: 4 entries total

  using MBR partition 1: type 166 (0xa6) offset 3069360 (0x2ed5b0)

  ...done.

  CONGRATULATIONS! Your OpenBSD install has been successfully completed!

  To boot the new system, enter halt at the command prompt. Once the

  system has halted, reset the machine and boot from the disk.

  # reboot

現在重啟, 系統已安裝完成!

  安裝後配置

  我們安裝了基本的系統,但只有最基本的東西, 像核心原始碼, ports tree都沒安裝!

  在安裝時我們安裝了X, 現在我們配置X-windows, 執行xf86cfg設定!OpenBSD的預設桌面是fvwm。

  現在我們給系統新增新使用者adduser, 在第一次使用時會有一些基本的設定, 如密碼使用什麼加密, 有好幾種, 我選擇了最常用的md5。

  首先, 我們開始安裝核心原始碼, 為以後編譯核心作準備!

  如果你有CD,則只需要從CD中取出src.tar.gz,cd /usr/src 然後tar xvzf src.tar.gz, 上篇, 我們是從FTP安裝的, 因此, 我們要下載兩個包:src.tar.gz, sys.tar.gz.

  ftp://ftp.ca.openbsd.org/pub/OpenBS...i386/src.tar.gz

  ftp://ftp.ca.openbsd.org/pub/OpenBS...i386/sys.tar.gz

安裝ports tree, 下載ports.tar.gz, 然後copy /usr/ , tar xzvf ports.tar.gz .

  ftp://ftp.ca.openbsd.org/pub/OpenBS...86/ports.tar.gz

安裝cvsup,

  下載cvsup-16.1f.tar.gz, 如果沒安裝X則下載 cvsup-16.1f-no_X.tar.gz

  #ftp://ftp.ca.openbsd.org/pub/OpenBS...p-16.1f..tar.gz

  #pkg_add cvsup-16.1f.tar.gz

編輯cvsup-supfile, OpenBSD裡的編輯器是mg, 類似於emacs。

  #Defaults that apply to all the collections

  *default release=cvs

  *default delete use-rel-suffix

  *default umask=002

  *default host=cvsup.uk.openbsd.org

  *default base=/cvsup

  *default prefix=/cvsup

  #If your network link is T1 or faster, comment out the following line.

  *default compress

  OpenBSD-all

  #OpenBSD-src

  #OpenBSD-www

  #OpenBSD-ports

  #OpenBSD-x11

  #OpenBSD-xf4

儲存,

  # mg cvsup-supfile

  # cd /

  # mkdir cvsup

  # cd

  # cvusp –g –L 2 cvsup-supfile

就可升級ports tree等了!

  安裝軟體同FreeBSD下一樣, 以後再說說編譯核心吧!

  主要cvsup站點:

  cvsup.uk.openbsd.org]

  cvsup.de.openbsd.org

  cvsup2.de.openbsd.org

  cvsup.hu.openbsd.org

  cvsup.fr.openbsd.org

  cvsup.ca.openbsd.org

  cvsup.usa.openbsd.org

  cvsup.kr.openbsd.org

  cvsup.no.openbsd.org

  cvsup.pt.openbsd.org

  anoncvs.de.openbsd.org

  rt.fm

  skeleton.phys.spbu.ru

  cvsup.jp.OpenBSD.org

  mirror.osn.de

  openbsd.informatik.uni-erlangen.de

  OpenBSD-src - The src repository

  OpenBSD-ports - The ports repository

  OpenBSD-www - The www repository

  OpenBSD-x11 - The XFree86-3 repository

  OpenBSD-xf4 - The XFree86-4 repository

  OpenBSD-all - All OpenBSD repositories

  網路配置

  因為與FreeBSD等配置有點出入, 所以我在這裡指出來!

  我自己是使用區域網, 所以只介紹這個方面的, 如果有人使用的是PPP方式, 可自行檢視官方站點上的FAQ。

  可能很多使用OpenBSD的人是從FreeBSD下轉過來的, 但OpenBSD的網路設定與FreeBSD有所不同, 它的網路配置沒有寫進rc.conf, 而是作為單獨的檔案存放的。

  網路卡IP存放在/etc/hostname.網路卡型號名, 閘道器存放在/etc/mygate

  主機名存放在/etc/myname, 名字伺服器地址沒變, 存放在/etc/resolv.conf

  我們使用ifconfig –a 檢視網路卡型號:(這個是我已配置好的)

  lo0: flags=8049 mtu 33224

  inet 127.0.0.1 netmask 0xff000000

  lo1: flags=8008 mtu 33224

  ne0: flags=8863 mtu 1500

  address: 00:e0:4c:e0:45:0c

  media: Ethernet autoselect (10baseT)

  inet ***.***.***.*** netmask 0xfffffe00 broadcast ***.***.***.***

  pflog0: flags=0<> mtu 33224

  pfsync0: flags=0<> mtu 2020

我的網路卡是ne0, 但不知怎麼的, 系統安裝好後, 在/etc/中建立的檔案卻是hostname.ne3, 我只好自己手動改成 hostname.ne0,

  關於這個hostname.*檔案的格式:

  inet 192.168.0.1 netmask 255.255.255.0 NONE

inet 指定ip地址, netmask指定網路掩碼。

  當然你也可以指定詳細的網路卡說明:

  inet 10.0.0.38 255.255.255.0 NONE media 100baseTX mediaopt full-duplex

現在指定閘道器, 修改/etc/mygate, 寫入閘道器IP就行了。

  主機名, 寫入/etc/myname.

  /etc/resolv.conf, 與別的系統一樣的, 這個就不用說了!

  到這裡我們的OpenBSD系統已安裝完成, 以後的操作我會再寫出來,還過幾天3.4release就要出來了, 到時我升級到3.4再寫出來。

  有問題可到linuxeden.com的FreeBSD版,我會與你一起討論。我常混在 ( bsd 版), (bsd版), , 等。

  注:本文參考了OpnBSD.org的線上文件, 各位如有不明白的地方可到Openbsd.org主站上觀看它的FAQ。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752019/viewspace-941812/,如需轉載,請註明出處,否則將追究法律責任。

相關文章