通过Preseeding实现Ubuntu的自动安装

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

通过Preseeding实现Ubuntu的自动安装

#1

帖子 anriqing » 2008-10-29 10:53

对于需要给多台机器安装系统的用户来说,能够实现自动安装无疑会节省不少人力以及时间。那么Ubuntu下能否实现自动安装呢?可以的,而且还不止一种方法。下面这个网页指出了Ubuntu下自动安装的几种方法:https://help.ubuntu.com/7.10/installati ... stall.html
我要和大家分享的是其中提到的最后一种方法:the Ubuntu Installer itself,也就是Preseeding——预置的方法。
下面这个链接是Ubuntu官方关于Preseeding的介绍:https://help.ubuntu.com/7.10/installati ... eseed.html
如果英文阅读起来不方便,也可以参考阅读Debian关于Preseeding的中文介绍,二者的内容基本是一样的:http://www.debian.org/releases/etch/spa ... html.zh_CN
注意:对于希望尝试自动安装的读者,千万要小心自己的硬盘数据,建议在虚拟机或者没有重要数据的硬盘上尝试。我自己是用公司的闲置电脑实验的。

Preseeding将安装过程中需要回答的问题的答案放到预置文件中,这样在安装系统的过程中就无需手动输入问题的答案,这是Preseeding实现的原理。preseeding是针对Debian的系统来说的。作为在Debian基础上开发的Ubuntu,同样支持Preseeding,我们可以像编写Debian下的预置文件一样编写Ubuntu的预置文件。Preseeding和预置文件的其他信息我就不再详细介绍了,感兴趣的读者可以参考我上面给出的链接。

我们没有必要重新创建一个新的预置文件,通过对现有预置文件的修改可以帮我们更方便的得到我们自己所需要的预置文件。Debian预置文件的范例可以通过以下链接得到:http://www.debian.org/releases/etch/example-preseed.txt。Ubuntu预置文件的范例在上面Ubuntu官方关于Preseeding的介绍中有一个链接,不过这个链接已经失效了。我是通过比较另类的方法得到ubuntu的预置文件范例的,通过Wubi安装Ubuntu,但是并不重启电脑真正安装,在wubi创建的Ubuntu文件夹下就有个预置文件,具体的路径是:ubuntu\install\custom-installation\preseed.cfg。这里的preseed.cfg就是我们需要的预置文件了。

在讲解如何配置预置文件之前,还有一点需要指出:Ubuntu在安装过程中需要回答7个问题,分别是:1.语言环境;2.地区;3.键盘布局;4.硬盘分区;5.用户名和密码;6.文件迁移;7.最终确认(GRUB安装位置),事实上,Ubuntu在安装过程中不止需要配置这7个方面的环境,还有很多其他方面也需要配置,比如网络,镜像,套件,APT等等,那么为什么我们没有看到关于这些设置的问题呢?其实是Ubuntu的安装器Ubiquity自己回答了这些问题。下面这段代码是Ubuntu-8.04.0-i386-desktop中isolinux.cfg文件关于live-install的相关代码,我们执行Ubuntu的Live CD安装时都是执行的这段代码:

代码: 全选

LABEL live-install
  menu label ^Install Ubuntu
  kernel /casper/vmlinuz
  append  file=/cdrom/preseed/ubuntu.seed boot=casper only-ubiquity initrd=/casper/initrd.gz quiet splash --
注意看append中有一个“only-ubiquity ”的参数,这个参数表明在Live CD安装的过程中,Ubituity使用的only-ubiquity这种模式,在这种模式下,我们只需要回答那7个问题,其他的问题由Ubiquity自动回答。而我们在实现自动安装的过程中,需要把Ubiquity的模式修改为“automatic-ubiquity”,同时,还需要配置除了7个常规问题之外的其他问题。


下面我以Live USB实现自动安装的方法为例来讲解如何实现Ubuntu的自动安装。制作Live USB的方法有很多种,我是使用UltraISO来制作的,具体的实现过程见如下网页:viewtopic.php?f=77&t=139966,事实上,只要是通过syslinux方法实现Live USB的,下面的操作都是大同小异的,比如UNetBootin,或者Ubuntu8.10自带的工具Live USB Creator。我们需要完成以下两个步骤:
1.配置preseed.cfg文件,将安装过程中需要回答的问题全部回答好并且回答正确;
2.在syslinux.cfg文件中添加对preseed.cfg的指引;
其中,对7个问题的回答分别如下所示:
1.中文(简体)
2.中国(上海)
3.USA-USA
4.向导-使用整个硬盘
5.账号:abc,密码:123
6.无用户文件导入
7.GRUB默认安装在第一个硬盘
其他的问题采用自动配置。这样,我修改完成后的preseed.cfg文件如下所示:
注意:preseed.cfg与Ubuntu具体的版本也有关系,千万不可混用,我这里使用的版本是ubuntu-8.04.1-i386-desktop版本。

