Cobbler是一個快速網絡安裝linux的服務,並且在通過調整也能夠支持網絡安裝windows。該工具使用python開發,小巧輕便,使用簡單的命令便可完成PXE網絡安裝環境的配置,同時還能夠管理DHCP,DNS,以及yum包鏡像。python
環境準備:linux
systemctl stop firewalldios
setenforce 0web
sed -ri '/^SELINUX/c\SELINUX=disabled' /etc/selinux/configvim
yum -y install epel-releasewindows
yum -y install cobbler cobbler-web tftp-server dhcp httpd xinetdcentos
systemctl start httpd cobblerdbash
systemctl enable httpd cobblerd網絡
cobbler測試:koa
cobbler check
sed -ri '/allow_dynamic_settings:/c\allow_dynamic_settings: 1' /etc/cobbler/settings
設置cobbler可腳本
問題解決:
1.cobbler setting edit --name=server --value=192.168.11.16
2.cobbler setting edit --name=next_server --value=192.168.11.16
3.sed -ri /selinux=enable/c\selinux=disable /etc/selinux/config
4.sed -ri '/disable/c\disable = no' /etc/xinetd.d/tftp systemctl restart xinetd
systemctl enable xinetd
5.cobbler get-loaders
6.systemctl start rsyncd
systemctl enable rsyncd
7.不須要安裝,不影響實驗
8.openssl passwd -1 -salt 'openssl rand -hex 4' 'leo123'
$1$openssl $JszVPeye1hqHPJ1njkxz20 //獲取到的密碼
cobbler setting edit --name=default_password_crypted--value='$1$openssl$JszVPeye1hqHPJ1njkxz20'
9.yum install -y fence-agents
10.cobbler setting edit --name=manage_dhcp --value=1
vim /etc/cobbler/dhcp.template
mount /dev/cdrom /media/
cobbler import --path=/media --name=centos7.2 --arch=x86_64
cobbler list
cd /var/lib/cobbler/kickstarts/
cp sample.ks centos7.ks
vim centos7.ks
install
text
keyboard us
lang en_US
timezone Asia/ShangHai
rootpw --iscrypted $default_password_crypted
auth --useshadow --enablemd5
firewall --disabled
selinux --disabled
url --url=$tree
zerombr
bootloader --location=mbr
clearpart --all --initlabel
part /boot --fstype=xfs --size=500
part swap --size=1024
part / --fstype=xfs --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')
@^minimal
@core
httpd
wget
lftp
vim-enhanced
bash-completion
%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
systemctl enable httpd
%end
cobbler profile edit --name=centos7.2-x86_64 --kickstart=/var/lib/cobbler/kickstarts/centos7.ks
cp centos7.ks centos-webserver.ks
cobbler profile add --name=」centos7-web-server」 --distro=」centos7.2-x86_64」--kickstart=’/var/lib/cobbler/kickstarts/centos7-webserver.ks’ --kopts=’net.ifnames=0 biosdevname=0’
cobbler sync(同步設置)
最終測試