cobble 官網
http://cobbler.github.io/
快速入門
http://cobbler.github.io/manuals/quickstart/
Web 通路
http://cobbler.github.io/manuals/2.8.0/5_-_Web_Interface.html
更新EPEL使用淘寶源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
安裝Cobbler
yum install -y httpd tftp dhcp cobbler cobbler-web pykickstart
rpm -ql cobbler
/etc/cobbler # 配置檔案目錄
/etc/cobbler/settings # cobbler主配置檔案,這個檔案是YAML格式,Cobbler是python寫的程式。
/etc/cobbler/dhcp.template # DHCP服務的配置模闆
/etc/cobbler/tftpd.template # tftp服務的配置模闆
/etc/cobbler/rsync.template # rsync服務的配置模闆
/etc/cobbler/iso # iso模闆配置檔案目錄
/etc/cobbler/pxe # pxe模闆檔案目錄
/etc/cobbler/power # 電源的配置檔案目錄
/etc/cobbler/users.conf # Web服務授權配置檔案
/etc/cobbler/users.digest # 用于web通路的使用者名密碼配置檔案
/etc/cobbler/dnsmasq.template # DNS服務的配置模闆
/etc/cobbler/modules.conf # Cobbler子產品配置檔案
/var/lib/cobbler # Cobbler資料目錄
/var/lib/cobbler/config # 配置檔案
/var/lib/cobbler/kickstarts # 預設存放kickstart檔案
/var/lib/cobbler/loaders # 存放的各種引導程式
/var/www/cobbler # 系統安裝鏡像目錄
/var/www/cobbler/ks_mirror # 導入的系統鏡像清單
/var/www/cobbler/images # 導入的系統鏡像啟動檔案
/var/www/cobbler/repo_mirror # yum源存儲目錄
/var/log/cobbler # 日志目錄
/var/log/cobbler/install.log # 用戶端系統安裝日志
/var/log/cobbler/cobbler.log # cobbler日志
systemctl start httpd cobblerd
systemctl status httpd cobblerd
systemctl enable httpd cobblerd
部署校驗
這貨有一個自我檢查的指令,可以知道在部署前還需要解決哪些問題
cobbler check
還有9個問題要處理,容我處理下
設定伺服器IP
The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
vi /etc/cobbler/settings
cat /etc/cobbler/settings | grep -v ^# | grep -v ^$
改3個地方
bind_master: 192.168.10.10
next_server: 192.168.10.10
server: 192.168.10.10
禁用SELinux
SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:
https://github.com/cobbler/cobbler/wiki/Selinux
systemctl stop firewalld
systemctl disable firewalld
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
grep SELINUX=disabled /etc/selinux/config
setenforce 0
開啟TFTP
change 'disable' to 'no' in /etc/xinetd.d/tftp
vi /etc/xinetd.d/tftp
開啟rsync
enable and start rsyncd.service with systemctl
systemctl start rsyncd
systemctl enable rsyncd
安裝fencing
fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
yum install -y fence-agents
systemctl restart cobblerd
cobbler check
剩下4個問題
下載下傳啟動程式
Some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
cobbler get-loaders
安裝大便鏡像package
debmirror package is not installed, it will be required to manage debian deployments and repositories
yum install -y debmirror.noarch
The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one
openssl passwd -1 -salt 'random-phrase-here' '12345.com'
$1$random-p$N2Gta7Jon4dskSI6zKe5C1
把default_password_crypted 替換成新密碼
cobbler sync還剩下2個問題
vi /etc/debmirror.conf
2行注釋拿掉
應用配置檔案
systemctl restart cobblerd
cobbler sync
all system go
開啟dhcp和pxe
sed -i 's/manage_dhcp: 0/manage_dhcp: 1/g' /etc/cobbler/settings
cat /etc/cobbler/settings | grep manage_dhcp
sed -i 's/pxe_just_once: 0/pxe_just_once: 1/' /etc/cobbler/settings
cat /etc/cobbler/settings |grep pxe_just
設定dhcp ip 位址池
cp /etc/cobbler/dhcp.template /etc/cobbler/dhcp.template.original
vi /etc/cobbler/dhcp.template
systemctl restart dhcpd
systemctl enable dhcpd
挂載鏡像
mount -t iso9660 -o ro /dev/cdrom /mnt導入鏡像
cobbler import --path=/mnt/ --name=CentOS-7.5-x86_64 --arch=x86_64
cobbler distro list ls /var/www/cobbler/ks_mirror/檢視鏡像檔案資訊
cobbler list
cobbler distro report --name=CentOS-7.5-x86_64
修改網卡配置,因為cenos 7之後網卡從eth0變成ens打頭的了
cobbler profile report
cobbler profile edit --name=CentOS-7.5-x86_64 --kopts='net.ifnames=0 biosdevname=0'
cobbler profile report --name=CentOS-7.5-x86_64
同步下資料自定義pxe菜單
vi /etc/cobbler/pxe/pxedefault.template
眼睛一閉就好了直接指定IP和MAC 綁定某一個安裝菜單
cobbler system add --name=CentOS --mac=00:0C:29:D6:4F:57 --profile=CentOS-7.5-x86_64 --ip-address=192.168.10.100 --subnet=255.255.255.0 --gateway=192.168.10.2 --interface=eth0 --static=1 --hostname=linux_node --name-servers="8.8.8.8"
同步資料
cobbler system list
問題 找不到boot,磁盤空間不足
容我修個錯誤
https://access.redhat.com/solutions/3353961
Root Cause
- The memory defined for the system is not sufficient hence it is unable to process/download the live image.
- Minimum of 2GB of memory should be allocated.
虛拟機給2G記憶體搞定
問題 禁止PXE
cobbler profile edit --name=CentOS-7.5-x86_64 --enable-gpxe=False