代码: 全选

## LOCALE
# Locale sets language and country.
d-i debian-installer/locale string zh_CN

## KEYBOARD
# Keyboard selection.
# d-i console-setup/modelcode string pc104
d-i console-setup/layoutcode string us
# To select a variant of the selected layout (if you leave this out, the
# basic form of the layout will be used):
#d-i console-setup/variantcode string dvorak

#d-i console-tools/archs select at
#d-i console-keymaps-at/keymap select us

## NETWORKING
# netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface.
d-i netcfg/choose_interface select auto
# To pick a particular interface instead:
#d-i netcfg/choose_interface select eth1
# If you have a slow dhcp server and the installer times out waiting for
# it, this might be useful.
#d-i netcfg/dhcp_timeout string 60
# If you prefer to configure the network manually, uncomment this line and
# the static network configuration below.
#d-i netcfg/disable_dhcp boolean true
# If you want the preconfiguration file to work on systems both with and
# without a dhcp server, uncomment these lines and the static network
# configuration below.
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Do not configure the network at this time
# Static network configuration.
# d-i netcfg/get_nameservers string 192.168.1.1
# d-i netcfg/get_ipaddress string 192.168.1.42
# d-i netcfg/get_netmask string 255.255.255.0
# d-i netcfg/get_gateway string 192.168.1.1
# d-i netcfg/confirm_static boolean true
# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string ubuntu
d-i netcfg/get_domain string ubuntu-domain
# Disable that annoying WEP key dialog.
d-i netcfg/wireless_essid string essid
d-i netcfg/wireless_wep string
# The wacky dhcp hostname that some ISPs use as a password of sorts.
#d-i netcfg/dhcp_hostname string radish

## UBIQUITY
ubiquity	ubiquity/summary	note
ubiquity	ubiquity/reboot boolean true
ubiquity    ubiquity/success_command string [ -x /custom-installation/hooks/success-command.sh ] && /custom-installation/hooks/success-command.sh 
ubiquity    ubiquity/failure_command string [ -x /custom-installation/hooks/failure-command.sh ] && /custom-installation/hooks/failure-command.sh 
#ubiquity    ubiquity/automation_failure_command [ -x /custom-installation/hooks/failure-command.sh ] && /custom-installation/hooks/failure-command.sh

## SKIP Security-Update-Error
d-i apt-setup/security-updates-failed note

## MIRRORS
#~ d-i mirror/country string enter information manually
#~ d-i mirror/http/hostname string archive.ubuntu.com
#~ d-i mirror/http/directory string /ubuntu
d-i mirror/http/proxy string

## SUITE
# Suite to install.
d-i mirror/suite string hardy
# Suite to use for loading installer components (optional).
#d-i mirror/udeb/suite string edgy

## PARTITIONING
# If the system has free space you can choose to only partition that space.
# Note: this must be preseeded with a localized (translated) value.
#d-i partman-auto/init_automatically_partition \
#      select Use the largest continuous free space
# Alternatively, you can specify a disk to partition. The device name can
# be given in either devfs or traditional non-devfs format.
# For example, to use the first SCSI hard disk:
d-i partman-auto/disk string /dev/sda
d-i partman-auto/method string regular
# Or, if you want to use LVM:
#d-i partman-auto-lvm/disk string /dev/sda
# You can choose from any of the predefined partitioning recipes.
# Note: this must be preseeded with a localized (translated) value.
##
d-i partman-auto/choose_recipe \
       select All files in one partition (recommended for new users)
#d-i partman-auto/choose_recipe \
#       select Separate /home partition
#d-i partman-auto/choose_recipe \
#       select Separate /home, /usr, /var, and /tmp partitions
# Or provide a recipe of your own...
# The recipe format is documented in the file devel/partman-auto-recipe.txt.
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
# If not, you can put an entire recipe the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
#LoopInstallFolder=/ubuntu/disks
#d-i partman-auto/disk string LIDISK
#d-i partman-auto/method string loop
#d-i partman-auto-loop/partition string LIPARTITION
#d-i partman-auto-loop/recipe string   \
#  /ubuntu/disks/root.disk 3000 9000 9000 ext3 method{ format } format{ } use_filesystem{ } filesystem{ ext3 } mountpoint{ / } . \
#  /ubuntu/disks/swap.disk 100 1000 1000 linux-swap method{ swap } format{ } . \
#  \
#  \

