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.1503(Core)
[root@cobbler-server ~]# uname –r        #内核版本
3.10.0-229.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 -1 -salt '$(openssl rand -hex 4)''cobbler'
$1$$(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.250;
default-lease-time 21600;
max-lease-time 43200;
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.1-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.8-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.5-ks.cfg /var/www/cobbler/pub/

 

 指定无人看守安装

 

[root@cobbler ~]# cat /var/lib/tftpboot/pxelinux.cfg/default
DEFAULT menu PROMPT
0 MENU TITLE Cobbler | http://cobbler.github.io
TIMEOUT 200 TOTALTIMEOUT 6000 ONTIMEOUT local LABEL local MENU LABEL (local) MENU DEFAULT LOCALBOOT -1 LABEL CentOS_6.5-x86_64 kernel /images/CentOS_6.5-x86_64/vmlinuz MENU LABEL CentOS_6.5-x86_64 append initrd=/images/CentOS_6.5-x86_64/initrd.img ksdevice=bootif lang= kssendmac text ks=http://172.16.68.61/cobbler/pub/centos6.5-ks.cfg ipappend 2 MENU end

ks文件
[root@cobbler kickstarts]# cat  CentOS_6.5.ks 
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use CDROM installation media
url --url=$tree
# Root password
rootpw --iscrypted $1$78888O7t$XAdzFmSUXy7Ysqayh7IU/1
# 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=1
part /boot --asprimary --fstype="ext4" --size=500
part swap --asprimary --fstype="swap" --size=4096

%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 
  1 [root@cobbler kickstarts]# cat  ubuntu.14.04.5.seed 
  2 # Mostly based on the Ubuntu installation guide
  3 # https://help.ubuntu.com/12.04/installation-guide/
  4 
  5 # Preseeding only locale sets language, country and locale.
  6 d-i debian-installer/locale string en_US
  7 
  8 # Keyboard selection.
  9 # Disable automatic (interactive) keymap detection.
 10 d-i console-setup/ask_detect boolean false
 11 d-i keyboard-configuration/layoutcode string us
 12 d-i keyboard-configuration/variantcode string
 13 
 14 # netcfg will choose an interface that has link if possible. This makes it
 15 # skip displaying a list if there is more than one interface.
 16 
 17 d-i netcfg/enable boolean false
 18 d-i netcfg/choose_interface select auto
 19 #d-i netcfg/disable_dhcp boolean false
 20 #d-i netcfg/dhcp_timeout string 10
 21 d-i netcfg/disable_autoconfig boolean true
 22 d-i netcfg/dhcp_failed note
 23 d-i netcfg/dhcp_options select Do not configure the network at this time
 24 #set $myhostname = $getVar('hostname',$getVar('name','cobbler')).replace("_","-")
 25 d-i netcfg/get_hostname string $myhostname
 26 # If you have a slow dhcp server and the installer times out waiting for  
 27 # it, this might be useful  
 28 #d-i netcfg/dhcp_timeout string 60
 29 
 30 #d-inetcfg/dhcp_failed note  
 31 #d-inetcfg/dhcp_options select Configure network manually 
 32 
 33 # If non-free firmware is needed for the network or other hardware, you can
 34 # configure the installer to always try to load it, without prompting. Or
 35 # change to false to disable asking.
 36 #d-i hw-detect/load_firmware boolean true
 37 
 38 # NTP/Time Setup
 39 d-i time/zone string Asia/Shanghai
 40 d-i clock-setup/utc boolean true
 41 d-i clock-setup/ntp boolean true
 42 d-i clock-setup/ntp-server  string ntp.ubuntu.com
 43 
 44 # Setup the installation source
 45 d-i mirror/country string manual
 46 d-i mirror/http/hostname string $http_server
 47 d-i mirror/http/directory string $install_source_directory
 48 d-i mirror/http/proxy string
 49 
 50 #set $os_v = $getVar('os_version','')
 51 #if $os_v and $os_v.lower()[0] > 'p'
 52 # Required at least for 12.10+
 53 d-i live-installer/net-image string http://$http_server/cobbler/links/$distro_name/install/filesystem.squashfs
 54 #end if
 55 
 56 # Suite to install.
 57 # d-i mirror/suite string precise
 58 # d-i mirror/udeb/suite string precise
 59 
 60 # Components to use for loading installer components (optional).
 61 #d-i mirror/udeb/components multiselect main, restricted
 62 
 63 # Disk Partitioning
 64 # Use LVM, and wipe out anything that already exists
 65 #d-i partman/choose_partition select finish
 66 #d-i partman/confirm boolean true
 67 #d-i partman/confirm_nooverwrite boolean true
 68 #d-i partman-auto/method string lvm
 69 #d-i partman-lvm/device_remove_lvm boolean true
 70 #d-i partman-lvm/confirm boolean true
 71 #d-i partman-lvm/confirm_nooverwrite boolean true
 72 #d-i partman-md/device_remove_md boolean true
 73 #d-i partman-partitioning/confirm_write_new_label boolean true
 74 
 75 d-i partman-auto/disk string /dev/sda
 76 d-i partman-auto/method string regular
 77 d-i partman-lvm/device_remove_lvm boolean true
 78 d-i partman-md/device_remove_md boolean true
 79 d-i partman-lvm/confirm boolean true
 80 d-i partman-auto/expert_recipe string      \
 81     boot-root ::                           \
 82            5000  5000  5000  ext4       \
 83                  $primary{ }               \
 84               $bootable{ }           \
 85                  method{ format }          \
 86           format{ }                     \
 87                  use_filesystem{ }         \
 88              filesystem{ ext4 }           \
 89                  mountpoint{ / }           \
 90           .                             \
 91             4096 4096 4096  linux-swap     \
 92              method{ swap }             \
 93           format{ }                  \
 94           .                             \
 95         max        ext4         \
 96                   method{ format }         \
 97               format{ }           \
 98                   use_filesystem{ }        \
 99           filesystem{ ext4 }       \
100                   mountpoint{ /opt }    \
101           .                             \    
102 d-i partman/default_filesystem string ext4
103 
104 d-i partman-partitioning/confirm_write_new_label boolean true
105 d-i partman/choose_partition select finish
106 d-i partman/confirm boolean true
107 d-i partman/confirm_nooverwrite boolean true
108 d-i partman/mount_style select uuid
109 
110 
111 # You can choose one of the three predefined partitioning recipes:
112 # - atomic: all files in one partition
113 # - home:   separate /home partition
114 # - multi:  separate /home, /usr, /var, and /tmp partitions
115 #d-i partman-auto/choose_recipe select 
116 
117 # If you just want to change the default filesystem from ext3 to something
118 # else, you can do that without providing a full recipe.
119 # d-i partman/default_filesystem string ext4
120 
121 # root account and password
122 d-i passwd/root-login boolean true
123 d-i passwd/root-password-crypted password $1$78888O7t$XAdzFmSUXy7Ysqayh7IU/1
124 
125 # skip creation of a normal user account.
126 d-i passwd/make-user boolean false
127 
128 # You can choose to install restricted and universe software, or to install
129 # software from the backports repository.
130 # d-i apt-setup/restricted boolean true
131 # d-i apt-setup/universe boolean true
132 # d-i apt-setup/backports boolean true
133 
134 # Uncomment this if you don't want to use a network mirror.
135 # d-i apt-setup/use_mirror boolean false
136 
137 # Select which update services to use; define the mirrors to be used.
138 # Values shown below are the normal defaults.
139 # d-i apt-setup/services-select multiselect security
140 # d-i apt-setup/security_host string security.ubuntu.com
141 # d-i apt-setup/security_path string /ubuntu
142 
143 $SNIPPET('preseed_apt_repo_config')
144 
145 # Enable deb-src lines
146 # d-i apt-setup/local0/source boolean true
147 
148 # URL to the public key of the local repository; you must provide a key or
149 # apt will complain about the unauthenticated repository and so the
150 # sources.list line will be left commented out
151 # d-i apt-setup/local0/key string http://local.server/key
152 
153 # By default the installer requires that repositories be authenticated
154 # using a known gpg key. This setting can be used to disable that
155 # authentication. Warning: Insecure, not recommended.
156 # d-i debian-installer/allow_unauthenticated boolean true
157 
158 # Individual additional packages to install
159 # wget is REQUIRED otherwise quite a few things won't work
160 # later in the build (like late-command scripts)
161 d-i pkgsel/include string ntp ssh wget
162 
163 # Use the following option to add additional boot parameters for the
164 # installed system (if supported by the bootloader installer).
165 # Note: options passed to the installer will be added automatically.
166 d-i debian-installer/add-kernel-opts string $kernel_options_post
167 
168 # Avoid that last message about the install being complete.
169 d-i finish-install/reboot_in_progress note
170 
171 ## Figure out if we're kickstarting a system or a profile
172 #if $getVar('system_name','') != ''
173 #set $what = "system"
174 #else
175 #set $what = "profile"
176 #end if
177 
178 # This first command is run as early as possible, just after preseeding is read.
179 # d-i preseed/early_command string [command]
180 d-i preseed/early_command string wget -O- \
181    http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_early_default | \
182    /bin/sh -s
183 
184 # This command is run immediately before the partitioner starts. It may be
185 # useful to apply dynamic partitioner preseeding that depends on the state
186 # of the disks (which may not be visible when preseed/early_command runs).
187 # d-i partman/early_command \
188 #       string debconf-set partman-auto/disk "\$(list-devices disk | head -n1)"
189 
190 # This command is run just before the install finishes, but when there is
191 # still a usable /target directory. You can chroot to /target and use it
192 # directly, or use the apt-install and in-target commands to easily install
193 # packages and run commands in the target system.
194 # d-i preseed/late_command string [command]
195 d-i preseed/late_command string wget -O- \
196    http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | \
197    chroot /target /bin/sh -s
View Code

 

 ubuntu有多网卡时需要设置profile

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

ubuntu.seed模板
  1 #url:主要参考
  2 # 1: https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallPreseed
  3 # 2:https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallScripts
  4 # 3:https://help.ubuntu.com/12.04/installation-guide/example-preseed.txt
  5 # 4:https://wiki.ubuntu.com/QATeam/AutomatedTesting/
  6 # 5:https://www.debian.org/releases/wheezy/example-preseed.txt
  7 # 6:https://help.ubuntu.com/14.04/installation-guide/i386/apb.html
  8 # 7:http://www.startos.com/zhuanti/zt02/2010/1111/9391.html
  9 # 8:https://help.ubuntu.com/lts/installation-guide/i386/ch04s06.html#preseed(然后它)
 10 # 9:https://www.debian.org/releases/stable/i386/ch06s03.html.zh-cn(第一重要,有助于理解整个流程)
 11 preseed主要包括以下内容
 12 1、本地化
 13 2、网络设置
 14 3、镜像设置
 15 4、账号设置
 16 5、时钟与时区设置
 17 6、分区
 18 7、基本系统安装
 19 8、设置apt
 20 9、选择软件包
 21 10、安装bootloader
 22 11、完成安装
 23 12、预置其他的软件包
 24 #书写perseed时需要注意的点
 25 #preconfiguration 文件格式如下
 26 #<owner> <question name> <question type> <value>
 27 #确保type与value之间只有一个空格符或者tab
 28 #多行的话最好是在question name后添加\,而不应该在type与value之间
 29 #对于debconf 变量,owner前需要加d-i
 30 #其二,可以通过debconf-utils软件包里面的debconf-get-selections导出debconf数据库和安装程序的cdebconf数据库到另一文件
 31 #debconf-get-selections --installer > file
 32 #debconf-get-selections >> file
 33 #本地化 设置 language country and locale
 34 #如果预置locale为en_NL在安装后系统默认的locale将是en_US.UTF-8,如果想要使用en_GB.UTF-8,该值需要分别进行预置
 35 #d-i debian-installer/language srtring en
 36 #d-i debian-installer/country string CH
 37 d-i debain-install/locale string zh_CN.UTF-8
 38 #键盘配置,安装时只提供基本keymap,高级的需要在安装好的系统下才能使用,使用dpkg-reconfigure keyboard-configuration配置
 39 d-i keyboard-configuration/xkb-keymap select us
 40 #d-i keyboard-configuration/toggle select No toggling
 41 #网络设置
 42 #如果需要禁用网络,则如下
 43 #d-i netcfg/enable boolean false
 44 #若网络可用,则netcfg将选择一网口,如果需要跳过显示选择网卡列表,则设置自动选择
 45 #d-i netcfg/choose_interface select auto
 46 #如果想直接指定某一网口,则设置如下
 47 #d-i netcfg/choose_interface select eth0
 48 #设置链接网口的检测时间,默认时间时3秒
 49 #d-i netcfg/link_wait_timeout string 10
 50 #如果DHCP服务器延迟较高,可以将安装过程中DHCP设置时延变长
 51 #d-i netcfg/dhcp_timeout string 45
 52 #如果需要手动配置网络,则如下配置
 53 #d-i netcfg/disable_autoconfig boolean true
 54 #d-i netcfg/dhcp_failed note
 55 #d-i netcfg/dhcp_options select Configure network manually
 56 #d-i netcfg/get_nameservers string 192.168.1.1
 57 #d-i netcfg/get_ipaddress string 192.168.1.42
 58 #d-i netcfg/get_netmask string 255.255.255.0
 59 #d-i netcfg/get_gateway string 192.168.1.1
 60 #d-i netcfg/confirm_static boolean true
 61 #设置hostname以及domain避免问答
 62 #d-i netcfg/get_hostname string unassigned-hostname
 63 #d-i netcfg/get_domain string unassigned-domain
 64 #手动预置hostname
 65 #d-i netcfg/hostname string abc
 66 #non-free需要网络,可以配置其直接连接网络而无需询问
 67 #d-i hw-detect/load_firmware boolean true
 68 #需要注意的是,如果netcfg/get_netmask没有预置,netcfg将自动侦测掩码,这种情况下,为了自动安装,变量需要标记为seen,
 69 #同样,如果netcfg/get_gateway没有设置,netcfg将自动选择一个合适的地址。特殊情况下,可以设置netcfg/get_gateway
 70 #为none确定不使用网关
 71 #网络控制台
 72 #如果需要通过SSH进行远程安装,就需要确保网络console
 73 #d-i anna/choose_modules string network-console
 74 #d-i network-console/authorized_keys_url string http://10.133.5.100/ubuntu/openssh-key
 75 #d-i network-console/password password r00tme
 76 #d-i network-console/password-again password r00tme
 77 #镜像设置
 78 #镜像可用于下载安装程序的额外组件、安装基本系统以及所安装的系统建立/etc/apt/source.list
 79 #参数mirror/suite决定了安装号的系统使用的套件。
 80 #参数mirror/udev/suite决定安装程序使用的额外组件的套件。它只在组件通过网络下载病与安装时使用的initrd建立套件相匹配时才有效。
 81 #通常安装程序会自动安装病使用正确的值,而无需手动设置
 82 #如果选择FTP,则mirror/country无需设置
 83 #d-i mirror/protocol string ftp 如果不指出所用协议,则默认为http
 84 d-i mirror/country string manual
 85 d-i mirror/http/hostname string http.us.debian.org
 86 d-i mirror/http/directory string /debian
 87 d-i mirror/http/proxy string
 88 #安装套件
 89 #d-i mirror/suite string testing
 90 #d-i mirror/udev/suite string testing
 91 #账号设置
 92 #root账号的密码和普通用户的用户名和密码都可以预置。可以使用纯文本或者MD5
 93 #如果需要跳过root用户的创建则
 94 #d-i passwd/root-login boolean false
 95 #同样也可以跳过创建普通用户
 96 #d-i passwd/make-user boolean false
 97 #设置root密码,负责为空
 98 #d-i passwd/root-password password 123456st
 99 #d-i passwd/root-password-again password 123456st
100 #同样可以用加密的MD5哈希
101 #d-i passwd/root-password-crtpted password [MD5 hash]
102 #创建普通账户
103 #d-i passwd/user-fullname string Debian User
104 #d-i passwd/username string debian
105 # 普通用户密码
106 #d-i passwd/user-password password insecure
107 #d-i passwd/user-password-again password insecure
108 # 或者用MD5
109 #d-i passwd/user-password-crypted password [MD5 hash]
110 # 为第一个用户以指定UID进行创建
111 #d-i passwd/user-uid string 1010
112 # 将第一用户加入某一group
113 #d-i passwd/user-default-groups string audio cdrom video
114 passwd/root-password-crypted 和 passwd/user-password-crypted 值可以使用 “!” 作为他们的预置值。这种情况下,对应的帐号关闭。
115 它常用于 root 帐号,用其他替代方法允许管理或 root 登录(例如使用 SSH key 认证或 sudo).
116 下面的命令可用于生成密码的 MD5 值。
117 mkpasswd -m sha-512
118 #时钟与时区设置
119 #设置硬件时钟是否为UTC
120 d-i clock-setup/utc boolean true
121 #设置为某一时区
122 # 可以参照/usr/share/zoneinfo里面的值
123 d-i time/zone string Asia/Shanghai
124 #设置在安装过程中是否以NTP为时间基准
125 d-i clock-setup/ntp boolean true
126 # 使用的NTP服务器
127 #d-i clock-setup/ntp-server string xxx
128 #分区设置
129 分区可以参考一下以下资料
130 #http://www.cnblogs.com/silenceli/p/3472222.html
131 #https://wiki.ubuntu.com/Enterprise/WorkstationAutoinstallPreseed
132 #使用预置进行硬盘分区受限于 partman-auto 提供的支持。您可以选择使用磁盘上已有的空闲分区或者整个磁盘。磁盘的布局将取决于所使用的预定义方案,用户自定义的方案文件或预置文件包含的方案。
133 #已经支持包括 RAID、LVM 和加密高级分区设置的预置,但对于非预置安装的分区仍然弹性不足。
134 #下面的例子仅提供了使用方案的最基本信息。详细的内容清参考文件 partman-auto-recipe.txt 和 partman-auto-raid-recipe.txt,它们含在 debian-installer 软件包里。这两个文件也可以从 debian-installer source repository##获取。注意不同发布版支持的功能会有所改变。
135 #http://anonscm.debian.org/gitweb/?p=d-i/debian-installer.git;a=tree;f=doc/devel
136 # If the system has free space you can choose to only partition that space.
137 # This is only honoured if partman-auto/method (below) is not set.
138 #d-i partman-auto/init_automatically_partition select biggest_free
139 # Alternatively, you may specify a disk to partition. If the system has only
140 # one disk the installer will default to using that, but otherwise the device
141 # name must be given in traditional, non-devfs format (so e.g. /dev/hda or
142 # /dev/sda, and not e.g. /dev/discs/disc0/disc).
143 # For example, to use the first SCSI/SATA hard disk:
144 #d-i partman-auto/disk string /dev/sda
145 # In addition, you'll need to specify the method to use.
146 # The presently available methods are:
147 # - regular: use the usual partition types for your architecture
148 # - lvm: use LVM to partition the disk
149 # - crypto: use LVM within an encrypted partition
150 d-i partman-auto/method string lvm
151 # If one of the disks that are going to be automatically partitioned
152 # contains an old LVM configuration, the user will normally receive a
153 # warning. This can be preseeded away...
154 d-i partman-lvm/device_remove_lvm boolean true
155 # The same applies to pre-existing software RAID array:
156 d-i partman-md/device_remove_md boolean true
157 # And the same goes for the confirmation to write the lvm partitions.
158 d-i partman-lvm/confirm boolean true
159 d-i partman-lvm/confirm_nooverwrite boolean true
160 # You can choose one of the three predefined partitioning recipes:
161 # - atomic: all files in one partition
162 # - home: separate /home partition
163 # - multi: separate /home, /usr, /var, and /tmp partitions
164 d-i partman-auto/choose_recipe select atomic
165 # Or provide a recipe of your own...
166 # If you have a way to get a recipe file into the d-i environment, you can
167 # just point at it.
168 #d-i partman-auto/expert_recipe_file string /hd-media/recipe
169 # If not, you can put an entire recipe into the preconfiguration file in one
170 # (logical) line. This example creates a small /boot partition, suitable
171 # swap, and uses the rest of the space for the root partition:
172 #d-i partman-auto/expert_recipe string \
173 # boot-root :: \
174 # 40 50 100 ext3 \
175 # $primary{ } $bootable{ } \
176 # method{ format } format{ } \
177 # use_filesystem{ } filesystem{ ext3 } \
178 # mountpoint{ /boot } \
179 # . \
180 # 500 10000 1000000000 ext3 \
181 # method{ format } format{ } \
182 # use_filesystem{ } filesystem{ ext3 } \
183 # mountpoint{ / } \
184 # . \
185 # 64 512 300% linux-swap \
186 # method{ swap } format{ } \
187 # .
188 # The full recipe format is documented in the file partman-auto-recipe.txt
189 # included in the 'debian-installer' package or available from D-I source
190 # repository. This also documents how to specify settings such as file
191 # system labels, volume group names and which physical devices to include
192 # in a volume group.
193 # This makes partman automatically partition without confirmation, provided
194 # that you told it what to do using one of the methods above.
195 d-i partman-partitioning/confirm_write_new_label boolean true
196 d-i partman/choose_partition select finish
197 d-i partman/confirm boolean true
198 d-i partman/confirm_nooverwrite boolean true
199 #其他分区方式可以查看
200 #https://www.debian.org/releases/stable/i386/apbs04.html.zh-cn#ftn.idp56652848
201 #分区挂载控制
202 #文件系统一般使用 UUID 作为关键字挂载; 这使得在设备名变更的情况下仍然可以正常挂载。UUID
203 #本身很长不容易阅读,因此,安装程序也可以依照您的意愿使用传统设备名或者指定标签(label)挂载文件系统。假如安装程序使用标签方式,那些没有标签
204 #的文件系统仍然使用 UUID 方式挂载。
205 #具有固定名称的设备,比如 LVM 逻辑卷,将继续使用它们自己的名字而不是 UUID 方式挂载。
206 #传统设备名会根据内核在引导时发现的次序进行调整,这将导致挂载错误的文件系统。与此类似,假如您插入一个新磁盘或 USB 设备,标签也可能有冲突发生。这样系统启动后会出现一些随机的情况。
207 # The default is to mount by UUID, but you can also choose "traditional" to
208 # use traditional device names, or "label" to try filesystem labels before
209 # falling back to UUIDs.
210 #d-i partman/mount_style select uuid
211 #基本系统的安装
212 #本阶段的安装并没有多少东西需要预置。仅有一个与内核安装相关的问题。
213 #配置apt使得其不安装默认推荐软件包,这将致使系统不完整,非专业人士不推荐
214 #内核镜像安装,none将致使其不安装
215 #d-i base-installer/kernel/image string linux-generic
216 #设置apt
217 #设置 /etc/apt/sources.list 和其他的基本配置选项,将自动地基于您使用的安装方式以及前面问题的回答。您也可以选择性地安装其他(或本地)的仓库
218 # 可以选择安装 non-free和 contrib 软件
219 #d-i apt-setup/non-free boolean true
220 #d-i apt-setup/contrib boolean true
221 # 配置是否使用网络镜像
222 #d-i apt-setup/use_mirror boolean false
223 # 定义使用镜像
224 #d-i apt-setup/services-select multiselect security
225 #d-i apt-setup/security_host string security.ubuntu.com
226 #d-i apt-setup/security_path string /ubuntu
227 # 另外的repo local[0-9] 可用
228 #d-i apt-setup/local0/repository string \
229 # http://local.server/debian stable main
230 #d-i apt-setup/local0/comment string local server
231 # Enable deb-src lines
232 #d-i apt-setup/local0/source boolean true
233 # URL to the public key of the local repository; you must provide a key or
234 # apt will complain about the unauthenticated repository and so the
235 # sources.list line will be left commented out
236 #d-i apt-setup/local0/key string http://local.server/key
237 # 无需key认证
238 #d-i debian-installer/allow_unauthenticated boolean true
239 #选择软件包
240 #主要看tasksel所包含的软件集
241 #如果打算安装一些安装任务之外的独立软件包,可以使用参数pksel/includ,该参数的值可以用逗号或者空格分开的软件包列表,便于在内核命令行上使用
242 #tasksel tasksel/first multiselect standard, web-server, kde-desktop
243 # 另外一些packages
244 #d-i pkgsel/include string openssh-server build-essential
245 # Whether to upgrade packages after debootstrap.
246 # Allowed values: none, safe-upgrade, full-upgrade
247 #d-i pkgsel/upgrade select none
248 # 安装反馈报告
249 #popularity-contest popularity-contest/participate boolean false
250 #安装bootloader
251 # Grub 时默认 boot loader (for x86).如果想使用lilo则
252 #d-i grub-installer/skip boolean true
253 # 跳过bootloader安装,则使用下面的
254 #d-i lilo-installer/skip boolean true
255 # 下述选项将使得GRUB自动安装到MBR,如果没侦测到OS
256 d-i grub-installer/only_debian boolean true
257 d-i grub-installer/with_other_os boolean true
258 # 如果想装到其他地方,而不是本地MBR
259 #d-i grub-installer/only_debian boolean false
260 #d-i grub-installer/with_other_os boolean false
261 #d-i grub-installer/bootdev string (hd0,1)
262 # To install grub to multiple disks:
263 #d-i grub-installer/bootdev string (hd0,1) (hd1,1) (hd2,1)
264 # To install to a particular device:
265 #d-i grub-installer/bootdev string /dev/sda
266 # 可选,设置grub密码
267 #d-i grub-installer/password password r00tme
268 #d-i grub-installer/password-again password r00tme
269 #MD5密码
270 #d-i grub-installer/password-crypted password [MD5 hash]
271 # Use the following option to add additional boot parameters for the
272 # installed system (if supported by the bootloader installer).
273 # Note: options passed to the installer will be added automatically.
274 #d-i debian-installer/add-kernel-opts string nousb
275 #完成安装
276 # 保持console有效
277 #d-i finish-install/keep-consoles boolean true
278 # 避免安装最后信息弹出
279 d-i finish-install/reboot_in_progress note
280 # 阻止CD弹出
281 #d-i cdrom-detect/eject boolean false
282 # 完成后shutdown,但不重启
283 #d-i debian-installer/exit/halt boolean true
284 # poweroff
285 #d-i debian-installer/exit/poweroff boolean true
286 #预置其他的软件包
287 # debconf-get-selections --installer
288 > file
289 # debconf-get-selections
290 >
291 > file
292 #安装过程中运行用户命令
293 #预置工具提供了一个非常强大和灵活的选项,可以在安装过程的一些环节运行命令或脚本。
294 # d-i preseeding is inherently not secure. Nothing in the installer checks
295 # for attempts at buffer overflows or other exploits of the values of a
296 # preconfiguration file like this one. Only use preconfiguration files from
297 # trusted locations! To drive that home, and because it's generally useful,
298 # here's a way to run any shell command you'd like inside the installer,
299 # automatically.
300 # preseed被读取之后,第一个命令将尽可能快的被执行#d-i preseed/early_command string anna-install some-udeb
301 # 开始分区开始前命令执行. It may be
302 # useful to apply dynamic partitioner preseeding that depends on the state
303 # of the disks (which may not be visible when preseed/early_command runs).
304 #d-i partman/early_command \
305 # string debconf-set partman-auto/disk "$(list-devices disk | head -n1)"
306 # 完成安装前命令执行 but when there is
307 # still a usable /target directory. You can chroot to /target and use it
308 # directly, or use the apt-install and in-target commands to easily install
309 # packages and run commands in the target system.
310 #d-i preseed/late_command string apt-install zsh; in-target chsh -s /bin/zsh
311 d-i preseed/late_command string \
312 in-target wget -O /root/desktop-bootstrap.sh "http://example.com/ubuntu-desktop-bootstrap.sh"; \
313 in-target chmod +x /root/desktop-bootstrap.sh; \
314 in-target /root/desktop-bootstrap.sh; \
315 cp /var/log/syslog /target/root/log/install-syslog;
316 # No boot splash screen.
317 #d-i debian-installer/splash boolean false
318 #预置文件链
319 #可以在一个预置文件里面包含另外的预置文件。这些文件里面的任何设置将覆盖前面加载的设置。有一种用法,例如,通用的网络设置放在一个文件,其他规格的设置放在另外的文件里面。
320 #d-i preseed/include string x.cfg
321 # The installer can optionally verify checksums of preconfiguration files
322 # before using them. Currently only md5sums are supported, list the md5sums
323 # in the same order as the list of files to include.
324 #d-i preseed/include/checksum string 5da499872becccfeda2c4872f9171c3d
325 # More flexibly, this runs a shell command and if it outputs the names of
326 # preconfiguration files, includes those files.
327 #d-i preseed/include_command \
328 # string if [ "`hostname`" = bob ]; then echo bob.cfg; fi
329 # Most flexibly of all, this downloads a program and runs it. The program
330 # can use commands such as debconf-set to manipulate the debconf database.
331 # More than one script can be listed, separated by spaces.
332 # Note that if the filenames are relative, they are taken from the same
333 # directory as the preconfiguration file that runs them.
334 #d-i preseed/run string foo.sh
View Code

 

 

 

测试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

转载于:https://www.cnblogs.com/zhenhui/p/6233114.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值