通過Cobbler實現自動化安裝Ubuntu

←手機掃碼閱讀     火星人 @ 2014-03-03 , reply:0

通過Cobbler實現自動化安裝Ubuntu

安裝和配置cobbler、dhcp、tftp、dns的過程這裡不做介紹,直接切入主題

1. 掛載Ubuntu鏡像mount -t iso9660 -o loop ubuntu-12.04.1-server-amd64.iso  /mnt2. 導入鏡像文件到distroscobbler import --name=Ubuntu-12.04.1 --arch=x86_64 --path=/mnt3. 在/var/lib/cobbler/kickstarts下新建名為autoinstall.seed的文件,內容如下    # Locale
    d-i debconf/language string en
    d-i debian-installer/locale string en_US
    d-i debian-installer/language string en
    d-i debian-installer/country string US
    d-i localechooser/supported-locales en_US.UTF-8, zh_CN.UTF-8

    # Keyboard
    d-i console-setup/ask_detect boolean false
    d-i keyboard-configuration/modelcode string pc105
    d-i keyboard-configuration/layoutcode string us
    d-i keyboard-configuration/variantcode string none
    d-i console-keymaps-at/keymaps select us

    # Network
    d-i netcfg/enable boolean true
    d-i netcfg/choose_interface select auto
    d-i netcfg/disable_dhcp boolean false
    d-i netcfg/dhcp_timeout string 5
    d-i netcfg/disable_autoconfig boolean false
    d-i netcfg/dhcp_failed note
    # d-i netcfg/dhcp_options select Configure network manually
    # d-i netcfg/dhcp_hostname string none
    # d-i netcfg/get_nameservers string 8.8.8.8
    # d-i netcfg/get_ipaddress string 192.168.1.10
    # 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
    d-i netcfg/get_hostname string openstack
    d-i netcfg/get_domain string none
    d-i hw-detect/load_firmware boolean true

    # Mirror
    d-i mirror/country string enter information manually
    d-i mirror/http/countries select enter information manually
    d-i mirror/http/directory string /ubuntu
    d-i mirror/http/hostname string cn.archive.ubuntu.com
    d-i mirror/http/mirror  select cn.archive.ubuntu.com
    d-i mirror/http/proxy string
    d-i mirror/suite string precise
    d-i mirror/protocol select  http

    # Ntp
    d-i clock-setup/utc boolean false
    d-i time/zone string Asia/Shanghai
    d-i clock-setup/ntp boolean false
    d-i clock-setup/ntp-server string

    # Partition
    d-i partman-auto/init_automatically_partition select biggest_free
    d-i partman-auto/disk string /dev/sda
    d-i partman-auto/method string regular
    d-i partman-lvm/device_remove_lvm boolean true
    d-i partman-md/device_remove_md boolean true
    d-i partman/default_filesystem string ext4
    # d-i partman-lvm/confirm boolean true
    # d-i partman-auto-lvm/guided_size string max/10GB/50%
    # d-i partman-auto/choose_recipe select atomic/home/multi
    # d-i partman-auto/expert_recipe_file string /dev/sdb

    d-i partman-auto/choose_recipe select atomic
    d-i partman-auto/expert_recipe string    \
            -1 -1 -1 ext4                     \
                  $primary{}                  \
                  $bootable{}                 \
                  method{ format }            \
                  format{}                    \
                  use_filesystem{}            \
                  filesystem{ ext4 }          \
                  mountpoint{ / }             \
            .                                 \
            200% 200% 200% linux-swap         \
                  method{ swap }              \
                  format{}

    d-i partman-md/confirm boolean true
    d-i partman-partitioning/confirm_write_new_label boolean true
    d-i partman/choose_partition select finish
    d-i partman/confirm boolean true
    d-i partman/confirm_nooverwrite boolean true
    d-i partman/mount_style select uuid

    # Base System
    d-i base-installer/install-recommends boolean false
    d-i base-installer/kernel/linux/initramfs-generators string initramfs-tools
    d-i base-installer/kernel/image string linux-server
    base-config mirror/country string enter information manually
    base-config mirror/http/countries select enter information manually
    base-config mirror/http/directory string /ubuntu
    base-config mirror/http/hostname string cn.archive.ubuntu.com
    base-config mirror/http/mirror select cn.archive.ubuntu.com
    base-config mirror/http/proxy string
    base-config mirror/protocol select http
    base-config apt-setup/country select enter information manually
    base-config apt-setup/uri_type select http
    base-config apt-setup/hostname string cn.archive.ubuntu.com
    base-config apt-setup/directory string /ubuntu
    base-config apt-setup/another boolean false
    base-config apt-setup/non-free boolean true
    base-config apt-setup/security-updates boolean true

    # User
    d-i passwd/root-login boolean true
    # d-i passwd/root-password password 123456
    # d-i passwd/root-password-again password 123456
    # or encrypt
    d-i passwd/root-password-crypted password $1$3nGno0$c4rp7NcQRAcJV3AdzKV890
    d-i passwd/make-user boolean true
    d-i passwd/user-fullname string openstack
    d-i passwd/username string openstack
    # d-i passwd/user-password password openstack
    # d-i passwd/user-password-again password openstack
    # or encrypt
    d-i passwd/user-password-crypted password $1$G8Hno0$9Nbux3iss0n3bOLgp8aiU/
    # d-i passwd/user-uid string 3000
    # d-i passwd/user-default-groups string audio
    d-i user-setup/allow-password-weak boolean true
    d-i user-setup/encrypt-home boolean false

    # Apt
    # d-i apt-setup/non-free boolean true
    # d-i apt-setup/contrib boolean true
    # d-i apt-setup/restricted boolean true
    # d-i apt-setup/universe boolean true
    # d-i apt-setup/backports boolean true
    # d-i apt-setup/use_mirror boolean false
    # d-i apt-setup/services-select multiselect securtiy
    # d-i apt-setup/security_host string security.ubuntu.com
    # d-i apt-setup/security_path string /ubuntu
    # d-i apt-setup/local0/repository string http://xxx stable main
    # d-i apt-setup/local0/comment string local server
    # d-i apt-setup/local0/source boolean false
    # d-i apt-setup/local0/key string http://xxx/key
    # d-i debian-installer/allow_unauthenticated boolean true

    # Package
    tasksel tasksel/first multiselect none
    d-i pkgsel/include string openssh-server build-essential
    d-i pkgsel/upgrade select full-upgrade
    d-i pkgsel/install-language-support boolean true
    d-i pkgsel/language-packs multiselect en, zh
    d-i pkgsel/update-policy select none
    # popularity-contest popularity-contest/participate boolean false
    d-i pkgsel/updatedb boolean true

    # Grub
    d-i grub-installer/skip boolean false
    d-i lilo-installer/skip boolean true
    d-i grub-installer/grub2_instead_of_grup_legacy 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 (hd0,0) (hd1,0)
    # d-i grub-installer/password password 123456
    # d-i grub-installer/password-again password 123456
    # or encrypt
    # d-i grub-installer/password-crypted password $1$2.Qno0$6cITxF0YWtc/z5fQ05dPn.
    # d-i debian-installer/add-kernel-opts string nousb

    # Finish
    d-i finish-install/keep-consoles boolean true
    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 false4. 修正引導內核和系統版本信息cobbler distro edit --name=Ubuntu-12.04.1-x86_64 --kernel=/var/www/cobbler/ks_mirror/Ubuntu-12.04.1-x86_64/install/netboot/ubuntu-installer/amd64/linux --initrd=/var/www/cobbler/ks_mirror/Ubuntu-12.04.1-x86_64/install/netboot/ubuntu-installer/amd64/initrd.gz --os-version=precise5. 設置Ubuntu自動安裝腳本和光碟引導參數cobbler profile edit --name=Ubuntu-12.04.1-x86_64 --kopts="auto=true netcfg/choose_interface=auto" --kickstart=/var/lib/cobbler/kickstarts/autoinstall.seed6. 建立鏡像鏈接ln -sv /var/www/cobbler/ks_mirror/Ubuntu-12.04.1-x86_64/ /var/www/cobbler/links/7. 同步cobbler配置cobbler sync接下來就可以在需要安裝Ubuntu的伺服器通過pxe啟動實現自動安裝了