#d-i partman-auto/expert_recipe string                         \
#      boot-root ::                                            \
#              40 50 100 ext3                                  \
#                      $primary{ } $bootable{ }                \
#                      method{ format } format{ }              \
#                      use_filesystem{ } filesystem{ ext3 }    \
#                      mountpoint{ /boot }                     \
#              .                                               \
#              500 10000 1000000000 ext3                       \
#                      method{ format } format{ }              \
#                      use_filesystem{ } filesystem{ ext3 }    \
#                      mountpoint{ / }                         \
#              .                                               \
#              64 512 300% linux-swap                          \
#                      method{ swap } format{ }                \
#              .
# This makes partman automatically partition without confirmation.
d-i partman/confirm_write_new_label boolean true
#
d-i partman/choose_partition \
       select Finish partitioning and write changes to disk
d-i partman/confirm boolean true

## CLOCK AND TIME ZONE
# Controls whether or not the hardware clock is set to UTC.
d-i clock-setup/utc boolean false
# You may set this to any valid setting for $TZ; see the contents of
# /usr/share/zoneinfo/ for valid values.
d-i time/zone string Asia/Shanghai

## APT
# You can choose to install restricted and universe software, or to install
# software from the backports repository.
#d-i apt-setup/restricted boolean true
#d-i apt-setup/universe boolean true
#d-i apt-setup/backports boolean true
# Uncomment this to avoid adding security sources, or
# add a hostname to use a different server than security.ubuntu.com.
#d-i apt-setup/security_host string
# Additional repositories, local[0-9] available
#d-i apt-setup/local0/repository string \
#       deb http://local.server/ubuntu edgy main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository
#d-i apt-setup/local0/key string http://local.server/key

## USER ACCOUNT
# Skip creation of a root account (normal user account will be able to
# use sudo). The default is false; preseed this to true if you want to set
# a root password.
d-i passwd/root-login boolean false
# Alternatively, to skip creation of a normal user account.
#d-i passwd/make-user boolean false
# Root password, either in clear text
#d-i passwd/root-password password r00tme
#d-i passwd/root-password-again password r00tme
# or encrypted using an MD5 hash.
#d-i passwd/root-password-crypted password [MD5 hash]
# To create a normal user account.
d-i passwd/user-fullname string abc User
d-i passwd/username string abc
# Normal user's password, either in clear text
#d-i passwd/user-password password 123
#d-i passwd/user-password-again password 123
# or encrypted using an MD5 hash.
#d-i passwd/user-password-crypted password $1$2SGVV3Ue$mI3IzQ08IArdeVnTctxaK/
#An MD5 hash for a password can be generated using the following command.
#$ echo "r00tme" | mkpasswd -s -H MD5

## BASE SYSTEM INSTALLATION
# Select the initramfs generator used to generate the initrd for 2.6 kernels.
#d-i base-installer/kernel/linux/initramfs-generators string yaird

## BOOT LOADER
# Grub is the default boot loader (for x86). If you want lilo installed
# instead, uncomment this:
#d-i grub-installer/skip boolean true
d-i lilo-installer/skip boolean true
# This is fairly safe to set, it makes grub install automatically to the MBR
# if no other operating system is detected on the machine.
#d-i grub-installer/only_debian boolean true
# This one makes grub-installer install to the MBR if if finds some other OS
# too, which is less safe as it might not be able to boot that other OS.
#d-i grub-installer/with_other_os boolean true
# Alternatively, if you want to install to a location other than the mbr,
# uncomment and edit these lines:
# d-i grub-installer/bootdev  string (hd0,0)
#d-i grub-installer/bootdev_directory string /ubuntu/disks
d-i grub-installer/only_debian boolean true
#d-i grub-installer/with_other_os boolean true

## PACKAGE SELECTION
tasksel tasksel/first multiselect ubuntu-desktop
#tasksel tasksel/first multiselect ubuntu-standard
#tasksel tasksel/first multiselect ubuntu-standard, lamp-server
#tasksel tasksel/first multiselect ubuntu-standard, kubuntu-desktop
#d-i pkgsel/include string openssh-server build-essential
# Some versions of the installer can report back on what software you have
# installed, and what software you use. The default is not to report back,
# but sending reports helps the project determine what software is most
# popular and include it on CDs.
#popularity-contest popularity-contest/participate boolean false

