cobbler部署

1.cobbler介绍

Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便(才15k行python代码),使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP、DNS、TFTP、RSYNC以及yum仓库、构造系统ISO镜像。Cobbler支持命令行管理,web界面管理,还提供了API接口,可以方便二次开发使用。Cobbler客户端Koan支持虚拟机安装和操作系统重新安装,使重装系统更便捷。

  Cobbler功能

     使用Cobbler,可以做到无需进行人工干预即可安装机器;Cobbler设置一个PXE引导环境(它还可使用yaboot支持PowerPC),并控制与安装相关的所有方面,比如网络引导服务     (DHCP和TFTP)与存储库镜像。当希望安装一台新机器时,Cobbler可以:使用一个以前定义的模板来配置DHCP服务(如果启用了管理 DHCP)将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统在DHCP配置文件中为需要安装的机器创建一个条目,并使用您指定的参数(IP和MAC地址);在TFTFP服务目录下创建适当的PXE文件;重新启动DHCP服务以反映更改;重新启动机器以开始安装(如果电源管理已启用)。

2.cobbler部署

系统环境

[root@cobbler-server ~]# cat /etc/redhat-release       #系统版本
CentOSLinux release 7.1.(Core)
[root@cobbler-server ~]# uname –r #内核版本
3.10.-.el7.x86_64
[root@cobbler-server ~]# getenforce #检测selinux是否关闭(必须关闭)
Disabled
[root@cobbler-server ~]# systemctl stop firewalld #关闭防火墙
[root@cobbler-server ~]# ifconfig eth0|awk -F '[ :]+''NR==2 {print $3}' #查看IP地址
10.0.0.101
[root@cobbler-server ~]# hostname #查看主机名
cobbler-server
[root@cobbler-server ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo #cobbler安装必须使用到epel源

安装软件

[root@cobbler-server ~]# yum install cobbler cobbler-web pykickstart httpd dhcp tftp xinetd

配置文件

cobbler        #cobbler程序包
cobbler-web #cobbler的web服务包
pykickstart #cobbler检查kickstart语法错误
httpd #Apache web服务
dhcp #Dhcp服务
tftp #tftp服务
/etc/cobbler #配置文件目录
/etc/cobbler/settings #cobbler主配置文件
/etc/cobbler/dhcp.template #DHCP服务的配置模板
/etc/cobbler/tftpd.template #tftp服务的配置模板
/etc/cobbler/rsync.template #rsync服务的配置模板
/etc/cobbler/iso #iso模板配置文件目录
/etc/cobbler/pxe #pxe模板文件目录
/etc/cobbler/power #电源的配置文件目录
/etc/cobbler/users.conf #web服务授权配置文件
/etc/cobbler/users.digest #web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template #DNS服务的配置模板
/etc/cobbler/modules.conf #Cobbler模块配置文件
/var/lib/cobbler #Cobbler数据目录
/var/lib/cobbler/config #配置文件
/var/lib/cobbler/kickstarts #默认存放kickstart文件
/var/lib/cobbler/loaders #存放的各种引导程序
/var/www/cobbler #系统安装镜像目录
/var/www/cobbler/ks_mirror #导入的系统镜像列表
/var/www/cobbler/images #导入的系统镜像启动文件
/var/www/cobbler/repo_mirror #yum源存储目录
/var/log/cobbler #日志目录
/var/log/cobbler/install.log #客户端系统安装日志
/var/log/cobbler/cobbler.log #cobbler日志

Cobbler的检测
     
cobbler的运行依赖于dhcp、tftp、rsync及dns服务,其中dhcp可由dhcpd(isc)提供,也可由dnsmasq提供;tftp可由tftp-server程序包提供,也可由cobbler功能提供,rsync有rsync程序包提供,dns可由bind提供,也可由dnsmasq提供cobbler可自行管理这些服务中的部分甚至是全部,但需要配置文件/etc/cobbler/settings中的“manange_dhcp”、“manager_tftpd”、“manager_rsync”、“manager_dns”分别来进行定义,另外,由于各种服务都有着不同的实现方式,如若需要进行自定义,需要通过修改/etc/cobbler/modules.conf配置文件中各服务的模块参数的值来实现。

 #启动apache服务

[root@cobbler-server ~]# systemctl start httpd    

  #启动cobbler程序

[root@cobbler-server ~]# systemctl start cobblerd   

查看检查

[root@cobbler-server ~]# cobbler check       #检查存在的问题,逐一解决     

1)指定cobbler服务主机ip

