
文章插圖
Cobbler是一款Linux生態(tài)的自動(dòng)化運(yùn)維工具,基于Python2開發(fā),用于自動(dòng)化批量部署安裝操作系統(tǒng);其提供基于CLI的管理方式和WEB配置界面,其中WEB配置界面是基于Python2和Django框架開發(fā) 。另外,cobbler還提供了API,方便二次開發(fā) 。Cobbler屬于C/S模型(客戶端/服務(wù)器模型)
1、查看系統(tǒng)版本
# cat /etc/redhat-releaseCentOS Linux release 7.1.1503 (Core) (備注本次部署是在Centos7中進(jìn)行)
# uname -rm3.10.0-229.el7.x86_64 x86_64
2、安裝epel源,安裝epel庫
#yum install -y epel-release#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo3、安裝cobbler環(huán)境所需的包
下載最新版的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.94、開始安裝cobbler
#yum install -y httpd dhcp tftp tftp-server rsync pykickstart xinetd #yum install -y cobbler5、centos7安裝cobbler-web(cobbler-web2.8版本必須用django1.8.9版本)
#yum install httpd-devel#yum install -y cobbler-web6、配置HTTPD的配置文件,更改項(xiàng)目存放的權(quán)限
#vim /etc/httpd/conf/httpd.conf<Directory "/usr/share/cobbler/web/"><IfModule mod_ssl.c>SSLRequireSSL</IfModule><IfModule mod_nss.c>NSSRequireSSL</IfModule>SetEnv VIRTUALENVOptions Indexes MultiViewsOrder allow,deny##apache2.4必須改為AllowOverride AllAllow from all##apache2.4必須改為Require all granted</Directory>7、開啟服務(wù)和加開機(jī)啟動(dòng)
#systemctl enable xinetd#systemctl start xinetd#systemctl start httpd#systemctl start cobblerd#systemctl enable httpd#systemctl enable cobblerd#systemctl enable rsyncd#systemctl start rsyncd8、檢查cobbler
#cobbler check按照上面的提示,逐步修改配置如下:
修改cobbler的settings文件,備份
# cp /etc/cobbler/settings{,.ori}修改server,Cobbler服務(wù)器的IP 。
#sed -i 's/server: 127.0.0.1/server: 192.168.0.131/' /etc/cobbler/settings如果用Cobbler管理DHCP,修改本項(xiàng)
#sed -i 's/next_server: 127.0.0.1/next_server: 192.168.0.131/' /etc/cobbler/settings#sed -i 's/manage_dhcp: 0/manage_dhcp: 1/' /etc/cobbler/settings防止循環(huán)裝系統(tǒng),適用于服務(wù)器第一啟動(dòng)項(xiàng)是PXE啟動(dòng) 。
#sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings設(shè)置新裝系統(tǒng)的默認(rèn)root密碼123456 。random-phrase-here為干擾碼,可以自行設(shè)定 。
# openssl passwd -1 -salt 'cobbler' '123456'$1$cobbler$sqDDOBeLKJVmxTCZr52/11
# vim /etc/cobbler/settingsdefault_password_crypted: “$1$cobbler$sqDDOBeLKJVmxTCZr52/11”
修改tftp配置,啟用tftp
#vim /etc/xinetd.d/tftp將disable = yes改為:disable = no
配置DHCP
# vim /etc/cobbler/dhcp.template配置修改如下:
subnet 192.168.1.0 netmask 255.255.255.0 {option routers192.168.1.1;option domain-name-servers 114.114.114.114;option subnet-mask255.255.255.0;range dynamic-bootp10.0.0.100 10.0.0.200;下載boot-loaders
#cobbler get-loaders同步配置
#systemctl restart cobblerd#cobbler sync9、導(dǎo)入鏡像到cobbler中
#mount /dev/cdrom /mnt#cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_6410、編輯kickstart文件
#cd /var/lib/cobbler/kickstarts/#vim CentOS-7-x86_64.cfg配置文件如下:
#Kickstart Configurator for cobbler by Jason Zhao#platform=x86, AMD64, or Intel EM64T#Systemlanguagelang 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 informationclearpart --all --initlabel#Disk partitioning informationpart /boot --fstype xfs --size 1024 --ondisk sdapart swap --size 1024 --ondisk sdapart / --fstype xfs --size 1 --grow --ondisk sda#System authorization infomationauth--useshadow--enablemd5#Network information$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 information%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-toolsmysqlnmapscreen%end %postsystemctl disable postfix.service%end11、更改centos6和centos7的ks文件位置
以上關(guān)于本文的內(nèi)容,僅作參考!溫馨提示:如遇健康、疾病相關(guān)的問題,請(qǐng)您及時(shí)就醫(yī)或請(qǐng)專業(yè)人士給予相關(guān)指導(dǎo)!
「愛刨根生活網(wǎng)」www.malaban59.cn小編還為您精選了以下內(nèi)容,希望對(duì)您有所幫助:- wow各職業(yè)套裝一覽 魔獸世界90級(jí)是哪個(gè)版本
- 自己學(xué)設(shè)計(jì)房屋裝修 怎樣設(shè)計(jì)裝修風(fēng)格
- 完美裝束讓你愛上有氧操
- 藥酒能帶上高鐵嗎
- 僅銷售預(yù)包裝食品什么意思
- 瓶裝水開蓋后會(huì)變質(zhì)嗎
- 十大必看韓劇古裝 好看的韓劇大全有哪些
- 想要裝修省錢?快來抄作業(yè) 90平毛坯房裝修多少錢?
- 雨刮器怎樣拆卸和安裝 如何更換雨刮器的膠條
- 58個(gè)民族多了哪2個(gè)(56個(gè)民族及服裝