## FINISH FIRST STAGE
# Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
d-i cdrom-detect/eject boolean false

## X CONFIGURATION
# X can detect the right driver for some cards, but if you're preseeding,
# you override whatever it chooses. Still, vesa will work most places.
#xserver-xorg xserver-xorg/config/device/driver select vesa
# A caveat with mouse autodetection is that if it fails, X will retry it
# over and over. So if it's preseeded to be done, there is a possibility of
# an infinite loop if the mouse is not autodetected.
#xserver-xorg xserver-xorg/autodetect_mouse boolean true
# Monitor autodetection is recommended.
xserver-xorg xserver-xorg/autodetect_monitor boolean true
# Uncomment if you have an LCD display.
#xserver-xorg xserver-xorg/config/monitor/lcd boolean true
# X has three configuration paths for the monitor. Here's how to preseed
# the "medium" path, which is always available. The "simple" path may not
# be available, and the "advanced" path asks too many questions.
##
#xserver-xorg xserver-xorg/config/monitor/selection-method \
#       select medium
##
#xserver-xorg xserver-xorg/config/monitor/mode-list \
#       select 1024x768 @ 60 Hz

## PRESEEDING OTHER PACKAGES
# Depending on what software you choose to install, or if things go wrong
# during the installation process, it's possible that other questions may
# be asked. You can preseed those too, of course. To get a list of every
# possible question that could be asked during an install, do an
# installation, and then run these commands:
#   debconf-get-selections --installer > file
#   debconf-get-selections >> file

## MIGRATION-ASSISTANT
#UserFolder=/Users/yanchen
#d-i anna/choose_modules multiselect migration-assistant
#d-i migration-assistant/partitions multiselect Windows XP Professional (/dev/MADEVICE)
#d-i migration-assistant/MADEVICE/users multiselect yanchen
#d-i migration-assistant/MADEVICE/yanchen/items multiselect AIM Triton, Internet Explorer, Yahoo, MSN, Opera, Firefox, Wallpaper, User Picture, Outlook Express, Gaim
# d-i migration-assistant/MADEVICE/hostuser/items multiselect My Documents, Internet Explorer
#d-i migration-assistant/MADEVICE/yanchen/user string ubuntu
# d-i migration-assistant/new-user/linuser/password password xyz
# d-i migration-assistant/new-user/linuser/password-again password xyz
# d-i migration-assistant/new-user/linuser/fullname string fullusername
# d-i migration-assistant/new-user/linuser/administrator boolean true

## SHELL COMMANDS.
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preseed file like this one. Only use preseed files from trusted
# locations! To drive that home, and because it's generally useful, here's
# a way to run any shell command you'd like inside the installer,
# automatically.

# This first command is run as early as possible, just after
# preseeding is read.
d-i preseed/early_command string [ -x /custom-installation/hooks/early-command.sh ] && /custom-installation/hooks/early-command.sh

# This command is run just before the install finishes, but when there is
# still a usable /target directory.
#d-i preseed/late_command string echo foo > /target/etc/bar
# d-i preseed/late_command string rm /target/usr/lib/base-config/menu/apt-setup; rm /target/usr/lib/base-config/menu/apt-setup.mnu
#~ d-i preseed/late_command string /sbin/late_command
其中Ubiquity一段调用了另外几个脚本,这里我们仍然借用wubi安装方法得到的文件,即Ubuntu/install/custom-installation这个文件夹,我们需要做的是将我们配置好的preseed.cfg文件替换掉原来的文件,然后我们将custom-installation这个文件夹拷贝到Live USB中。

接下来,我们需要在syslinux.cfg文件中添加对custom-installation这个预置文件夹的指引。syslinux.cfg在Live USB的syslinux文件夹下,如果是CD的话,对应的文件是isolinux文件夹下的isolinux.cfg。
在syslinux.cfg文件里,在live-install的那段代码后增加如下这段代码:

代码: 全选

LABEL auto-install
menu label ^Install Ubuntu Automatically
kernel /casper/vmlinuz
append boot=casper initrd=/casper/initrd.gz ro debian-installer/custom-installation=/custom-installation automatic-ubiquity noprompt quiet splash --
另外将DEFAULT和后面的timetou改为如下所示:

代码: 全选

