Cobbler部署

一、關閉selinux

1、修改配置

vim /etc/selinux/config

SELINUX=enforcing

SELINUXTYPE=targeted

SELINUX=disabled

2、配置生效

setenforce 0

二、關閉防火墻

systemctl stop firewalld
systemctl disable firewalld

三、安裝Cobbler

1.安裝最新的epel庫

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以及相關的包

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

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

3.啟動Cobbler及其他服務

systemctl enable cobblerd

systemctl start cobblerd

systemctl enable httpd

systemctl start httpd

systemctl enable xinetd

systemctl start xinetd

Cobbler-Web提供了一個網站管理服務,默認用戶名和密碼都是"cobbler",Web瀏覽地址可以通過以下鏈接: https://172.18.50.30/cobbler_web //注意是https

四、配置Cobbler

1、設置文件里的default_password_crypted控制在kickstart過程中的新系統的超級用戶口令

openssl passwd -1

生成系統的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(主機名)
pxe_just_once: 1
server: 172.168.50.30(主機名)

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; #網關
option domain-name-servers 61.139.2.69; #DNS
option subnet-mask 255.255.255.0; #子網掩碼
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配置一個簡單的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 (這個命令幫助檢測Cobbler配置目前仍然存在的問題,根據提示修改這些問題,然后重啟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、關閉selinux,前面已經改過,先忽略

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

五、導入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 #顯示詳細信息

六、刪除導入的系統

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 #再查看配置已無

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容