環境:python
平臺:VMware workstation 14linux
系統:CentOS Linux release 7.4.1708 (Core)git
NAT模式 github
systemctl stop firewalld.service //關閉防火牆
setenforce 0 //關閉加強安全功能web
光盤掛載安全
---服務器
cobbler大平臺,管理一切裝機操做服務app
Cobbler服務 自動部署裝機
dhcp 自動分配ip地址使新機器和服務器在同一個段落互聯互通
tftp 壓縮內核 引導程序 (速度快)
ftp iso鏡像文件dom
操做:ide
-----------------Cobbler--------------------
rpm -ivh http://mirrors.yun-idc.com/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
yum list
yum clean all
yum makecache
-------------------正式部署----------------------------------
yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd -y
注:cobbler 服務
cobbler-web 經過網頁形式進行管理
pykickstart 用python開發的kickstart
httpd 檢測文件是否安裝
rsync 同步管理
xinetd 管理平臺,管理tftp和xinetd
vi /etc/cobbler/settings //修改cobbler配置文件
272 next_server: 192.168.80.181 //指定PXE位置
384 server: 192.168.80.181 //tftp服務器
242 manage_dhcp: 1 //管理dhcp啓動
101 default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." 這個就是給客戶端裝機後的root密碼,鹽值加密 (先不作修改下面在修改)
systemctl start httpd
systemctl start cobblerd
cobbler check
--------------------提示內容:須要優化-----------
The following are potential configuration items that you may want to fix:
1 : SELinux is enabled. Please review the following wiki page for detailson ensuring cobbler works correctly in your SELinux environment:
https://github.com/cobbler/cobbler/wiki/Selinux
2 : change 'disable' to 'no' in /etc/xinetd.d/tftp
3 : Some network boot-loaders are missing from /var/lib/cobbler/loaders, ou may run 'cobbler get-loaders' to download them, or, if you only want t handle x86/x86_64 netbooting, you may ensure that you have installed a *ecent* version of the syslinux package installed and can ignore this messge entirely. Files in this directory, should you want to support all arcitectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. Th 'cobbler get-loaders' command is the easiest way to resolve these requirments.
4 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage deban deployments and repositories
6 : The default password used by the sample templates for newly installedmachines (default_password_crypted in /etc/cobbler/settings) is still setto 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'randomphrase-here' 'your-password-here'" to generate new one
7 : fencing tools were not found, and are required to use the (optional) ower management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
----------------------------------------------------------------------------------------------------------------------------------------
先設置密碼
openssl passwd -1 -salt 'abner' 'abner' //鹽值加密
【使用上一條命令後,會彈出一條加密的結果】 //加密結果注:若是tab鍵補不全,就用yum安裝
繼續回settings文件中
default_password_crypted: "加密結果" //粘貼
保存退出settings文件
systemctl start rsyncd //啓動服務
vi /etc/xinetd.d/tftp
disable = no //啓用
systemctl restart xinetd //重啓服務
vi /etc/cobbler/dhcp.template //cobbler控制的dhcp服務模板
option routers //修改網關
option domain-name-servers //修改DNS
option subnet-mask 255.255.255.0;
range dynamic-bootp //修改地址池cobbler sync //幫助同步生成DHCP配置文件 同步到dhcp服務裏去
cobbler get-loaders //下載引導操做系統文件
systemctl restart dhcpd
systemctl restart xinetd
systemctl restart rsyncd
------------------使用cobbler check再次檢查----------
下面三條能夠忽略不去處理
-----------------------------------------------------------------
/var/log/cobbler/cobbler.log //日誌文件所在位置
cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64 //導入iso鏡像,命名爲 ,指定系統多少位
注:iso鏡像必定要先掛載到/mnt下面
能夠導入多個鏡像。
/var/www/cobbler/ks_mirror/CentOS-7-x86_64 //默認導入存放位置
cobbler list //查看導入結果cobbler distro list //查看發行版本
yum install tree -y
tree /var/lib/tftpboot/
tree /var/lib/tftpboot/images //查看內核和初始化文件在tftp server 共享目錄
cobbler profile report
![]()
/var/lib/cobbler/kickstarts/sample_end.ks //ks默認文件存放位置
systemctl restart dhcpd
systemctl restart xinetd
systemctl restart rsyncd
systemctl restart cobblerd
測試裝機:
從新新建一臺虛擬機
開啓以後效果以下:
(不須要點擊任何東西,等待裝機就ok)
完成。