atkisc 发表于 2012-09-10 09:48

通过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/mirrorselect cn.archive.ubuntu.com
    d-i mirror/http/proxy string
    d-i mirror/suite string precise
    d-i mirror/protocol selecthttp

    # 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启动实现自动安装了

星火2012 发表于 2012-09-10 10:59

支持共享。

chenhaimingwork 发表于 2012-09-26 11:35

atkisc 发表于 2012-09-10 09:48 static/image/common/back.gif
安装和配置cobbler、dhcp、tftp、dns的过程这里不做介绍,直接切入主题

1. 挂载Ubuntu镜像2. 导入镜像文 ...


hi, 你这个安装有测试成功吗 ???如果是debian 那又怎么弄呢 ??

atkisc 发表于 2012-09-27 19:25

回复 3# chenhaimingwork


    ubuntu下我是现做现写的,你们遇到什么问题说

webdna 发表于 2012-10-01 06:51

DEIAN可以吗?

webdna 发表于 2012-10-01 06:52

DEIAN可以吗?:-L:-L:-L:-L

atkisc 发表于 2012-10-01 10:47

webdna 发表于 2012-10-01 06:52 static/image/common/back.gif
DEIAN可以吗?

你可以试试

ubuntumsn 发表于 2012-11-29 15:40

回复 1# atkisc



想问下楼主这个 文件是怎么生成的有没有和centos 那样的工具来生成      有点不明白这个配置   


   

atkisc 发表于 2012-11-29 22:23

回复 8# ubuntumsn


    看官方,手写

ubuntumsn 发表于 2012-11-30 13:57

回复 9# atkisc



能给个官方的链接么,表示手写还是有压力哈,不是很懂这个文件


   
页: [1] 2
查看完整版本: 通过Cobbler实现自动化安装Ubuntu