部署centos6

  • 挂载镜像和导入镜像
mount /dev/cdrom /media
ll /media/
cobbler import --path=/media --name=centos6.5--arch=x86_64
cobbler distro list 
说明:cobber把镜像导入到该目录下:/var/www/cobbler/ks_mirror/
  • 配置centos6的ks文件
cd /var/lib/cobbler/kickstarts
vim centos6.ks

centos6.ks文件内容如下

install
text
keyboard us
lang en_US
timezone Asia/ShangHai
rootpw --iscrypted $default_password_crypted
auth --useshadow --enablemd5firewall --disabled
selinux --disabled
url --url=$tree
zerombr
bootloader --location=mbr
clearpart --all --initlabel
part /boot --fstype=ext4 --size=500
part swap --size=1024
part / --fstype=ext4 --grow --size=200
$yum_repo_stanza
$SNIPPET('network_config')
skipx
firstboot --disable
reboot
%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')
%end
%packages
$SNIPPET('func_install_if_enabled')
@core
@base
wget
lftp
%end
%post --nochroot
$SNIPPET('log_ks_post_nochroot')
%end
%post
$SNIPPET('log_ks_post')
# Start yum configuration
$yum_config_stanza
# End yum configuration
$SNIPPET('post_install_kernel_options')$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
# Enable post-install boot notification
$SNIPPET('post_anamon')
# Start final steps
$SNIPPET('kickstart_done')
# End final steps
sed -ri "/^#UseDNS/c\UseDNS no" /etc/ssh/sshd_config
sed -ri "/^GSSAPIAuthentication/c\GSSAPIAuthentication no" /etc/ssh/sshd_config
%end
  • 镜像和ks文件关联
cobbler profile list                    //查看导入的镜像名称,profile包含ks文件和镜像
cobbler profile edit --name=centos6.5-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos6.ks 
cobbler profile report
  • 检测ks文件语法
cobbler validateks
posted @ 2018-05-08 19:59  你很棒  阅读(301)  评论(0编辑  收藏  举报