如何在 Cobbler 上导入和启动 Ubuntu

Cobbler 在 CentOS/RHEL/Fedora 系的发行版上工作良好,在 CentOS/RHEL/Fedora 上安装 Cobbler 以后可以直接导入 CentOS/RHEL/Fedora ISO 文件,很顺利,不过导入 Ubuntu/Debian ISO 就不是那么幸运了,直接导入 ubuntu-11.10-server-amd64.iso 的话会报错:

# cobbler import –path=/mnt/ –name=ubuntu-11.10-server-amd64
...
sent 710595315 bytes  received 36388 bytes  52639385.41 bytes/sec
total size is 710349452  speedup is 1.00
...
!!! TASK FAILED !!!

忽略上面的错误,会发现在 ks_mirror 下面已经导入了 ubuntu-11.10-server-amd64 整个 ubuntu 目录:

# ls /var/www/cobbler/ks_mirror/
config  ubuntu-11.10-server-amd64

如果对上面已经导入的 ubuntu 目录还不放心的话,可以删除这个目录后手动导入(直接 cp 就行):

# rm -rf /var/www/cobbler/ks_mirror/ubuntu-11.10-server-amd64

# mount -o loop -t iso9660 ubuntu-11.10-server-amd64.iso /mnt

# cp -r /mnt/ /var/www/cobbler/ks_mirror/ubuntu-11.10-server-amd64

完成导入(拷贝)后,做个链接:

# cd /var/www/cobbler/links/
# ln -s /var/www/cobbler/ks_mirror/ubuntu-11.10-server-amd64 ubuntu-11.10-server-amd64

然后加入 distro 和 profile:

# cobbler distro add \
--name=ubuntu-11.10-server-amd64 \
--kernel=/var/www/cobbler/ks_mirror/ubuntu-11.10-server-amd64/install/netboot/ubuntu-installer/amd64/linux \
--initrd=/var/www/cobbler/ks_mirror/ubuntu-11.10-server-amd64/install/netboot/ubuntu-installer/amd64/initrd.gz \
--arch=x86_64 \
--breed=ubuntu \
--ksmeta="directory=/cblr/links/ubuntu-11.10-server-amd64"

# cobbler profile add \
--name=ubuntu-11.10-server-amd64 \
--distro=ubuntu-11.10-server-amd64 \
--kickstart=/var/lib/cobbler/kickstarts/ubuntu-11.10-server-amd64.seed

最后我们需要 ubuntu 能完成自动安装,加入以下 kickstart 脚本 ubuntu-11.10-server-amd64.seed 到 /var/lib/cobbler/kickstarts/ :

# vi /var/lib/cobbler/kickstarts/ubuntu-11.10-server-amd64.seed
d-i     debian-installer/locale string en_US.UTF-8
d-i     debian-installer/splash boolean false
d-i     console-setup/ask_detect        boolean false
d-i     console-setup/layoutcode        string us
d-i     console-setup/variantcode       string
d-i     netcfg/get_nameservers  string
d-i     netcfg/get_ipaddress    string
d-i     netcfg/get_netmask      string 255.255.255.0
d-i     netcfg/get_gateway      string
d-i     netcfg/confirm_static   boolean true
d-i     clock-setup/utc boolean true
d-i     partman-auto/method string regular
d-i     partman-lvm/device_remove_lvm boolean true
d-i     partman-lvm/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/confirm boolean true
d-i     partman/confirm_nooverwrite boolean true
d-i     partman/default_filesystem string ext3
d-i     clock-setup/utc boolean true
d-i     clock-setup/ntp boolean true
d-i     clock-setup/ntp-server  string ntp.ubuntu.com
d-i     base-installer/kernel/image     string linux-server
d-i     passwd/root-login       boolean false
d-i     passwd/make-user        boolean true
d-i     passwd/user-fullname    string ubuntu
d-i     passwd/username string ubuntu
d-i     passwd/user-password-crypted    password $default_password_crypted
d-i     passwd/user-uid string
d-i     user-setup/allow-password-weak  boolean false
d-i     user-setup/encrypt-home boolean false
d-i     passwd/user-default-groups      string adm cdrom dialout lpadmin plugdev sambashare
d-i     apt-setup/services-select       multiselect security
d-i     apt-setup/security_host string security.ubuntu.com
d-i     apt-setup/security_path string /ubuntu
d-i     debian-installer/allow_unauthenticated  string false
d-i     pkgsel/upgrade  select safe-upgrade
d-i     pkgsel/language-packs   multiselect
d-i     pkgsel/update-policy    select none
d-i     pkgsel/updatedb boolean true
d-i     grub-installer/skip     boolean false
d-i     lilo-installer/skip     boolean false
d-i     grub-installer/only_debian      boolean true
d-i     grub-installer/with_other_os    boolean true
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     pkgsel/include string openssh-server

评论 (2 Comments)

  1. @vpsee
    请问自动安装ubuntu/debian 都是用*.seed 文件吗 ?
    我弄了很久没有实现ubuntu/debian的自动安装,网上搜发现ubuntu 10 用的是centos的ks文件 。。。晕

    还有,你上面这个 ubuntu-11.10-server-amd64.seed 验证过能用吗 ?
    谢谢 ~

  2. @凯文
    可以用,不过不是全自动,安装的时候大概有3个地方需要手动干预。

发表评论