特殊:Badtitle/NS100:Installation/UnattendedCD

来自Ubuntu中文
Wikibot留言 | 贡献2009年5月18日 (一) 16:20的版本 (创建新页面为 '{{From|https://help.ubuntu.com/community/Installation/UnattendedCD}} {{Languages|UbuntuHelp:Installation/UnattendedCD}} == Goal == The goal of this guide is to help you create a...')
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳到导航跳到搜索

{{#ifexist: :Installation/UnattendedCD/zh | | {{#ifexist: Installation/UnattendedCD/zh | | {{#ifeq: {{#titleparts:Installation/UnattendedCD|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:Installation/UnattendedCD|1|-1|}} | zh | | }}

Goal

The goal of this guide is to help you create an Ubuntu installation CD that you can use to perform unattended installations. Configuration files will be fetched from a web server, so the process can be easily updated without the need to master and burn more CDs. Control of a DHCP server is not required.

Caveats

This system has not been used in a production environment. This guide was developed with the Ubuntu Jaunty (9.04) Server Install CD. For other versions and varieties of Ubuntu, some parts may vary. The custom installation CD is somewhat dangerous, in that you just need to press "enter" after booting to it, and it will proceed to erase the system's hard drive without further confirmation.

Components

Once set up, the system will consist of the following parts:

  • A customized installation CD.
  • A web server which provides the preseed file.

Usage

Once completed, the CD can be used as follows:

  • Connect a keyboard and monitor to a fresh server.
  • Boot the server using the CD.
  • Press enter to select the "Unattended Installation" option.
  • Wait for installation to complete.
  • Remove the CD.
  • Log in to the server and perform any specific setup tasks.

Guide

Custom installation CD

We'll use the Jaunty server install CD as a base, and make the following changes:

  • Set a default language so the language selection menu doesn't appear.
  • Add a menu entry called "Unattended Installation" on top of the menu.

Preparation

  • Decide on the webserver you'll be using, and construct the general URL for the preseed file. This will be hardcoded into the CD. A good URL is something like: http://mywebserver.mydomain.tld/preseed/ubuntu-9.04.seed
  • Determine the codes for your language. You'll need a short one (e.g., "en" for "English") and a longer one for the locale (e.g., "en_US" for U.S. English).

Process

  • Download the Ubuntu CD image to be customized from your favorite mirror.
  • Install isomaster
  • Run isomaster, giving it the Ubuntu CD image as a parameter.
  • In isomaster's Tools menu, select Options, then change the editor to "gedit"
  • Create a text file in your home directory called "lang" containing the text "en"
  • In isomaster's bottom pane, enter the /isolinux directory
  • In the top pane, select the file "lang"
  • Click the "add" button. You should now have a /isolinux/lang file in the ISO image.
  • In the /isolinux directory, select text.cfg and edit it.
  • It contains four or five menu options. Add a new one as the first menu option, and set it as the default. Use the example below, but use your own URL and locale. Also, the "append" setting all goes on one line.
 default unattended
 label unattended
  menu label ^Unattended Installation
  kernel /install/vmlinuz
  append preseed/url=http://mywebserver.mydomain.tld/preseed/ubuntu-9.04.seed
      debian-installer/locale=en_US netcfg/choose_interface=auto
      initrd=/install/initrd.gz priority=critical --

Explanation: There are several setup questions that occur before your preseed file will be fetched. Some of the options that are set using the "append" directive above provide answers to those questions so they won't be asked.

  • Setting preseed/url makes the cd download your preseed file, which can be modified without remastering the CD.
  • Setting the locale prevents the installer from asking your locale.
  • Setting netcfg/choose_interface makes the installer choose a likely interface. The next thing the installer will do is download the preseed file.
  • Setting priority=critical prevents low-priority questions from being asked.

The "append" setting is the last one, and it all goes on one line, up to and including the double dash (--).

  • Save text.cfg and close gedit.
  • Tell isolinux to "save as", and give it a filename for the new, remastered ISO file. Example: ubuntu-9.04-server-unattended-i386.iso
  • Burn the CD. Example: cdrecord ubuntu-9.04-server-unattended-i386.iso

webserver

The webserver's duty is to serve the preseed file. General webserver setup is beyond the scope of this guide. But, a simple way to do it is (using root privileges): mkdir /var/www/preseed ... and then copy the relevant files to /var/www/preseed.

preseed file

This file controls the installation process. There is a lot that can be done with it. In this guide, I'll just note the settings that need to be changed to accomplish an unattended installation.

Setting Value
partman-auto/disk /dev/sda
passwd/root-login true
passwd/make-user false
passwd/root-password-crypted (the password hash)
pkgsel/include openssh-server wget

That will suffice to make the installation unattended. You may also want to customize it further, omitting the installation of extra software, and so forth; see https://help.ubuntu.com/9.04/installation-guide/powerpc/preseed-contents.html

  • Put the preseed file on the webserver so that the customized CD will fetch it and use it. Copy it to /var/www/preseed, giving it the proper name (e.g., ubuntu-9.04.seed).

Testing

By following the instructions above, you should have an Ubuntu installation CD that will run unattended. You boot a fresh new server using the CD, press enter to choose the "Unattended Installation" option, and the CD does the rest. Follow the steps in the "Usage" section above and ensure that everything's working OK.