[root@cobbler-server ~]# sed -i 's/server: 127.0.0.1/server: 10.0.0.101/'/etc/cobbler/settings

2)提供PXE服务的主机ip

[root@cobbler-server ~]# sed -i 's/next_server: 127.0.0.1/next_server: 10.0.0.101/'/etc/cobbler/settings

3)启用tftp服务

[root@cobbler-server]#cat /etc/xinetd.d/tftp | grep disable
disable = no

4)更新引导程序,如果不能下载可以在复制/usr/share/syslinux/{pxelinux.0,memu.c32}到/var/lib/cobbler/loaders/

[root@cobbler-server ~]# cobbler get-loaders     下载引导程序

5)执行 systemctl enable rsyncd命令即可;

[root@cobbler-server ~]# openssl passwd - -salt '$(openssl rand -hex 4)''cobbler'
$$$(openss$.wbDUBV/STL0YaNuAcusK/
[root@cobbler-server~]# grep "default_password_crypted"/etc/cobbler/settings   #替换/etc/cobbler/setting内的default_password_crypted为上个命令结果
default_password_crypted:"$1$$(openss$.wbDUBV/STL0YaNuAcusK/"
[root@cobbler-server~]# yum –y install cman fence-agents

最后重启Cobbler:

[root@cobbler-server~]# systemctl restart cobblerd

配置dhcp

[root@cobbler-server~]# sed -i 's#manage_dhcp: 0#manage_dhcp: 1#g'/etc/cobbler/settings              #使用cobbler管理dhcp
[root@cobbler-server~]# vim /etc/cobbler/dhcp.template #修改cobbler的dhcp模版,因为cobbler会替换。
subnet 10.0.0.0 netmask 255.255.255.0{
option routers 10.0.0.2;
option domain-name-servers 10.0.0.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.0.0.20010.0.0.;
default-lease-time ;
max-lease-time ;
next-server $next_server;

同步cobbler

[root@cobbler-server~]# systemctl restart xinetd     #重启xinetd
[root@cobbler-server~]# systemctl restart cobblerd #重启cobbler
[root@cobbler-server~]# cobbler sync #同步最新cobbler配置,可以看具体做了哪些操作

3.管理cobbler服务

  1)上传系统镜像

[root@cobbler-server ~]# mkdir /home/CentOS
[root@cobbler-server ~]# mount /home/src/CentOS-6.7-i386-bin-DVD.iso /home/CentOS/ -o loop
[root@cobbler-server ~]# cobbler import --mirror=/home/CentOS --name=CentOS-6.7
[root@cobbler-server ~]# cobbler sync 应用配置模板 [root@cobbler-server ~]#cobbler import --path=/mnt/ --name=ubuntu-14.04.5

2)添加kickstart文件指定到系统列表

[root@cobbler-server ~]#cobbler profile edit --name=CentOS-6.7.-x86_64-distro --kickstart=/var/lib/cobbler/kickstarts/Cobbler-CentOS-6.7-x86_64.cfg #指定ks路径
[root@cobbler-server ~]#cobbler profile edit --name=CentOS-6.7.1-x86_64-distro --kickstart=/var/lib/cobbler/kickstarts/ubuntu.14.04.5.seed

3)添加system

[root@cobbler kickstarts]#cobbler system add --name=vm01 --hostname=vm01 --mac=00:19:B9:E5:34:FE --interface=eth0 --ip-address=172.16.68.102 --subnet=255.255.255.0 --gateway=172.16.68.1 --static=1 --profile=centos5.8-x86_64

4)yum镜像

[root@cobbler kickstarts]#cobbler repo edit --name=centos5.-x86_64-base --mirror=http://mirrors.163.com/centos/5/os/x86_64/ --arch=x86_64 --breed=yum
[root@cobbler ~]# ln s /var/lib/cobbler/kickstarts/centos6.-ks.cfg /var/www/cobbler/pub/

