Установка OpenBSD - не самый популярный вопрос в русскоязычной литературе, хотя ничего "сверхъестественного" в нем нет. Сам процесс занимает около 7 минут, а его наиболее сложной и опасной частью является разбиение жесткого диска (особенно, если OpenBSD - не единственная установленная на нем ОС).
Дистрибутив OpenBSD можно получить с сайта проекта, приобрести в виде готовых дисков (например, в магазине ЛинуксЦентра) или же производить инсталляцию по FTP/HTTP. Все дальнейшее рассмотрение производится на примере OpenBSD 3.2.
Прежде всего, необходимо собрать данные, которые потребуются в процессе установки. Сюда входит: имя машины, названия всех устройств, драйвера к ним, сетевые параметры (DNS, Domain Name, IP,Gateway). Для начала процесса инсталляции загрузитесь с первого дистрибутивного диска. На экране появятся следующие сообщения:
rootdev=0x1100 rrootdev=0x2f00 rawdev=0x2f02 erase ^?, werase ^W, kill ^U, intr ^C, status ^T (I)nstall, (U)pgrade or (S)hell? I
Для установки новой системы выберите Install. В ответ будет выведено приветствие:
Welcome to the OpenBSD/i386 3.2 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] Do you wish to select a keyboard encoding table? [n] ENTER
Просто нажмите "Enter".
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
Введите "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
Выберите диск, на который будет записана загрузочная информация (wd0 – первый, wd1-второй и т.д.). В случае, если в системе установлен всего один HDD, моэно принять значения по умолчанию, нажав "Enter".
Do you want to use *all* of wd0 for OpenBSD? [no] Enter
Ответьте на это предложение отказом, если только не хотите, чтобы OpenBSD заняла собой весь диск. После этого Вам будет предложено выделить для системы несколько разделов
You will now create a single MBR partition to contain your OpenBSD data. This partition must have an id of 'A6'; must *NOT* overlap other partitions; and must be marked as the only active partition. The 'manual' command describes all the fdisk commands in detail. Disk: wd0 geometry: 2586/240/63 [39100320 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ *0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused Enter 'help' for information fdisk: 1> help help Command help list manual Show entire OpenBSD man page for fdisk reinit Re-initialize loaded MBR (to defaults) setpid Set the identifier of a given table entry disk Edit current drive stats edit Edit given table entry flag Flag given table entry as bootable update Update machine code in loaded MBR select Select extended partition table entry MBR print Print loaded MBR partition table write Write loaded MBR to disk exit Exit edit of current MBR, without saving changes quit Quit edit of current MBR, saving current changes abort Abort program without saving current changes fdisk: 1>
Разбиение диска необходимо проводить очень внимательно! Иначе Вы рискуете полностью потерять сохраненную на диске информацию. Отменить сделанные в fdisk изменения нельзя. Можно лишь выйти из программы установки и начать установку заново. Просто перезагружаться не стоит – другой редактор разделов не увидит изменений, но загрузить старую ОС не удастся.
Сформируем раздел под систему:
fdisk: 1> e 1 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ 1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused Partition id ('0' to disable) [0 - FF]: [0] (? for help) a6 Do you wish to edit in CHS mode? [n] y BIOS Starting cylinder [0 - 2585]: [0] 203 BIOS Starting head [0 - 239]: [0] Enter BIOS Starting sector [1 - 63]: [0] 1 BIOS Ending cylinder [0 - 2585]: [0] 2585 BIOS Ending head [0 - 239]: [0] 239 BIOS Ending sector [1 - 63]: [0] 63 fdisk:*1> p Disk: wd0 geometry: 2586/240/63 [39100320 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ *0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB 1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused fdisk:*1> p m Disk: wd0 geometry: 2586/240/63 [19092 Megabytes] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ *0: 06 0 1 1 - 202 239 63 [ 63: 1499M] DOS > 32MB 1: A6 203 0 1 - 2585 239 63 [ 3069360: 17593M] OpenBSD 2: 00 0 0 0 - 0 0 0 [ 0: 0M] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0M] unused fdisk:*1> fdisk:*1> f 1 Partition 1 marked active. fdisk:*1> p Disk: wd0 geometry: 2586/240/63 [39100320 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ 0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB *1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused fdisk:*1>
Теперь можно сохранить раздел и перейти к следующему пункту установки:
fdisk:*1> w Writing MBR at offset 0. wd0: no disk label fdisk: 1> q
После выхода из fdisk запустится программа label editor:
Here is the partition information you chose: Disk: wd0 geometry: 2586/240/63 [39100320 Sectors] Offset: 0 Signature: 0xAA55 Starting Ending LBA Info: #: id C H S - C H S [ start: size ] ------------------------------------------------------------------------ *0: 06 0 1 1 - 202 239 63 [ 63: 3069297 ] DOS > 32MB 1: A6 203 0 1 - 2585 239 63 [ 3069360: 36030960 ] OpenBSD 2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused 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. disklabel: no disk label WARNING: Disk wd0 has no label. You will be creating a new one. # using MBR partition 1: type A6 off 3069360 (0x2ed5b0) size 36030960 (0x225c9f0) Treating sectors 3069360-39100320 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. >
Здесь надо указать точки монтирования разделов и их размер. Рекомендуются установить следующие параметры:
- wd0a: / (root) - 150M.
- wd0b: (swap) - 300M. Раздел подкачки должен иметь размер, приблизительно равный удвоенному объему оперативной памяти
- wd0d: /tmp - 120M. Место под временные файлы
- wd0e: /var – 80M. Здесь хранятся серверные журналы и т.п.
- wd0g: /usr - 2G. Место для программ (иногда на это выделяют и 2/3 диска)
- wd0h: /home - 4G. Место для личных файлов пользователей.
Вот порядок выполняемых действий:
> p m device: /dev/rwd0c type: ESDI disk: ESDI/IDE disk label: ST320011A bytes/sector: 512 sectors/track: 63 tracks/cylinder: 16 sectors/cylinder: 1008 cylinders: 16383 total sectors: 39102336 free sectors: 36030960 rpm: 3600 16 partitions: # size offset fstype [fsize bsize cpg] a: 17593.2M 1498.7M unused 0 0 c: 19092.9M 0.0M unused 0 0 i: 1498.7M 0.0M MSDOS > d a > a a offset: [3069360] Enter size: [36030960] 150M Rounding to nearest cylinder: 307440 FS type: [4.2BSD] Enter mount point: [none] / > a b offset: [3376800] Enter size: [35723520] 300M Rounding to nearest cylinder: 614880 FS type: [swap] Enter > a d offset: [3991680] Enter size: [35108640] 120m Rounding to nearest cylinder: 245952 FS type: [4.2BSD] Enter mount point: [none] /tmp > a e offset: [4237632] Enter size: [34862688] 80m Rounding to nearest cylinder: 164304 FS type: [4.2BSD] Enter mount point: [none] /var > a g offset: [4401936] Enter size: [34698384] 2g Rounding to nearest cylinder: 4194288 FS type: [4.2BSD] Enter mount point: [none] /usr > a h offset: [8596224] Enter size: [30504096] 4g Rounding to nearest cylinder: 8388576 FS type: [4.2BSD] Enter mount point: [none] /home > p m device: /dev/rwd0c type: ESDI disk: ESDI/IDE disk label: ST320011A bytes/sector: 512 sectors/track: 63 tracks/cylinder: 16 sectors/cylinder: 1008 cylinders: 16383 total sectors: 39102336 free sectors: 22115520 rpm: 3600 16 partitions: # size offset fstype [fsize bsize cpg] a: 150.1M 1498.7M 4.2BSD 1024 8192 16 # / b: 300.2M 1648.8M swap c: 19092.9M 0.0M unused 0 0 d: 120.1M 1949.1M 4.2BSD 1024 8192 16 # /tmp e: 80.2M 2069.2M 4.2BSD 1024 8192 16 # /var g: 2048.0M 2149.4M 4.2BSD 1024 8192 16 # /usr h: 4096.0M 4197.4M 4.2BSD 1024 8192 16 # /home i: 1498.7M 0.0M MSDOS > q Write new label?: [y] Enter
Тонкое место: монтирование разделов необходимо проводить строго в указанном порядке. После монтирования последнего раздела надо ввести done и нажать "Enter".
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 150.1MB in 20 cyl groups (16 c/g, 7.88MB/g, 1920 i/g) /dev/rwd0d: 245952 sectors in 244 cylinders of 16 tracks, 63 sectors 120.1MB in 16 cyl groups (16 c/g, 7.88MB/g, 1920 i/g) /dev/rwd0e: 164304 sectors in 163 cylinders of 16 tracks, 63 sectors 80.2MB in 11 cyl groups (16 c/g, 7.88MB/g, 1920 i/g) /dev/rwd0g: 4194288 sectors in 4161 cylinders of 16 tracks, 63 sectors 2048.0MB in 261 cyl groups (16 c/g, 7.88MB/g, 1920 i/g) /dev/rwd0h: 8388576 sectors in 8322 cylinders of 16 tracks, 63 sectors 4096.0MB 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'): hostname Configure the network? [y] Enter Available interfaces are: fxp0. Which one do you wish to initialize? (or 'done') [fxp0] 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') 111.111.111.111 Netmask? [255.255.255.0] Enter Done - no available interfaces found. DNS domain name? (e.g. 'bar.com') [my.domain] example.com DNS nameserver? (IP address or 'none') [none] 111.111.111.111 Use the nameserver now? [y] Enter Default route? (IP address, 'dhcp' or 'none') 111.111.111.111 add net default: gateway 199.185.137.128 Edit hosts with ed? [n] Enter Do you want to do any manual network configuration? [n] Enter
А затем - пароль администратора:
Password for root account? (will not echo) Wоrd Password for root account? (again) Wоrd
После задания пароля, можно переходить непосредственно к инсталляции:
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? c Available CD-ROMs are: cd0.
Если Вы устанавливаете систему с СDROM, то выберите “с”. Далее укажите местоположение директории с архивами:
Available CD-ROMs are: cd0. Which one contains the install media? (or 'done') [cd0] Enter Pathname to the sets? (or 'done') [3.4/i386] Enter
Выберите компоненты для установки. Если позволяет место, советую установить все, кроме игр:
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] base34.tgz [X] etc34.tgz [X] misc34.tgz [X] comp34.tgz [X] man34.tgz [X] game34.tgz [ ] xbase34.tgz [ ] xshare34.tgz [ ] xfont34.tgz [ ] xserv34.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] base34.tgz [X] etc34.tgz [X] misc34.tgz [X] comp34.tgz [X] man34.tgz [X] game34.tgz [X] xbase34.tgz [X] xshare34.tgz [X] xfont34.tgz [X] xserv34.tgz
Далее введите done, и подтвердите начало установки. После окончания распаковки снова введите done.
File Name? (or 'done') [done] Enter Ready to install sets? [y] Enter Getting bsd ... 100% |**************************************************| 4735 KB 00:03 Getting bsd.rd ... 100% |**************************************************| 4275 KB 00:02 Getting base34.tgz ... 100% |**************************************************| 30267 KB 00:21 Getting etc34.tgz ... 100% |**************************************************| 1545 KB 00:01 Getting misc34.tgz ... 100% |**************************************************| 1909 KB 00:01 Getting comp34.tgz ... 100% |**************************************************| 17074 KB 00:13 Getting man34.tgz ... 100% |**************************************************| 6139 KB 00:04 Getting game34.tgz ... 100% |**************************************************| 2534 KB 00:01 Getting xbase34.tgz ... 100% |**************************************************| 10940 KB 00:06 Getting xshare34.tgz ... 100% |**************************************************| 1656 KB 00:02 Getting xfont34.tgz ... 100% |**************************************************| 31160 KB 00:21 Getting xserv34.tgz ... 100% |**************************************************| 15228 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')
На следующий вопрос следует ответить “y”, если предполагается использование X Window System. Вам будет предложено выбрать временной пояс.
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] Russia Select a sub-timezone of 'US' ('?' for list): Moscow Setting local timezone to 'US/Eastern'...done. 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. # halt syncing disks... done The operating system has halted. Please press any key to reboot.
После ввода команды halt начнется перезагрузка системы. Весь процесс занимает около 5-7 минут. Почему - станет ясно после первого запуска. Кроме базовой системы на диск не копируется ничего! Установка дополнительных компонентов остается на совести пользователя. В следующей статье я собираюсь рассмотреть сборку ядра системы, а также минимальную настройку рабочей среды пользователя.