DEFAULT auto-install
……
timeout 1
这样的话,如果从Live USB启动,Ubuntu就会全自动安装而无需手动回答问题了。

如果是Live CD,则前面修改syslinux.cfg的地方全部换做isolinux.cfg就可以了。同时Live CD还需要将这些安装文件整合成ISO镜像,在Ubuntu的终端下,输入如下命令可以帮我们做到:

代码: 全选

sudo mkisofs -r -cache-inodes \
-J -l -b isolinux/isolinux.bin -c isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o ubuntu.iso path-of-install-file
其中,ubuntu.iso是输出的ISO镜像的名称,path-of-install-file是这些安装文件所在的路径。ISO镜像制作完成之后,可以在虚拟机下进行安装,刻录成光盘?实用性好像不是很大。

将预置文件放到server上,然后自动安装,还在学习中。

另外:我自己还有不懂的地方,请高人指点一二。
1.我通过以上预置文件制作的Live USB,在实现自动安装的过程中,其他问题都能自动回答,只有在配置apt的时候,会弹出一个警告的消息,提示从光盘上读取apt信息错误,点击“确定”后,安装也能顺利进行下去。而通过Live CD安装过程中,则没有这个错误出现。两种方法使用的预置文件相同,我不知道我是什么地方配置错误了,请高人指点。
2.预置文件的分区信息中,关于自定义分区,有下面这段代码:

代码: 全选

#d-i partman-auto/expert_recipe string                         \
#      boot-root ::                                            \
#              40 50 100 ext3                                  \
#                      $primary{ } $bootable{ }                \
#                      method{ format } format{ }              \
#                      use_filesystem{ } filesystem{ ext3 }    \
#                      mountpoint{ /boot }                     \
#              .                                               \
#              500 10000 1000000000 ext3                       \
#                      method{ format } format{ }              \
#                      use_filesystem{ } filesystem{ ext3 }    \
#                      mountpoint{ / }                         \
#              .                                               \
#              64 512 300% linux-swap                          \
#                      method{ swap } format{ }                \
40,50,100这些数字代表什么含义。其中最后的300%指的是内存大小的三倍。我通过自动分区方法得到的分区中有/和swap两个分区,其中swap分区是内存三倍,其他硬盘空间全部分给/。所以我知道这里的300%的含义,那么其他的数字呢?请高人指点。
附件
custom-installation.zip
我自己的custom-installation
(6.87 KiB) 已下载 228 次
syslinux.zip
我自己的syslinux.cfg
(573 Bytes) 已下载 171 次
上次由 anriqing 在 2008-11-10 21:14,总共编辑 5 次。
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#2

帖子 anriqing » 2008-10-29 14:28

有人帮忙看一看吗?
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#3

帖子 anriqing » 2008-10-29 17:02

我也来灌灌水~~~
郁闷哪 :em20
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
ptptptptptpt
帖子: 3711
注册时间: 2006-09-19 18:16

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#4

帖子 ptptptptptpt » 2008-10-29 17:51

似乎那个 preseed 就是用来自定义安装的。搜一下 英文 wiki ,或许会有相关资料
头像
windwiny
帖子: 2254
注册时间: 2007-03-13 17:26

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#6

帖子 windwiny » 2008-10-29 17:58

解开它的 initrd ,看看里面的安装脚本之类的东西, 在需要设置的时候从某个地方读取或直接设固定
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#7

帖子 anriqing » 2008-10-29 20:26

ptptptptptpt 写了:Automatic Installation
https://help.ubuntu.com/7.10/installati ... stall.html

Unattended Network Install - using preseed
http://ubuntuforums.org/showthread.php?t=829482
多谢pt的帮助,我现在正在看preseed的相关文档,看来是这个没错了。 :em02
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#8

帖子 anriqing » 2008-11-01 15:22

这两天在学习使用preseed.cfg进行自动安装的方法,我看了英文的原文,后来不经意间又找到了Debian在这方面的汉化文档,结果发现,二者同出一辙,可以看出Ubuntu的这些英文文档也是从Debian那里继承来的,只是Debian因为发行时间早,所以翻译工作做得比较好一些。这里我把汉化文档的链接给出来,后面的讨论都直接基于这个汉化文档吧。
使用预置自动进行安装 http://www.debian.org/releases/etch/spa ... html.zh_CN