指定无人看守安装

[root@cobbler ~]# cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu
PROMPT
MENU TITLE Cobbler | http://cobbler.github.io
TIMEOUT
TOTALTIMEOUT
ONTIMEOUT local LABEL local
MENU LABEL (local)
MENU DEFAULT
LOCALBOOT - LABEL CentOS_6.-x86_64
kernel /images/CentOS_6.-x86_64/vmlinuz
MENU LABEL CentOS_6.-x86_64
append initrd=/images/CentOS_6.-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.16.68.61/cobbler/pub/centos6.5-ks.cfg
ipappend MENU end ks文件
[root@cobbler kickstarts]# cat  CentOS_6..ks
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
url --url=$tree
# Root password
rootpw --iscrypted $$78888O7t$XAdzFmSUXy7Ysqayh7IU/
# System authorization information
auth --useshadow --passalgo=sha512
# Use graphical install
graphical
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
network --bootproto=dhcp --device=eth1 --onboot=on
# System timezone
timezone Africa/Abidjan
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
ignoredisk --only-use=sda
# Disk partitioning information
part / --asprimary --fstype="ext4" --grow --size=
part /boot --asprimary --fstype="ext4" --size=
part swap --asprimary --fstype="swap" --size= %packages --ignoremissing
@additional-devel
@chinese-support
@development
@server-platform-devel %end
%post --interpreter=/bin/bash --nochroot
#sed -i s/ONBOOT=no/ONBOOT=yes/ /etc/sysconfig/network-scripts/ifcfg-eth0
#service network restart | /bin/bash
#dhclient -d | /bin/bash
echo "install centos 6.5" > /root/install.txt
%end
ubuntu.seed 
 [root@cobbler kickstarts]# cat  ubuntu.14.04..seed