《解決方案》

支持共享。
《解決方案》

atkisc 發表於 2012-09-10 09:48 static/image/common/back.gif
安裝和配置cobbler、dhcp、tftp、dns的過程這裡不做介紹,直接切入主題

1. 掛載Ubuntu鏡像2. 導入鏡像文 ...


hi  , 你這個安裝有測試成功嗎 ???  如果是debian 那又怎麼弄呢 ??
《解決方案》

回復 3# chenhaimingwork


    ubuntu下我是現做現寫的,你們遇到什麼問題說
《解決方案》

DEIAN可以嗎?
《解決方案》

DEIAN可以嗎?:-L:-L:-L:-L
《解決方案》

webdna 發表於 2012-10-01 06:52 static/image/common/back.gif
DEIAN可以嗎?

你可以試試
《解決方案》

回復 1# atkisc



想問下樓主這個 文件是怎麼生成的  有沒有和centos 那樣的工具來生成        有點不明白這個配置     


   
《解決方案》

回復 8# ubuntumsn


    看官方,手寫
《解決方案》

回復 9# atkisc



能給個官方的鏈接么,表示手寫還是有壓力哈,不是很懂這個文件


   




[火星人 ] 通過Cobbler實現自動化安裝Ubuntu已經有899次圍觀

http://coctec.com/docs/service/show-post-485.html