B.2.1. 加载预置文件这一节中,有这样一句话:
如果使用 initrd 预置,您只需确保一个名为 preseed.cfg 的文件包含在 initrd 的根目录里面。安装程序会自动检测并加载。
因为对于自动化安装来说,initrd 方法可以用于任何一种安装方式并支持较多的预置内容,所以我想先学习这样一种方式。现在,我的疑问是:这里所说的initrd的根目录指的是什么?在ISO镜像里,是只有initrd.gz这个压缩文件的,那么preseed.cfg文件到底放到哪里呢?
我自己的尝试:
1.将preseed.cfg文件放到casper目录下,即和initrd.gz在同一目录,然后刻录成光盘,在安装过程中,语言选择画面仍然会出现,需要手动选择;
2.将preseed.cfg文件放到preseed文件夹下,结果和1一样;

这样之后,心里不免猜测:难道是要将preseed.cfg文件放到initrd.gz中,然后在init文件里添加对preseed.cfg文件的读取?不知道是否真是如此?如果是这样的话,应该如何编译?小弟接触linux才3个月,还不会编译initrd,请教高人给予指点一二。

PS:下面是我自己定义的preseed.cfg,不知道是否有问题,也请高人给予指点。
配置前提:机器单硬盘,且硬盘为空,所以分区方式为对第一个硬盘进行自动分区,GRUB也默认安装在MBR上。帐户为abc,密码为123.

代码: 全选

#Language and Country select
d-i debian-installer/locale string zh_CN
#keyboard layout
d-i console-keymaps-at/keymap select us
#Partition
d-i partman-auto/disk string /dev/discs/disc0/disc
d-i partman-auto/method string regular
d-i partman/confirm_write_new_label boolean true
d-i partman/choose_partition \
       select Finish partitioning and write changes to disk
d-i partman/confirm boolean true
#Account setting
d-i passwd/user-fullname string abc
d-i passwd/username string abc
d-i passwd/user-password password 123
d-i passwd/user-password-again password 123
#Boot loader installation
d-i grub-installer/only_debian boolean true
#Finishing up the first stage install,Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note
# This will prevent the installer from ejecting the CD during the reboot,
# which is useful in some situations.
d-i cdrom-detect/eject boolean false
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#9

帖子 anriqing » 2008-11-03 14:15

求人不如求己,又头疼了两天之后,自己终于学会如何去设置了。目前已经通过Live USB自动安装成功。CD和PXEserver待检验中。
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
上帝很帅
帖子: 234
注册时间: 2007-09-02 23:26
来自: 上帝之家

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#10

帖子 上帝很帅 » 2008-11-03 14:53

好样的

希望可以更进一步

可以定制所需的软件

最好能够写个如何定制的教程

这样以后自己定制个live usb,用起来就很方便了
Ubuntu挺好的,谁用谁知道。
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 【求助】如何制作无人值守安装的Ubuntu ISO

#11

帖子 anriqing » 2008-11-03 18:50

上帝很帅 写了:好样的

希望可以更进一步

可以定制所需的软件

最好能够写个如何定制的教程

这样以后自己定制个live usb,用起来就很方便了
这两天比较忙一点,没有时间去写这个。等闲下来了,我会把实现的过程写下来分享给大家。至于定制。。。学完这个再说咯 :em01
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
sunzhaoyu2000
帖子: 700
注册时间: 2006-10-18 15:48

Re: 【求助】通过Preseeding实现Ubuntu的自动安装

#12

帖子 sunzhaoyu2000 » 2008-11-03 18:57

强烈的关注中

楼主加油再加油hoho
:em11
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 通过Preseeding实现Ubuntu的自动安装

#13

帖子 anriqing » 2008-11-10 21:08

通过preseeding实现自动安装的方法步骤已经更新到1楼,大家可以看看。如果有什么问题,欢迎来拍砖。
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
头像
anriqing
帖子: 189
注册时间: 2008-08-19 12:59

Re: 通过Preseeding实现Ubuntu的自动安装

#14

帖子 anriqing » 2008-11-11 9:02

帖子太长,不知道有没有人帮忙看看我的两个问题。
Windows Vista Ultimate SP1 CHS + Ubuntu 8.04.1 desktop i386

CPU:Intel Core 2 Duo T7250 RAM:2048MB DDR2-667
VGA:NVidia Geforce 8400M GS 128MB HD:SumSung 160G 5400R
LAN:Broadcom NetLink WIFI:Intel 3945ABG
WebCam:2.0M
lingod01
帖子: 1
注册时间: 2010-06-08 9:34

Re: 通过Preseeding实现Ubuntu的自动安装

#15

帖子 lingod01 » 2010-06-08 9:37

回复