# Mostly based on the Ubuntu installation guide
# https://help.ubuntu.com/12.04/installation-guide/ # Preseeding only locale sets language, country and locale.
d-i debian-installer/locale string en_US # Keyboard selection.
# Disable automatic (interactive) keymap detection.
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string us
d-i keyboard-configuration/variantcode string # netcfg will choose an interface that has link if possible. This makes it
# skip displaying a list if there is more than one interface. d-i netcfg/enable boolean false
d-i netcfg/choose_interface select auto
#d-i netcfg/disable_dhcp boolean false
#d-i netcfg/dhcp_timeout string
d-i netcfg/disable_autoconfig boolean true
d-i netcfg/dhcp_failed note
d-i netcfg/dhcp_options select Do not configure the network at this time
#set $myhostname = $getVar('hostname',$getVar('name','cobbler')).replace("_","-")
d-i netcfg/get_hostname string $myhostname
# If you have a slow dhcp server and the installer times out waiting for
# it, this might be useful
#d-i netcfg/dhcp_timeout string #d-inetcfg/dhcp_failed note
#d-inetcfg/dhcp_options select Configure network manually # If non-free firmware is needed for the network or other hardware, you can
# configure the installer to always try to load it, without prompting. Or
# change to false to disable asking.
#d-i hw-detect/load_firmware boolean true # NTP/Time Setup
d-i time/zone string Asia/Shanghai
d-i clock-setup/utc boolean true
d-i clock-setup/ntp boolean true
d-i clock-setup/ntp-server string ntp.ubuntu.com # Setup the installation source
d-i mirror/country string manual
d-i mirror/http/hostname string $http_server
d-i mirror/http/directory string $install_source_directory
d-i mirror/http/proxy string #set $os_v = $getVar('os_version','')
#if $os_v and $os_v.lower()[0] > 'p'
# Required at least for 12.10+
d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
#end if # Suite to install.
# d-i mirror/suite string precise
# d-i mirror/udeb/suite string precise # Components to use for loading installer components (optional).
#d-i mirror/udeb/components multiselect main, restricted # Disk Partitioning
# Use LVM, and wipe out anything that already exists
#d-i partman/choose_partition select finish
#d-i partman/confirm boolean true
#d-i partman/confirm_nooverwrite boolean true
#d-i partman-auto/method string lvm
#d-i partman-lvm/device_remove_lvm boolean true
#d-i partman-lvm/confirm boolean true
#d-i partman-lvm/confirm_nooverwrite boolean true
#d-i partman-md/device_remove_md boolean true
#d-i partman-partitioning/confirm_write_new_label boolean true 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-lvm/confirm boolean true
d-i partman-auto/expert_recipe string \
boot-root :: \
ext4 \
$primary{ } \
$bootable{ } \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ / } \
. \
linux-swap \
method{ swap } \
format{ } \
. \
max ext4 \
method{ format } \
format{ } \
use_filesystem{ } \
filesystem{ ext4 } \
mountpoint{ /opt } \
. \
d-i partman/default_filesystem string ext4 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 # You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
#d-i partman-auto/choose_recipe select # If you just want to change the default filesystem from ext3 to something
# else, you can do that without providing a full recipe.
# d-i partman/default_filesystem string ext4 # root account and password
d-i passwd/root-login boolean true
d-i passwd/root-password-crypted password $$78888O7t$XAdzFmSUXy7Ysqayh7IU/ # skip creation of a normal user account.
d-i passwd/make-user boolean false # You can choose to install restricted and universe software, or to install
# software from the backports repository.
# d-i apt-setup/restricted boolean true
# d-i apt-setup/universe boolean true
# d-i apt-setup/backports boolean true # Uncomment this if you don't want to use a network mirror.
# d-i apt-setup/use_mirror boolean false # Select which update services to use; define the mirrors to be used.
# Values shown below are the normal defaults.
# 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 $SNIPPET('preseed_apt_repo_config') # Enable deb-src lines
# d-i apt-setup/local0/source boolean true # URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
# d-i apt-setup/local0/key string http://local.server/key # By default the installer requires that repositories be authenticated
# using a known gpg key. This setting can be used to disable that
# authentication. Warning: Insecure, not recommended.
# d-i debian-installer/allow_unauthenticated boolean true # Individual additional packages to install
# wget is REQUIRED otherwise quite a few things won't work
# later in the build (like late-command scripts)
d-i pkgsel/include string ntp ssh wget # Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
d-i debian-installer/add-kernel-opts string $kernel_options_post # Avoid that last message about the install being complete.
d-i finish-install/reboot_in_progress note ## Figure out if we're kickstarting a system or a profile
#if $getVar('system_name','') != ''
#set $what = "system"
#else
#set $what = "profile"
#end if # This first command is run as early as possible, just after preseeding is read.
# d-i preseed/early_command string [command]
d-i preseed/early_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
/bin/sh -s # This command is run immediately before the partitioner starts. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
# d-i partman/early_command \
# string debconf-set partman-auto/disk "\$(list-devices disk | head -n1)" # This command is run just before the install finishes, but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
# d-i preseed/late_command string [command]
d-i preseed/late_command string wget -O- \
http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
chroot /target /bin/sh -s

ubuntu有多网卡时需要设置profile

[root@cobbler kickstarts]#cobbler profile edit --name=ubuntu-14.04.5-x86_64 --kopts="auto=true netcfg/choose_interface=auto"

ubuntu.seed模板
 #url:主要参考
