Cobbler是基于Linux的自动化运维工具,基于Python2开发,用于批量自动部署安装操作系统;它提供了基于CLI的管理模式和WEB配置界面,其中WEB配置界面基于Python2和Django框架开发。此外,cobbler还提供API,方便二次开发。补鞋匠属于C/S模式(客户机/服务器模式)
1。检查系统版本
# cat /etc/redhat-release
CentOS Linux版本7.1.1503(核心)(注意,此部署在Centos7中)
# uname -rm
3.10.0-229.el7.x86_*** x86_***
2。安装epel源代码和epel库
#yum install -y epel-release#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
3。安装cobbler环境所需的软件包
下载pip的最新版本,然后安装它。
#wget https://bootstrap.pypa.io/get-pip.py#python get-pip.py#ln -s /usr/local/python27/bin/pip2.7 /usr/bin/pip2#pip2 install Django==1.8.9
4。开始安装cobbler
#yum install -y httpd dhcp tftp tftp-server rsync pykickstart xinetd #yum install -y cobbler
5。centos7安装Cobbler-Web(Cobbler-Web版本2.8必须使用django1.8.9版本1.8.9)
#yum install httpd-devel#yum install -y cobbler-web
6。配置HTTPD的配置文件,更改项目存储的权限
#vim /etc/httpd/conf/httpd.conf<Directory "/usr/share/cobbler/web/"> <IfModule mod_ssl.c> SSLRequireSSL </IfModule> <IfModule mod_nss.c> NSSRequireSSL </IfModule> SetEnv VIRTUALENV Options Indexes MultiViews Order allow,deny ##apache2.4必须改为AllowOverride All Allow from all ##apache2.4必须改为Require all granted </Directory>
7。打开服务并启动
#systemctl enable xinetd#systemctl start xinetd#systemctl start httpd#systemctl start cobblerd#systemctl enable httpd#systemctl enable cobblerd#systemctl enable rsyncd#systemctl start rsyncd
8。检查鞋匠
#cobbler check
根据以上提示,按如下步骤修改配置:
修改补鞋匠的设置文件,备份
# cp /etc/cobbler/settings{,.ori}
修改服务器的IP,补鞋匠服务器。
#sed -i 's/server: 127.0.0.1/server: 192.168.0.131/' /etc/cobbler/settings
如果使用Cobbler管理DHCP,请修改此项。
#sed -i 's/next_server: 127.0.0.1/next_server: 192.168.0.131/' /etc/cobbler/settings#sed -i 's/***nage_dhcp: 0/***nage_dhcp: 1/' /etc/cobbler/settings
为了防止系统循环加载,适用于服务器的第一个启动项目是PXE启动。
#sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
为新安装的系统设置默认root密码123456。random-phrase-这里是干扰码,可以自己设置。
# openssl passwd -1 -salt 'cobbler' '123456'
$ 1 $补鞋匠$ sqddobeljkvmxtczr 52/11
# vim /etc/cobbler/settings
default _ password _ crypted:“$ 1 $ cobbler $ sqddobelkjvmxtczr 52/11 ”
修改tftp配置并启用tftp
#vim /etc/xinetd.d/tftp
将disable = yes改为:disable = no
配置DHCP
# vim /etc/cobbler/dhcp.template
按如下方式修改配置:
subnet 192.168.1.0 net***sk 255.255.255.0 {option routers192.168.1.1;option do***in-name-servers 114.114.114.114;option subnet-***sk255.255.255.0;range dynamic-bootp10.0.0.100 10.0.0.200;
下载引导加载程序
#cobbler get-loaders
同步配置
#systemctl restart cobblerd#cobbler sync
9。将图像导入到cobbler
#mount /dev/cdrom /mnt#cobbler import --path=/mnt/ --name=CentOS-7-x86_*** --arch=x86_***
10。编辑kickstart文件
#cd /var/lib/cobbler/kickstarts/#vim CentOS-7-x86_***.cfg
配置文件如下所示:
#Kickstart Configurator for cobbler by Jason Zhao#platform=x86, AMD***, or Intel EM***T#System languagelang en_US#System keyboardkeyboard us#Sytem timezonetimezone Asia/Shanghai#Root passwordrootpw --iscrypted $default_password_crypted#Use text mode installtext#Install OS instead of upgradeinstall#Use NFS installation Mediaurl --url=$tree#System bootloader configurationbootloader --location=mbr#Clear the Master Boot Recordzerombr#Partition clearing infor***tionclearpart --all --initlabel#Disk partitioning infor***tionpart /boot --fstype xfs --size 1024 --ondisk sdapart swap --size 1024 --ondisk sdapart / --fstype xfs --size 1 --grow --ondisk sda#System authorization info***tionauth --useshadow --enablemd5#Network infor***tion$SNIPPET('network_config')#network --bootproto=dhcp --device=em1 --onboot=on# Reboot after installationreboot#Firewall configurationfirewall --disabled#SELinux configurationselinux --disabled#Do not configure XWindowsskipx#Package install infor***tion%pre$SNIPPET('log_ks_pre')$SNIPPET('kickstart_start')$SNIPPET('pre_install_network_config')# Enable installation monitoring$SNIPPET('pre_anamon')%end %packages@ base@ coresysstatiptrafntplrzszncurses-developenssl-develzlib-develOpenIPMI-tool***ysqln***pscreen%end %postsystemctl disable postfix.service%end
十一。更改centos6和centos7的ks文件位置
#cobbler profile edit --name=CentOS-7-x86_*** --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_***.cfg
12、补鞋匠常用命令
补鞋检查#检查补鞋配置
Cobbler sync #同步配置到dhcp/pxe和数据目录。
列出所有的补鞋匠元素。
导入安装的系统镜像。
Cobbler report #列出了每个元素的详细信息。
查看导入的分销系统的信息
补鞋匠配置文件#查看配置信息
查看添加的系统信息
Cobbler reposync #将yum仓库同步到本地
十三。检查详细的配置信息。这里显示centos7配置信息
# cobbler profile report# cobbler sync
14。配置绑定***c地址和IP地址,并自动选择
# cobbler system add --name=centos711 --***c=00:0C:29:70:E8:A3 --profile=Centos-7-x86_*** --ip-address=192.168.0.40 --subnet=255.255.255.0 --gateway=192.168.0.1 --inte***ce=eth0 --static=1 --hostname=centos711 --name-servers="223.5.5.5"# cobbler sync
也可以安装cento7系统。
本文来自莫失莫忘投稿,不代表舒华文档立场,如若转载,请注明出处:https://www.chinashuhua.cn/24/591489.html