cobbler自动化安装linux

Cobbler自动部署Linux

Cobbler简介

Cobbler是一个快速网络安装linux的服务,而且在经过调整也可以支持网络安装windows。该工具使用python开发,小巧轻便,使用简单的命令即可完成PXE网络安装环境的配置,同时还可以管理DHCP,DNS,以及yum包镜像。

Cobbler部署

环境准备:

systemctl stop firewalld

setenforce 0

sed -ri '/^SELINUX/c\SELINUX=disabled' /etc/selinux/config

yum -y install epel-release

yum -y install cobbler cobbler-web tftp-server dhcp httpd xinetd

systemctl start httpd cobblerd

systemctl enable httpd cobblerd

 

 

 

 

cobbler测试:

cobbler check

dL8AAAAAAAAA&bo=ewI.AgAAAAADIEA!

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

dL4AAAAAAAAA&bo=RwKzAAAAAAADEMM!dMIAAAAAAAAA&bo=aAJsAAAAAAADEDM!

测试:(新建一台虚拟机开机)

dDQBAAAAAAAA&bo=KgI4AQAAAAADECQ!

 

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(同步设置)

 

最终测试

dFIBAAAAAAAA&bo=0QHgAAAAAAADEAU!

 

dDMBAAAAAAAA&bo=RwFfAAAAAAADECw!

 

 

 

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章