# : https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallPreseed
# :https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallScripts
# :https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
# :https://wiki.ubuntu.com/QATeam/AutomatedTesting/
# :https://www.debian.org/releases/wheezy/example-preseed.txt
# :https://help.ubuntu.com/14.04/installation-guide/i386/apb.html
# :http://www.startos.com/zhuanti/zt02/2010/1111/9391.html
# :https://help.ubuntu.com/lts/installation-guide/i386/ch04s06.html#preseed(然后它)
# :https://www.debian.org/releases/stable/i386/ch06s03.html.zh-cn(第一重要,有助于理解整个流程)
preseed主要包括以下内容
、本地化
、网络设置
、镜像设置
、账号设置
、时钟与时区设置
、分区
、基本系统安装
、设置apt
、选择软件包
、安装bootloader
、完成安装
、预置其他的软件包
#书写perseed时需要注意的点
#preconfiguration 文件格式如下
#<owner> <question name> <question type> <value>
#确保type与value之间只有一个空格符或者tab
#多行的话最好是在question name后添加\,而不应该在type与value之间
#对于debconf 变量,owner前需要加d-i
#其二,可以通过debconf-utils软件包里面的debconf-get-selections导出debconf数据库和安装程序的cdebconf数据库到另一文件
#debconf-get-selections --installer > file
#debconf-get-selections >> file
#本地化 设置 language country and locale
#如果预置locale为en_NL在安装后系统默认的locale将是en_US.UTF-,如果想要使用en_GB.UTF-,该值需要分别进行预置
#d-i debian-installer/language srtring en
#d-i debian-installer/country string CH
d-i debain-install/locale string zh_CN.UTF-
#键盘配置,安装时只提供基本keymap,高级的需要在安装好的系统下才能使用,使用dpkg-reconfigure keyboard-configuration配置
d-i keyboard-configuration/xkb-keymap select us
#d-i keyboard-configuration/toggle select No toggling
#网络设置
#如果需要禁用网络,则如下
#d-i netcfg/enable boolean false
#若网络可用,则netcfg将选择一网口,如果需要跳过显示选择网卡列表,则设置自动选择
#d-i netcfg/choose_interface select auto
#如果想直接指定某一网口,则设置如下
#d-i netcfg/choose_interface select eth0
#设置链接网口的检测时间,默认时间时3秒
#d-i netcfg/link_wait_timeout string
#如果DHCP服务器延迟较高,可以将安装过程中DHCP设置时延变长
#d-i netcfg/dhcp_timeout string
#如果需要手动配置网络,则如下配置
#d-i netcfg/disable_autoconfig boolean true
#d-i netcfg/dhcp_failed note
#d-i netcfg/dhcp_options select Configure network manually
#d-i netcfg/get_nameservers string 192.168.1.1
#d-i netcfg/get_ipaddress string 192.168.1.42
#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
#设置hostname以及domain避免问答
#d-i netcfg/get_hostname string unassigned-hostname
#d-i netcfg/get_domain string unassigned-domain
#手动预置hostname
#d-i netcfg/hostname string abc
#non-free需要网络,可以配置其直接连接网络而无需询问
#d-i hw-detect/load_firmware boolean true
#需要注意的是,如果netcfg/get_netmask没有预置,netcfg将自动侦测掩码,这种情况下,为了自动安装,变量需要标记为seen,
#同样,如果netcfg/get_gateway没有设置,netcfg将自动选择一个合适的地址。特殊情况下,可以设置netcfg/get_gateway
#为none确定不使用网关
#网络控制台
#如果需要通过SSH进行远程安装,就需要确保网络console
#d-i anna/choose_modules string network-console
#d-i network-console/authorized_keys_url string http://10.133.5.100/ubuntu/openssh-key
#d-i network-console/password password r00tme
#d-i network-console/password-again password r00tme
#镜像设置
#镜像可用于下载安装程序的额外组件、安装基本系统以及所安装的系统建立/etc/apt/source.list
#参数mirror/suite决定了安装号的系统使用的套件。
#参数mirror/udev/suite决定安装程序使用的额外组件的套件。它只在组件通过网络下载病与安装时使用的initrd建立套件相匹配时才有效。
#通常安装程序会自动安装病使用正确的值,而无需手动设置
#如果选择FTP,则mirror/country无需设置
#d-i mirror/protocol string ftp 如果不指出所用协议,则默认为http
d-i mirror/country string manual
d-i mirror/http/hostname string http.us.debian.org
d-i mirror/http/directory string /debian
d-i mirror/http/proxy string
#安装套件
#d-i mirror/suite string testing
#d-i mirror/udev/suite string testing
#账号设置
#root账号的密码和普通用户的用户名和密码都可以预置。可以使用纯文本或者MD5
#如果需要跳过root用户的创建则
#d-i passwd/root-login boolean false
#同样也可以跳过创建普通用户
#d-i passwd/make-user boolean false
#设置root密码,负责为空
#d-i passwd/root-password password 123456st
#d-i passwd/root-password-again password 123456st
#同样可以用加密的MD5哈希
#d-i passwd/root-password-crtpted password [MD5 hash]
#创建普通账户
#d-i passwd/user-fullname string Debian User
#d-i passwd/username string debian
# 普通用户密码
#d-i passwd/user-password password insecure
#d-i passwd/user-password-again password insecure
# 或者用MD5
#d-i passwd/user-password-crypted password [MD5 hash]
# 为第一个用户以指定UID进行创建
#d-i passwd/user-uid string
# 将第一用户加入某一group
#d-i passwd/user-default-groups string audio cdrom video
passwd/root-password-crypted 和 passwd/user-password-crypted 值可以使用 “!” 作为他们的预置值。这种情况下,对应的帐号关闭。
它常用于 root 帐号,用其他替代方法允许管理或 root 登录(例如使用 SSH key 认证或 sudo).
下面的命令可用于生成密码的 MD5 值。
mkpasswd -m sha-
#时钟与时区设置
#设置硬件时钟是否为UTC
d-i clock-setup/utc boolean true
#设置为某一时区
# 可以参照/usr/share/zoneinfo里面的值
d-i time/zone string Asia/Shanghai
#设置在安装过程中是否以NTP为时间基准
d-i clock-setup/ntp boolean true
# 使用的NTP服务器
#d-i clock-setup/ntp-server string xxx
#分区设置
分区可以参考一下以下资料
#http://www.cnblogs.com/silenceli/p/3472222.html
#https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallPreseed
#使用预置进行硬盘分区受限于 partman-auto 提供的支持。您可以选择使用磁盘上已有的空闲分区或者整个磁盘。磁盘的布局将取决于所使用的预定义方案,用户自定义的方案文件或预置文件包含的方案。
#已经支持包括 RAID、LVM 和加密高级分区设置的预置,但对于非预置安装的分区仍然弹性不足。
#下面的例子仅提供了使用方案的最基本信息。详细的内容清参考文件 partman-auto-recipe.txt 和 partman-auto-raid-recipe.txt,它们含在 debian-installer 软件包里。这两个文件也可以从 debian-installer source repository##获取。注意不同发布版支持的功能会有所改变。
#http://anonscm.debian.org/gitweb/?p=d-i/debian-installer.git;a=tree;f=doc/devel
# If the system has free space you can choose to only partition that space.
# This is only honoured if partman-auto/method (below) is not set.
#d-i partman-auto/init_automatically_partition select biggest_free
# Alternatively, you may specify a disk to partition. If the system has only
# one disk the installer will default to using that, but otherwise the device
# name must be given in traditional, non-devfs format (so e.g. /dev/hda or
# /dev/sda, and not e.g. /dev/discs/disc0/disc).
# For example, to use the first SCSI/SATA hard disk:
#d-i partman-auto/disk string /dev/sda
# In addition, you'll need to specify the method to use.
# The presently available methods are:
# - regular: use the usual partition types for your architecture
# - lvm: use LVM to partition the disk
# - crypto: use LVM within an encrypted partition
d-i partman-auto/method string lvm
# If one of the disks that are going to be automatically partitioned
# contains an old LVM configuration, the user will normally receive a
# warning. This can be preseeded away...
d-i partman-lvm/device_remove_lvm boolean true
# The same applies to pre-existing software RAID array:
d-i partman-md/device_remove_md boolean true
# And the same goes for the confirmation to write the lvm partitions.
d-i partman-lvm/confirm boolean true
d-i partman-lvm/confirm_nooverwrite boolean true
# You can choose one of the three predefined partitioning recipes:
# - atomic: all files in one partition
# - home: separate /home partition
# - multi: separate /home, /usr, /var, and /tmp partitions
d-i partman-auto/choose_recipe select atomic
# Or provide a recipe of your own...
# If you have a way to get a recipe file into the d-i environment, you can
# just point at it.
#d-i partman-auto/expert_recipe_file string /hd-media/recipe
# If not, you can put an entire recipe into the preconfiguration file in one
# (logical) line. This example creates a small /boot partition, suitable
# swap, and uses the rest of the space for the root partition:
#d-i partman-auto/expert_recipe string \
# boot-root :: \
# ext3 \
# $primary{ } $bootable{ } \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ /boot } \
# . \
# ext3 \
# method{ format } format{ } \
# use_filesystem{ } filesystem{ ext3 } \
# mountpoint{ / } \
# . \
# % linux-swap \
# method{ swap } format{ } \
# .
# The full recipe format is documented in the file partman-auto-recipe.txt
# included in the 'debian-installer' package or available from D-I source
# repository. This also documents how to specify settings such as file
# system labels, volume group names and which physical devices to include
# in a volume group.
# This makes partman automatically partition without confirmation, provided
# that you told it what to do using one of the methods above.
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
#其他分区方式可以查看
#https://www.debian.org/releases/stable/i386/apbs04.html.zh-cn#ftn.idp56652848
#分区挂载控制
#文件系统一般使用 UUID 作为关键字挂载; 这使得在设备名变更的情况下仍然可以正常挂载。UUID
#本身很长不容易阅读,因此,安装程序也可以依照您的意愿使用传统设备名或者指定标签(label)挂载文件系统。假如安装程序使用标签方式,那些没有标签
#的文件系统仍然使用 UUID 方式挂载。
#具有固定名称的设备,比如 LVM 逻辑卷,将继续使用它们自己的名字而不是 UUID 方式挂载。
#传统设备名会根据内核在引导时发现的次序进行调整,这将导致挂载错误的文件系统。与此类似,假如您插入一个新磁盘或 USB 设备,标签也可能有冲突发生。这样系统启动后会出现一些随机的情况。
# The default is to mount by UUID, but you can also choose "traditional" to
# use traditional device names, or "label" to try filesystem labels before
# falling back to UUIDs.
#d-i partman/mount_style select uuid
#基本系统的安装
#本阶段的安装并没有多少东西需要预置。仅有一个与内核安装相关的问题。
#配置apt使得其不安装默认推荐软件包,这将致使系统不完整,非专业人士不推荐
#内核镜像安装,none将致使其不安装
#d-i base-installer/kernel/image string linux-generic
#设置apt
#设置 /etc/apt/sources.list 和其他的基本配置选项,将自动地基于您使用的安装方式以及前面问题的回答。您也可以选择性地安装其他(或本地)的仓库
# 可以选择安装 non-free和 contrib 软件
#d-i apt-setup/non-free boolean true
#d-i apt-setup/contrib boolean true
# 配置是否使用网络镜像
#d-i apt-setup/use_mirror boolean false
# 定义使用镜像
#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
# 另外的repo local[-] 可用
#d-i apt-setup/local0/repository string \
# http://local.server/debian stable main
#d-i apt-setup/local0/comment string local server
# Enable deb-src lines
#d-i apt-setup/local0/source boolean true
# URL to the public key of the local repository; you must provide a key or
# apt will complain about the unauthenticated repository and so the
# sources.list line will be left commented out
#d-i apt-setup/local0/key string http://local.server/key
# 无需key认证
#d-i debian-installer/allow_unauthenticated boolean true
#选择软件包
#主要看tasksel所包含的软件集
#如果打算安装一些安装任务之外的独立软件包,可以使用参数pksel/includ,该参数的值可以用逗号或者空格分开的软件包列表,便于在内核命令行上使用
#tasksel tasksel/first multiselect standard, web-server, kde-desktop
# 另外一些packages
#d-i pkgsel/include string openssh-server build-essential
# Whether to upgrade packages after debootstrap.
# Allowed values: none, safe-upgrade, full-upgrade
#d-i pkgsel/upgrade select none
# 安装反馈报告
#popularity-contest popularity-contest/participate boolean false
#安装bootloader
# Grub 时默认 boot loader (for x86).如果想使用lilo则
#d-i grub-installer/skip boolean true
# 跳过bootloader安装,则使用下面的
#d-i lilo-installer/skip boolean true
# 下述选项将使得GRUB自动安装到MBR,如果没侦测到OS
d-i grub-installer/only_debian boolean true
d-i grub-installer/with_other_os boolean true
# 如果想装到其他地方,而不是本地MBR
#d-i grub-installer/only_debian boolean false
#d-i grub-installer/with_other_os boolean false
#d-i grub-installer/bootdev string (hd0,)
# To install grub to multiple disks:
#d-i grub-installer/bootdev string (hd0,) (hd1,) (hd2,)
# To install to a particular device:
#d-i grub-installer/bootdev string /dev/sda
# 可选,设置grub密码
#d-i grub-installer/password password r00tme
#d-i grub-installer/password-again password r00tme
#MD5密码
#d-i grub-installer/password-crypted password [MD5 hash]
# Use the following option to add additional boot parameters for the
# installed system (if supported by the bootloader installer).
# Note: options passed to the installer will be added automatically.
#d-i debian-installer/add-kernel-opts string nousb
#完成安装
# 保持console有效
#d-i finish-install/keep-consoles boolean true
# 避免安装最后信息弹出
d-i finish-install/reboot_in_progress note
# 阻止CD弹出
#d-i cdrom-detect/eject boolean false
# 完成后shutdown,但不重启
#d-i debian-installer/exit/halt boolean true
# poweroff
#d-i debian-installer/exit/poweroff boolean true
#预置其他的软件包
# debconf-get-selections --installer
> file
# debconf-get-selections
>
> file
#安装过程中运行用户命令
#预置工具提供了一个非常强大和灵活的选项,可以在安装过程的一些环节运行命令或脚本。
# d-i preseeding is inherently not secure. Nothing in the installer checks
# for attempts at buffer overflows or other exploits of the values of a
# preconfiguration file like this one. Only use preconfiguration files from
# trusted locations! To drive that home, and because it's generally useful,
# here's a way to run any shell command you'd like inside the installer,
# automatically.
# preseed被读取之后,第一个命令将尽可能快的被执行#d-i preseed/early_command string anna-install some-udeb
# 开始分区开始前命令执行. It may be
# useful to apply dynamic partitioner preseeding that depends on the state
# of the disks (which may not be visible when preseed/early_command runs).
#d-i partman/early_command \
# string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
# 完成安装前命令执行 but when there is
# still a usable /target directory. You can chroot to /target and use it
# directly, or use the apt-install and in-target commands to easily install
# packages and run commands in the target system.
#d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
d-i preseed/late_command string \
in-target wget -O /root/desktop-bootstrap.sh "http://example.com/ubuntu-desktop-bootstrap.sh"; \
in-target chmod +x /root/desktop-bootstrap.sh; \
in-target /root/desktop-bootstrap.sh; \
cp /var/log/syslog /target/root/log/install-syslog;
# No boot splash screen.
#d-i debian-installer/splash boolean false
#预置文件链
#可以在一个预置文件里面包含另外的预置文件。这些文件里面的任何设置将覆盖前面加载的设置。有一种用法,例如,通用的网络设置放在一个文件,其他规格的设置放在另外的文件里面。
#d-i preseed/include string x.cfg
# The installer can optionally verify checksums of preconfiguration files
# before using them. Currently only md5sums are supported, list the md5sums
# in the same order as the list of files to include.
#d-i preseed/include/checksum string 5da499872becccfeda2c4872f9171c3d
# More flexibly, this runs a shell command and if it outputs the names of
# preconfiguration files, includes those files.
#d-i preseed/include_command \
# string if [ "`hostname`" = bob ]; then echo bob.cfg; fi
# Most flexibly of all, this downloads a program and runs it. The program
# can use commands such as debconf-set to manipulate the debconf database.
# More than one script can be listed, separated by spaces.
# Note that if the filenames are relative, they are taken from the same
# directory as the preconfiguration file that runs them.
#d-i preseed/run string foo.sh
 

测试ks文件下载

http://172.16.68.61/cblr/svc/op/ks/system/vm01

命令

yum更新

cobbler reposync

检查配置文件

cobbler check

详细信息

cobbler report

描述信息

cobbler distro list

系统信息

cobbler system list

测试开ks文件下载

cobbler profile getks --name=CentOS_6.5-x86_64

上一篇:PHP-Mysqli查询-分组并选择最低


下一篇:如何将DATA转换为输入字段-PHP