Debian自动化安装

定制Debian的自动化安装

1 更改grub配置文件,修改安装系统选项,加载安装配置文件(/boot/grub/grub.cfg)

if loadfont $prefix/font.pf2 ; then
  set gfxmode=800x600
  insmod efi_gop
  insmod efi_uga
  insmod video_bochs
  insmod video_cirrus
  insmod gfxterm
  insmod png
  terminal_output gfxterm
fi

if background_image /isolinux/splash.png; then
  set color_normal=light-gray/black
  set color_highlight=white/black
else
  set menu_color_normal=cyan/blue
  set menu_color_highlight=white/blue
fi

insmod play
play 960 440 1 0 4 440 1
set theme=/boot/grub/theme/1
menuentry --hotkey=g 'Graphical install' {
    set background_color=black
    linux    /install.amd/vmlinuz vga=788 --- quiet 
    initrd   /install.amd/gtk/initrd.gz
}
menuentry --hotkey=i 'Install' {
    set background_color=black
    linux    /install.amd/vmlinuz vga=788 --- quiet 
    initrd   /install.amd/initrd.gz
}
##下面是自动化安装选项, file=/cdrom/debian8.ks加载的自动化安装配置文件
menuentry 'Install Debian Auto' {
    set background_color=black
    linux /install.amd/vmlinuz auto=true file=/cdrom/debian8.ks  vga=788 --- quiet 
    initrd /install.amd/gtk/initrd.gz
}

2 制作自动化安装配置文件debian8.ks

d-i debian-installer/locale string en_US
d-i debian-installer/language string en
d-i debian-installer/country string US
d-i debian-installer/locale string en_US.UTF-8

d-i localechooser/supported-locales multiselect en_US.UTF-8 zh_CN.UTF-8

d-i console-setup/ask_detect boolean false
d-i console-setup/modelcode string pc105
d-i console-setup/layoutcode string us
d-i console-setup/variantcode string USA
d-i console-keymaps-at/keymap select us

d-i keyboard-configuration/xkb-keymap select us
d-i clock-setup/utc boolean true
d-i time/zone string Asia/Shanghai
d-i clock-setup/ntp boolean false
d-i clock-setup/ntp-server string cn.pool.ntp.org

d-i netcfg/choose_interface select auto
d-i netcfg/disable_dhcp boolean true
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/get_ipaddress string 10.0.0.111
d-i netcfg/get_nameservers string 10.0.0.1
d-i netcfg/get_netmask string 255.255.255.0
d-i netcfg/get_gateway string 10.0.0.1
d-i netcfg/confirm_static boolean true
d-i netcfg/get_hostname string ops.2233.tv
d-i netcfg/get_domain string 
d-i netcfg/wireless_wep string

popularity-contest popularity-contest/participate boolean false
d-i partman-auto/method string regular
d-i partman-auto/disk string /dev/sda
d-i partman-auto/choose_recipe select All files in one partition (recommended for new users)
d-i partman-auto/method string regular

d-i partman/confirm 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-lvm/confirm boolean true
d-i partman-lvm/device_remove_lvm boolean true
d-i partman-md/confirm_nooverwrite boolean true
d-i partman/choose_partition select finish
d-i partman/confirm_nooverwrite boolean true
d-i partman/confirm_write_changes_to_disks_and_configure_lvm boolean true

apt-mirror-setup        apt-setup/no_mirror     boolean true
apt-mirror-setup        apt-setup/use_mirror    boolean false
apt-mirror-setup        apt-setup/contrib       boolean false
apt-mirror-setup        apt-setup/non-free      boolean false
apt-cdrom-setup apt-setup/cdrom/set-next        boolean false
apt-setup-udeb  apt-setup/services-select       multiselect     

# Need If using iso
d-i apt-setup/use_mirror boolean false
d-i apt-setup/cdrom/set-first boolean false
d-i apt-setup/cdrom/set-next boolean false   
d-i apt-setup/cdrom/set-failed boolean false

d-i  mirror/country             string manual
d-i  mirror/http/hostname       string mirrors.aliyun.com
d-i  mirror/http/directory      string /debian
d-i  mirror/http/proxy          string
tasksel tasksel/first multiselect standard 

popularity-contest popularity-contest/participate boolean false

d-i  debian-installer/splash    boolean true
d-i  pkgsel/include string 
d-i  pkgsel/language-packs string 
d-i  pkgsel/install-language-support boolean false
d-i  pkgsel/update-policy        select unattended-upgrades
d-i  pkgsel/upgrade               select safe-upgrade

d-i  passwd/root-login                  boolean true
d-i  passwd/make-user                   boolean false
d-i  passwd/root-password               password 111111
d-i  passwd/root-password-again         password 111111
d-i  user-setup/allow-password-weak     boolean true

d-i  grub-installer/only_debian         boolean true
d-i  grub-installer/with_other_os       boolean true
d-i  grub-installer/bootdev             string /dev/sda
d-i  finish-install/keep-consoles       boolean false
d-i  finish-install/reboot_in_progress  note
d-i  cdrom-detect/eject                 boolean true
d-i  debian-installer/exit/halt         boolean false
d-i  debian-installer/exit/poweroff     boolean false


d-i cdrom-detect/eject boolean false
d-i preseed/early_command string anna-install some-udeb
d-i preseed/late_command string  \
cp -r /cdrom/tools/*  /target/opt/ ; \
cp  /cdrom/aaa/*  /target/etc/ 

3 制作开机自启脚本

#!/bin/sh
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
##判断是否有/aaa目录,
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值