Cobbler部署

一、關(guān)閉selinux

1、修改配置

vim /etc/selinux/config

SELINUX=enforcing

SELINUXTYPE=targeted

SELINUX=disabled

2、配置生效

setenforce 0

二、關(guān)閉防火墻

systemctl stop firewalld
systemctl disable firewalld

三、安裝Cobbler

1.安裝最新的epel庫(kù)

rpm -Uvh https://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm

rpm -ivh http://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

2.安裝Cobbler以及相關(guān)的包

yum install cobbler cobbler-web pykickstart xinetd dhcp dnsmasq syslinux -y

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

3.啟動(dòng)Cobbler及其他服務(wù)

systemctl enable cobblerd

systemctl start cobblerd

systemctl enable httpd

systemctl start httpd

systemctl enable xinetd

systemctl start xinetd

Cobbler-Web提供了一個(gè)網(wǎng)站管理服務(wù),默認(rèn)用戶名和密碼都是"cobbler",Web瀏覽地址可以通過(guò)以下鏈接: https://172.18.50.30/cobbler_web //注意是https

四、配置Cobbler

1、設(shè)置文件里的default_password_crypted控制在kickstart過(guò)程中的新系統(tǒng)的超級(jí)用戶口令

openssl passwd -1

生成系統(tǒng)的root用戶密碼
$1$Ve0a/FjX$GmL.ZpJYdvFPoYdpT1Zqb1

2、修改/etc/cobbler/settings配置

vim /etc/cobbler/settings

default_password_crypted: "$1$Ve0a/FjX$GmL.ZpJYdvFPoYdpT1Zqb1"
manage_dhcp: 1
manage_dns: 1
next_server: 172.168.50.30(主機(jī)名)
pxe_just_once: 1
server: 172.168.50.30(主機(jī)名)

3、修改/etc/xinetd.d/tftp配置

vim /etc/xinetd.d/tftp

disable = no

4、修改/etc/cobbler/dhcp.template配置

subnet 172.18.50.0 netmask 255.255.255.0 {
option routers 172.18.50.254; #網(wǎng)關(guān)
option domain-name-servers 61.139.2.69; #DNS
option subnet-mask 255.255.255.0; #子網(wǎng)掩碼
range dynamic-bootp 172.18.50.35 172.18.50.39; #ip范圍
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}

}

5、修改/etc/cobbler/dnsmasq.template配置一個(gè)簡(jiǎn)單的DHCP server

vim /etc/cobbler/dnsmasq.template

...
...
read-ethers
addn-hosts = /var/lib/cobbler/cobbler_hosts

dhcp-range=172.18.50.35,172.18.50.39
dhcp-option=3,$next_server
dhcp-lease-max=1000
dhcp-authoritative
dhcp-boot=pxelinux.0
dhcp-boot=net:normalarch,pxelinux.0
dhcp-boot=net:ia64,$elilo

$insert_cobbler_system_definitions

6、檢查及同步Cobbler

systemctl restart cobblerd

cobbler check (這個(gè)命令幫助檢測(cè)Cobbler配置目前仍然存在的問(wèn)題,根據(jù)提示修改這些問(wèn)題,然后重啟cobbler即可)

注:這里cobbler check 遇到的有:

1 : 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
2 : named is not installed and/or in path
3 : 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.
4 : enable and start rsyncd.service with systemctl
5 : debmirror package is not installed, it will be required to manage debian deployments and repositories
6 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

 解決:
1、關(guān)閉selinux,前面已經(jīng)改過(guò),先忽略

2、yum install bind -y

3、cobbler get-loaders

4、systemctl enable rsyncd
   systemctl start rsyncd

5、rpm -Uvh ftp://rpmfind.net/linux/epel/6/x86_64/debmirror-2.14-2.el6.noarch.rpm  --nodeps --force

   修改debmirror配置/etc/debmirror.conf

   vim /etc/debmirror.conf

   #@dists="sid";  #注釋
   #@arches="i386";  #注釋

6、yum install fence-agents -y

systemctl restart cobblerd
cobbler sync

五、導(dǎo)入Distribution

mkdir /mnt/iso
mount -o loop /dev/cdrom /mnt/iso #也可以掛載iso文件
cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS-7
cobbler distro list
cobbler profile list
cobbler distro report --name=CentOS-7-x86_64 #顯示詳細(xì)信息

六、刪除導(dǎo)入的系統(tǒng)

cobbler profile find --distro=CentOS-7-x86_64 #查看配置是否存在

cobbler profile remove --name=CentOS-7-x86_64 #刪除配置文件

cobbler distro remove --name=CentOS-7-x86_64 #刪除distro

cobbler profile find --distro=CentOS-7-x86_64 #再查看配置已無(wú)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容