个人工具

“UbuntuHelp:InstallCDCustomization/PreseedExamples”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/InstallCDCustomization/PreseedExamples}} {{Languages|UbuntuHelp:InstallCDCustomization/PreseedExamples}} https://help.ubuntu.com/community/IconsPa...)
 
第2行: 第2行:
 
{{Languages|UbuntuHelp:InstallCDCustomization/PreseedExamples}}
 
{{Languages|UbuntuHelp:InstallCDCustomization/PreseedExamples}}
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png These are debconf seed files to help you customize an Ubuntu installation CD.  For more information, see [[UbuntuHelp:InstallCDCustomization]].
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=info.png These are debconf seed files to help you customize an Ubuntu installation CD.  For more information, see [[UbuntuHelp:InstallCDCustomization]].
 
 
=== 100% automatic installation script ===
 
=== 100% automatic installation script ===
 
 
This preseed file was written by CraigBox for his employer, [http://www.itpartners.co.nz/ IT Partners].  It automatically partitions and installs a machine, including a complex setup script that is run on first boot.
 
This preseed file was written by CraigBox for his employer, [http://www.itpartners.co.nz/ IT Partners].  It automatically partitions and installs a machine, including a complex setup script that is run on first boot.
 
 
<pre><nowiki>
 
<pre><nowiki>
 
 
# If you're remastering a CD, you could use this:
 
# If you're remastering a CD, you could use this:
 
#  preseed/file=/cdrom/preseed/firewall.seed
 
#  preseed/file=/cdrom/preseed/firewall.seed
第24行: 第20行:
 
#    kbd-chooser/method=us
 
#    kbd-chooser/method=us
 
#
 
#
 
 
# Always install the server kernel.
 
# Always install the server kernel.
 
d-i    base-installer/kernel/override-image    string linux-server
 
d-i    base-installer/kernel/override-image    string linux-server
 
# Don't install usplash.
 
# Don't install usplash.
 
d-i    base-installer/kernel/linux/extra-packages-2.6  string
 
d-i    base-installer/kernel/linux/extra-packages-2.6  string
 
 
# Desktop system not installed; don't waste time and disk space copying it.
 
# Desktop system not installed; don't waste time and disk space copying it.
 
d-i    archive-copier/desktop-task    string ubuntu-standard
 
d-i    archive-copier/desktop-task    string ubuntu-standard
 
d-i    archive-copier/ship-task        string
 
d-i    archive-copier/ship-task        string
 
 
# Only install the standard system and language packs.
 
# Only install the standard system and language packs.
 
d-i    pkgsel/install-pattern  string ~t^ubuntu-standard$
 
d-i    pkgsel/install-pattern  string ~t^ubuntu-standard$
 
d-i    pkgsel/language-pack-patterns  string
 
d-i    pkgsel/language-pack-patterns  string
 
 
# No language support packages.
 
# No language support packages.
 
base-config    base-config/install-language-support    boolean false
 
base-config    base-config/install-language-support    boolean false
 
 
 
# itp: copy the install script from the CD to the HDD, and set it
 
# itp: copy the install script from the CD to the HDD, and set it
 
# in /etc/rc.local so it runs on first boot.
 
# in /etc/rc.local so it runs on first boot.
 
 
d-i    preseed/late_command            string cp -a /cdrom/preseed/install.sh /target/root; sed -i 's_exit 0_sh /root/install.sh_' /target/etc/rc.local;  
 
d-i    preseed/late_command            string cp -a /cdrom/preseed/install.sh /target/root; sed -i 's_exit 0_sh /root/install.sh_' /target/etc/rc.local;  
 
 
 
# netcfg will choose an interface that has link if possible. This makes it
 
# netcfg will choose an interface that has link if possible. This makes it
 
# skip displaying a list if there is more than one interface.
 
# skip displaying a list if there is more than one interface.
 
d-i    netcfg/choose_interface select auto
 
d-i    netcfg/choose_interface select auto
 
 
# Note that any hostname and domain names assigned from dhcp take
 
# Note that any hostname and domain names assigned from dhcp take
 
# precedence over values set here. However, setting the values still
 
# precedence over values set here. However, setting the values still
第57行: 第43行:
 
d-i    netcfg/get_hostname    string unassigned-firewall
 
d-i    netcfg/get_hostname    string unassigned-firewall
 
d-i    netcfg/get_domain      string unassigned-domain
 
d-i    netcfg/get_domain      string unassigned-domain
 
 
# Disable that annoying WEP key dialog.
 
# Disable that annoying WEP key dialog.
 
d-i    netcfg/wireless_wep    string
 
d-i    netcfg/wireless_wep    string
 
 
 
d-i    mirror/country          string New Zealand
 
d-i    mirror/country          string New Zealand
 
d-i    mirror/http/hostname    string nz.archive.ubuntu.com
 
d-i    mirror/http/hostname    string nz.archive.ubuntu.com
第67行: 第50行:
 
d-i    mirror/suite            string dapper
 
d-i    mirror/suite            string dapper
 
d-i    mirror/http/proxy      string
 
d-i    mirror/http/proxy      string
 
 
 
# Partition the first disc found
 
# Partition the first disc found
 
d-i    partman-auto/disk      string /dev/discs/disc0/disc
 
d-i    partman-auto/disk      string /dev/discs/disc0/disc
 
 
# Create a small /boot partition, suitable swap, and uses the rest of the space
 
# Create a small /boot partition, suitable swap, and uses the rest of the space
 
# for the root partition:
 
# for the root partition:
第94行: 第74行:
 
#      .
 
#      .
 
# (Craig changed this from 300%).
 
# (Craig changed this from 300%).
 
 
# This makes partman automatically partition without confirmation.
 
# This makes partman automatically partition without confirmation.
 
d-i    partman/confirm_write_new_label boolean true
 
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/choose_partition        select Finish partitioning and write changes to disk
 
d-i    partman/confirm                boolean true
 
d-i    partman/confirm                boolean true
 
 
 
# This is fairly safe to set, it makes grub install automatically to the MBR
 
# This is fairly safe to set, it makes grub install automatically to the MBR
 
# if no other operating system is detected on the machine.
 
# if no other operating system is detected on the machine.
第107行: 第84行:
 
# too, which is less safe as it might not be able to boot that 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
 
d-i    grub-installer/with_other_os    boolean true
 
 
 
# Avoid that last message about the install being complete.
 
# Avoid that last message about the install being complete.
 
d-i    prebaseconfig/reboot_in_progress        note
 
d-i    prebaseconfig/reboot_in_progress        note
 
 
 
# Controls whether or not the hardware clock is set to GMT.
 
# Controls whether or not the hardware clock is set to GMT.
 
 
d-i    clock-setup/utc                boolean true
 
d-i    clock-setup/utc                boolean true
 
d-i    time/zone                      string Pacific/Auckland
 
d-i    time/zone                      string Pacific/Auckland
 
 
 
# To preseed the root password, you have to put it in the clear in this
 
# To preseed the root password, you have to put it in the clear in this
 
# file. That is not a very good idea, use caution!
 
# file. That is not a very good idea, use caution!
 
passwd          passwd/root-password            password whatever
 
passwd          passwd/root-password            password whatever
 
passwd          passwd/root-password-again      password whatever
 
passwd          passwd/root-password-again      password whatever
 
 
passwd          passwd/root-login              boolean true
 
passwd          passwd/root-login              boolean true
 
# If you want to skip creation of a normal user account.
 
# If you want to skip creation of a normal user account.
 
passwd          passwd/make-user                boolean false
 
passwd          passwd/make-user                boolean false
 
 
 
# More flexibly, this runs a shell command and if it outputs the names of
 
# More flexibly, this runs a shell command and if it outputs the names of
 
# preseed files, includes those files. For example, to switch configs based
 
# preseed files, includes those files. For example, to switch configs based
 
# on a particular usb storage device (in this case, a built-in card reader):
 
# on a particular usb storage device (in this case, a built-in card reader):
 
 
d-i    preseed/include string  debconf/exim.cfg debconf/clamav.cfg debconf/mailgraph.cfg debconf/ntop.cfg debconf/samba.cfg debconf/ssh.cfg
 
d-i    preseed/include string  debconf/exim.cfg debconf/clamav.cfg debconf/mailgraph.cfg debconf/ntop.cfg debconf/samba.cfg debconf/ssh.cfg
 
</nowiki></pre>
 
</nowiki></pre>
 
 
In the 'debconf' directory I keep answers for packages that would otherwise ask questions at installation time.  I built these from the output of `debconf-get-selections`.  For example, exim.cfg contains:
 
In the 'debconf' directory I keep answers for packages that would otherwise ask questions at installation time.  I built these from the output of `debconf-get-selections`.  For example, exim.cfg contains:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
exim4-config    exim4/dc_noalias_regenerate    boolean false
 
exim4-config    exim4/dc_noalias_regenerate    boolean false
第158行: 第122行:
 
exim4-base      exim4/move_exim3_spool  boolean false
 
exim4-base      exim4/move_exim3_spool  boolean false
 
</nowiki></pre>
 
</nowiki></pre>
 
 
In install.sh, you can put anything you want to run at first boot.  I wanted finer grained control over what installed, in the way I had with base-config (which was removed with Ubuntu 6.06).  This file runs once, called from /etc/rc.local, and then modifies the rc.local script so it will not run again:
 
In install.sh, you can put anything you want to run at first boot.  I wanted finer grained control over what installed, in the way I had with base-config (which was removed with Ubuntu 6.06).  This file runs once, called from /etc/rc.local, and then modifies the rc.local script so it will not run again:
 
 
<pre><nowiki>
 
<pre><nowiki>
 
INSTALL="apt-get install -y"
 
INSTALL="apt-get install -y"
 
REMOVE="apt-get remove -y"
 
REMOVE="apt-get remove -y"
 
 
apt-get update
 
apt-get update
 
 
# email
 
# email
 
$INSTALL exim4-daemon-heavy mailx mailgraph
 
$INSTALL exim4-daemon-heavy mailx mailgraph
 
 
# etc - loads cut
 
# etc - loads cut
 
 
sed -i 's_sh /root/install.sh_exit 0_' /etc/rc.local
 
sed -i 's_sh /root/install.sh_exit 0_' /etc/rc.local
 
 
echo "Installation complete."
 
echo "Installation complete."
 
</nowiki></pre>
 
</nowiki></pre>
 
 
----
 
----
 
* Return to [[UbuntuHelp:InstallCDCustomization]].
 
* Return to [[UbuntuHelp:InstallCDCustomization]].
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 18:01的版本

IconsPage?action=AttachFile&do=get&target=info.png These are debconf seed files to help you customize an Ubuntu installation CD. For more information, see UbuntuHelp:InstallCDCustomization.

100% automatic installation script

This preseed file was written by CraigBox for his employer, IT Partners. It automatically partitions and installs a machine, including a complex setup script that is run on first boot.

# If you're remastering a CD, you could use this:
#   preseed/file=/cdrom/preseed/firewall.seed
#
# While you're at it, you may want to throw a debconf/priority=critical in
# there, to avoid most questions even if the preseeding below misses some.
# And you might set the timeout to 1 in syslinux.cfg to avoid needing to hit
# enter to boot the installer.
#
# Language, country, and keyboard selection cannot be preseeded from a file,
# because the questions are asked before the preseed file can be loaded.
# Instead, to avoid these questions, pass some more parameters to the kernel:
#
#    debian-installer/locale=en_NZ
#    kbd-chooser/method=us
#
# Always install the server kernel.
d-i     base-installer/kernel/override-image    string linux-server
# Don't install usplash.
d-i     base-installer/kernel/linux/extra-packages-2.6  string
# Desktop system not installed; don't waste time and disk space copying it.
d-i     archive-copier/desktop-task     string ubuntu-standard
d-i     archive-copier/ship-task        string
# Only install the standard system and language packs.
d-i     pkgsel/install-pattern  string ~t^ubuntu-standard$
d-i     pkgsel/language-pack-patterns   string
# No language support packages.
base-config     base-config/install-language-support    boolean false
# itp: copy the install script from the CD to the HDD, and set it
# in /etc/rc.local so it runs on first boot.
d-i     preseed/late_command            string cp -a /cdrom/preseed/install.sh /target/root; sed -i 's_exit 0_sh /root/install.sh_' /target/etc/rc.local; 
# 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
# Note that 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 unassigned-firewall
d-i     netcfg/get_domain       string unassigned-domain
# Disable that annoying WEP key dialog.
d-i     netcfg/wireless_wep     string
d-i     mirror/country          string New Zealand
d-i     mirror/http/hostname    string nz.archive.ubuntu.com
d-i     mirror/http/directory   string /ubuntu
d-i     mirror/suite            string dapper
d-i     mirror/http/proxy       string
# Partition the first disc found
d-i     partman-auto/disk       string /dev/discs/disc0/disc
# Create a small /boot partition, suitable swap, and uses the rest of the space
# for the root partition:
d-i     partman-auto/expert_recipe      string boot-root :: 100 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 2048 linux
-swap method{ swap } format{ } .
# For reference, here is that same recipe in a more readable form:
#       boot-root ::
#       100 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 2048 linux-swap
#               method{ swap } format{ }
#       .
# (Craig changed this from 300%).
# 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
# 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
# Avoid that last message about the install being complete.
d-i     prebaseconfig/reboot_in_progress        note
# Controls whether or not the hardware clock is set to GMT.
d-i     clock-setup/utc                 boolean true
d-i     time/zone                       string Pacific/Auckland
# To preseed the root password, you have to put it in the clear in this
# file. That is not a very good idea, use caution!
passwd          passwd/root-password            password whatever
passwd          passwd/root-password-again      password whatever
passwd          passwd/root-login               boolean true
# If you want to skip creation of a normal user account.
passwd          passwd/make-user                boolean false
# More flexibly, this runs a shell command and if it outputs the names of
# preseed files, includes those files. For example, to switch configs based
# on a particular usb storage device (in this case, a built-in card reader):
d-i     preseed/include string  debconf/exim.cfg debconf/clamav.cfg debconf/mailgraph.cfg debconf/ntop.cfg debconf/samba.cfg debconf/ssh.cfg

In the 'debconf' directory I keep answers for packages that would otherwise ask questions at installation time. I built these from the output of `debconf-get-selections`. For example, exim.cfg contains:

exim4-config    exim4/dc_noalias_regenerate     boolean false
exim4-config    exim4/dc_smarthost      string
exim4-config    exim4/dc_relay_domains  string
exim4-config    exim4/dc_relay_nets     string
exim4-base      exim4/purge_spool       boolean false
exim4-config    exim4/mailname  string  localhost.localdomain
exim4-config    exim4/dc_local_interfaces       string
exim4-config    exim4/dc_minimaldns     boolean false
exim4-config    exim4/exim3_upgrade     boolean true
exim4-config    exim4/dc_other_hostnames        string
exim4-config    exim4/dc_eximconfig_configtype  select  internet site; mail is sent and received directly using SMTP
exim4-config    exim4/no_config boolean true
exim4-config    exim4/hide_mailname     boolean
exim4-config    exim4/dc_postmaster     string
exim4-config    exim4/dc_readhost       string
exim4-config    exim4/use_split_config  boolean true
# Move yet undelivered mails from exim(v3) to exim4 spool?
exim4-base      exim4/move_exim3_spool  boolean false

In install.sh, you can put anything you want to run at first boot. I wanted finer grained control over what installed, in the way I had with base-config (which was removed with Ubuntu 6.06). This file runs once, called from /etc/rc.local, and then modifies the rc.local script so it will not run again:

INSTALL="apt-get install -y"
REMOVE="apt-get remove -y"
apt-get update
# email
$INSTALL exim4-daemon-heavy mailx mailgraph
# etc - loads cut
sed -i 's_sh /root/install.sh_exit 0_' /etc/rc.local
echo "Installation complete."