免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 12808 | 回复: 12
打印 上一主题 下一主题

[cobbler] 通过Cobbler实现自动化安装Ubuntu [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-09-10 09:48 |只看该作者 |倒序浏览
安装和配置cobbler、dhcp、tftp、dns的过程这里不做介绍,直接切入主题

1. 挂载Ubuntu镜像
  1. mount -t iso9660 -o loop ubuntu-12.04.1-server-amd64.iso  /mnt
复制代码
2. 导入镜像文件到distros
  1. cobbler import --name=Ubuntu-12.04.1 --arch=x86_64 --path=/mnt
复制代码
3. 在/var/lib/cobbler/kickstarts下新建名为autoinstall.seed的文件,内容如下
  1.     # Locale
  2.     d-i debconf/language string en
  3.     d-i debian-installer/locale string en_US
  4.     d-i debian-installer/language string en
  5.     d-i debian-installer/country string US
  6.     d-i localechooser/supported-locales en_US.UTF-8, zh_CN.UTF-8

  7.     # Keyboard
  8.     d-i console-setup/ask_detect boolean false
  9.     d-i keyboard-configuration/modelcode string pc105
  10.     d-i keyboard-configuration/layoutcode string us
  11.     d-i keyboard-configuration/variantcode string none
  12.     d-i console-keymaps-at/keymaps select us

  13.     # Network
  14.     d-i netcfg/enable boolean true
  15.     d-i netcfg/choose_interface select auto
  16.     d-i netcfg/disable_dhcp boolean false
  17.     d-i netcfg/dhcp_timeout string 5
  18.     d-i netcfg/disable_autoconfig boolean false
  19.     d-i netcfg/dhcp_failed note
  20.     # d-i netcfg/dhcp_options select Configure network manually
  21.     # d-i netcfg/dhcp_hostname string none
  22.     # d-i netcfg/get_nameservers string 8.8.8.8
  23.     # d-i netcfg/get_ipaddress string 192.168.1.10
  24.     # d-i netcfg/get_netmask string 255.255.255.0
  25.     # d-i netcfg/get_gateway string 192.168.1.1
  26.     # d-i netcfg/confirm_static boolean true
  27.     d-i netcfg/get_hostname string openstack
  28.     d-i netcfg/get_domain string none
  29.     d-i hw-detect/load_firmware boolean true

  30.     # Mirror
  31.     d-i mirror/country string enter information manually
  32.     d-i mirror/http/countries select enter information manually
  33.     d-i mirror/http/directory string /ubuntu
  34.     d-i mirror/http/hostname string cn.archive.ubuntu.com
  35.     d-i mirror/http/mirror  select cn.archive.ubuntu.com
  36.     d-i mirror/http/proxy string
  37.     d-i mirror/suite string precise
  38.     d-i mirror/protocol select  http

  39.     # Ntp
  40.     d-i clock-setup/utc boolean false
  41.     d-i time/zone string Asia/Shanghai
  42.     d-i clock-setup/ntp boolean false
  43.     d-i clock-setup/ntp-server string

  44.     # Partition
  45.     d-i partman-auto/init_automatically_partition select biggest_free
  46.     d-i partman-auto/disk string /dev/sda
  47.     d-i partman-auto/method string regular
  48.     d-i partman-lvm/device_remove_lvm boolean true
  49.     d-i partman-md/device_remove_md boolean true
  50.     d-i partman/default_filesystem string ext4
  51.     # d-i partman-lvm/confirm boolean true
  52.     # d-i partman-auto-lvm/guided_size string max/10GB/50%
  53.     # d-i partman-auto/choose_recipe select atomic/home/multi
  54.     # d-i partman-auto/expert_recipe_file string /dev/sdb

  55.     d-i partman-auto/choose_recipe select atomic
  56.     d-i partman-auto/expert_recipe string    \
  57.             -1 -1 -1 ext4                     \
  58.                   $primary{}                  \
  59.                   $bootable{}                 \
  60.                   method{ format }            \
  61.                   format{}                    \
  62.                   use_filesystem{}            \
  63.                   filesystem{ ext4 }          \
  64.                   mountpoint{ / }             \
  65.             .                                 \
  66.             200% 200% 200% linux-swap         \
  67.                   method{ swap }              \
  68.                   format{}

  69.     d-i partman-md/confirm boolean true
  70.     d-i partman-partitioning/confirm_write_new_label boolean true
  71.     d-i partman/choose_partition select finish
  72.     d-i partman/confirm boolean true
  73.     d-i partman/confirm_nooverwrite boolean true
  74.     d-i partman/mount_style select uuid

  75.     # Base System
  76.     d-i base-installer/install-recommends boolean false
  77.     d-i base-installer/kernel/linux/initramfs-generators string initramfs-tools
  78.     d-i base-installer/kernel/image string linux-server
  79.     base-config mirror/country string enter information manually
  80.     base-config mirror/http/countries select enter information manually
  81.     base-config mirror/http/directory string /ubuntu
  82.     base-config mirror/http/hostname string cn.archive.ubuntu.com
  83.     base-config mirror/http/mirror select cn.archive.ubuntu.com
  84.     base-config mirror/http/proxy string
  85.     base-config mirror/protocol select http
  86.     base-config apt-setup/country select enter information manually
  87.     base-config apt-setup/uri_type select http
  88.     base-config apt-setup/hostname string cn.archive.ubuntu.com
  89.     base-config apt-setup/directory string /ubuntu
  90.     base-config apt-setup/another boolean false
  91.     base-config apt-setup/non-free boolean true
  92.     base-config apt-setup/security-updates boolean true

  93.     # User
  94.     d-i passwd/root-login boolean true
  95.     # d-i passwd/root-password password 123456
  96.     # d-i passwd/root-password-again password 123456
  97.     # or encrypt
  98.     d-i passwd/root-password-crypted password $1$3nGno0$c4rp7NcQRAcJV3AdzKV890
  99.     d-i passwd/make-user boolean true
  100.     d-i passwd/user-fullname string openstack
  101.     d-i passwd/username string openstack
  102.     # d-i passwd/user-password password openstack
  103.     # d-i passwd/user-password-again password openstack
  104.     # or encrypt
  105.     d-i passwd/user-password-crypted password $1$G8Hno0$9Nbux3iss0n3bOLgp8aiU/
  106.     # d-i passwd/user-uid string 3000
  107.     # d-i passwd/user-default-groups string audio
  108.     d-i user-setup/allow-password-weak boolean true
  109.     d-i user-setup/encrypt-home boolean false

  110.     # Apt
  111.     # d-i apt-setup/non-free boolean true
  112.     # d-i apt-setup/contrib boolean true
  113.     # d-i apt-setup/restricted boolean true
  114.     # d-i apt-setup/universe boolean true
  115.     # d-i apt-setup/backports boolean true
  116.     # d-i apt-setup/use_mirror boolean false
  117.     # d-i apt-setup/services-select multiselect securtiy
  118.     # d-i apt-setup/security_host string security.ubuntu.com
  119.     # d-i apt-setup/security_path string /ubuntu
  120.     # d-i apt-setup/local0/repository string http://xxx stable main
  121.     # d-i apt-setup/local0/comment string local server
  122.     # d-i apt-setup/local0/source boolean false
  123.     # d-i apt-setup/local0/key string http://xxx/key
  124.     # d-i debian-installer/allow_unauthenticated boolean true

  125.     # Package
  126.     tasksel tasksel/first multiselect none
  127.     d-i pkgsel/include string openssh-server build-essential
  128.     d-i pkgsel/upgrade select full-upgrade
  129.     d-i pkgsel/install-language-support boolean true
  130.     d-i pkgsel/language-packs multiselect en, zh
  131.     d-i pkgsel/update-policy select none
  132.     # popularity-contest popularity-contest/participate boolean false
  133.     d-i pkgsel/updatedb boolean true

  134.     # Grub
  135.     d-i grub-installer/skip boolean false
  136.     d-i lilo-installer/skip boolean true
  137.     d-i grub-installer/grub2_instead_of_grup_legacy boolean true
  138.     d-i grub-installer/only_debian boolean true
  139.     d-i grub-installer/with_other_os boolean true
  140.     # d-i grub-installer/bootdev string (hd0,0) (hd1,0)
  141.     # d-i grub-installer/password password 123456
  142.     # d-i grub-installer/password-again password 123456
  143.     # or encrypt
  144.     # d-i grub-installer/password-crypted password $1$2.Qno0$6cITxF0YWtc/z5fQ05dPn.
  145.     # d-i debian-installer/add-kernel-opts string nousb

  146.     # Finish
  147.     d-i finish-install/keep-consoles boolean true
  148.     d-i finish-install/reboot_in_progress note
  149.     d-i cdrom-detect/eject boolean true
  150.     d-i debian-installer/exit/halt boolean false
  151.     d-i debian-installer/exit/poweroff boolean false
复制代码
4. 修正引导内核和系统版本信息
  1. 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=precise
复制代码
5. 设置Ubuntu自动安装脚本和光盘引导参数
  1. cobbler profile edit --name=Ubuntu-12.04.1-x86_64 --kopts="auto=true netcfg/choose_interface=auto" --kickstart=/var/lib/cobbler/kickstarts/autoinstall.seed
复制代码
6. 建立镜像链接
  1. ln -sv /var/www/cobbler/ks_mirror/Ubuntu-12.04.1-x86_64/ /var/www/cobbler/links/
复制代码
7. 同步cobbler配置
  1. cobbler sync
复制代码
接下来就可以在需要安装Ubuntu的服务器通过pxe启动实现自动安装了

论坛徽章:
0
2 [报告]
发表于 2012-09-10 10:59 |只看该作者
支持共享。

论坛徽章:
0
3 [报告]
发表于 2012-09-26 11:35 |只看该作者
atkisc 发表于 2012-09-10 09:48
安装和配置cobbler、dhcp、tftp、dns的过程这里不做介绍,直接切入主题

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



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

论坛徽章:
0
4 [报告]
发表于 2012-09-27 19:25 |只看该作者
回复 3# chenhaimingwork


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

论坛徽章:
1
处女座
日期:2014-01-21 13:20:51
5 [报告]
发表于 2012-10-01 06:51 |只看该作者
DEIAN可以吗?

论坛徽章:
1
处女座
日期:2014-01-21 13:20:51
6 [报告]
发表于 2012-10-01 06:52 |只看该作者
DEIAN可以吗?

论坛徽章:
0
7 [报告]
发表于 2012-10-01 10:47 |只看该作者
webdna 发表于 2012-10-01 06:52
DEIAN可以吗?


你可以试试

论坛徽章:
0
8 [报告]
发表于 2012-11-29 15:40 |只看该作者
回复 1# atkisc



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


   

论坛徽章:
0
9 [报告]
发表于 2012-11-29 22:23 |只看该作者
回复 8# ubuntumsn


    看官方,手写

论坛徽章:
0
10 [报告]
发表于 2012-11-30 13:57 |只看该作者
回复 9# atkisc



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


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP