默认是保存到/root/ks.cfg
# vim /ks/ks.cfg
firewall --disabled
key --skip --在这里加上key --skip跳过输入安装码
# Install OS instead of upgrade
install
# Use NFS installation media
nfs --server=192.168.0.2 --dir=/yum
# Root password
rootpw --iscrypted $1$Iue02cNI$jxBug2glNJmSYff5tF4Gs/
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux --disabled
# Installation logging level
logging --level=info
# Reboot after installation
reboot
# System timezone
timezone --isUtc Asia/Shanghai
# Network information
network --bootproto=dhcp --device=eth0 --onboot=on
# System bootloader configuration
bootloader --append="rhgb quiet" --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --asprimary --fstype="ext4" --size=100
part swap --asprimary --fstype="swap" --size=2000
part / --asprimary --fstype="ext4" --grow --size=1
--------------------------------------------------------
# rpm -ivh cobbler-2.6.3-1.el6.noarch.rpm
warning: cobbler-2.6.3-1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
mod_wsgi is needed by cobbler-2.6.3-1.el6.noarch
python-cheetah is needed by cobbler-2.6.3-1.el6.noarch
PyYAML is needed by cobbler-2.6.3-1.el6.noarch
--这里的依赖性最后的PyYAML在rhel6.5的iso里不是自带的,所以要先手动上网下载并安装;上面两个依赖性在rhel6.5的iso里就有,所以可以直接使用yum来安装
# cobbler check --查看cobbler潜在的需要修改的选项(有可能因为你的httpd启不来,而选成无法显示下面的结果;按报错去解决它)
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.
3 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
4 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
解决了上面的问题后,再次cobbler check
# cobbler check --解决了上面的问题,只余下两个问题了(问题1可以使用cobbler get-loaders解决,但需要有外网和外网的yum源;问题2是关于debian系统的,我们这里可以忽略)
The following are potential configuration items that you may want to fix:
1 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
Restart cobblerd and then run 'cobbler sync' to apply changes.
# cobbler import --path=/yum/ --name=rhel-server-6.5-x86_64 --arch=x86_64 --将挂载的镜像目录/yum位置导入到cobbler
task started: 2015-08-15_112805_import
task started (id=Media import, time=Sat Aug 15 11:28:05 2015)
Found a candidate signature: breed=redhat, version=rhel6
Found a matching signature: breed=redhat, version=rhel6
Adding distros from path /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64:
creating new distro: rhel-server-6.5-x86_64
trying symlink: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64 -> /var/www/cobbler/links/rhel-server-6.5-x86_64
creating new profile: rhel-server-6.5-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64 for rhel-server-6.5-x86_64
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ScalableFileSystem
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ScalableFileSystem
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ScalableFileSystem/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ScalableFileSystem/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/LoadBalancer
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/LoadBalancer
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/LoadBalancer/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/LoadBalancer/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/HighAvailability
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/HighAvailability
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/HighAvailability/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/HighAvailability/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ResilientStorage
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ResilientStorage
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ResilientStorage/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/ResilientStorage/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/Server
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/Server
looking for /var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/Server/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel-server-6.5-x86_64/Server/repodata
*** TASK COMPLETE ***
# ls /var/www/cobbler/ks_mirror/ --导入完后,这里会多了刚导入的镜像目录
config rhel-server-6.5-x86_64
# cobbler distro list --列表你cobbler导入的镜像
rhel-server-6.5-x86_64
# cobbler profile list --列表你的cobbler自动安装方案(从这里看到你导入一个镜像会默认做一个与它同名的安装方案)
rhel-server-6.5-x86_64
vim /var/lib/cobbler/kickstarts/sample_end.ks
# kickstart template for Fedora 8 and later.
# (includes %end blocks)
# do not use with earlier distros
#platform=x86, AMD64, or Intel EM64T
# System authorization information
auth --useshadow --enablemd5
# System bootloader configuration
bootloader --location=mbr
# Partition clearing information
clearpart --all --initlabel
# Use text mode install
text
# Firewall configuration
firewall --enabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang en_US
# Use network installation
url --url=$tree
# If any cobbler repo definitions were referenced in the kickstart profile, include them here.
$yum_repo_stanza
# Network information
$SNIPPET('network_config')
# Reboot after installation
reboot
#Root password
rootpw --iscrypted $default_password_crypted
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# System timezone
timezone America/New_York
# Install OS instead of upgrade
install
# Clear the Master Boot Record
zerombr
# Allow anaconda to partition the system as needed
part /boot --asprimary --fstype="ext4" --size=200
part swap --asprimary --fstype="swap" --size=2000
part / --asprimary --fstype="ext4" --grow --size=1 --这里是把原来的一句autopart改成自己想要的分区形式(原来是分lvm,现在我定义了三个分区)