天天看點

Cobbler安裝centos7

1.安裝cobbler

yum update -y
yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm -y
yum install cobbler cobbler-web dhcp debmirror pykickstart fence-agents -y
           

 2.啟用cobbler服務并設定開機啟動

systemctl start cobblerd httpd rsyncd tftp
systemctl enable cobblerd httpd rsyncd tftp
           

 3.通路cobbler,初始賬号密碼都是cobbler

 4.設定安裝系統的root密碼

openssl passwd -1 -salt 'root' 'bzhantest'
$1$root$.gzVksjqp.P3KiqnIaJG6/
           

5.設定cobbler配置檔案

vim /etc/cobbler/settings
default_password_crypted: "$1$root$.gzVksjqp.P3KiqnIaJG6/"
server: 192.168.40.131
next_server: 192.168.40.131
manage_dhcp: 1
           

 6.配置debmirror.conf

sed -i 's/@dists="sid";/#@dists="sid";/g' /etc/debmirror.conf
sed -i 's/@arches="i386";/#@arches="i386";/g' /etc/debmirror.conf
           

 7.配置tftp

vim /etc/xinetd.d/tftp
disable               = no
           

 8.下載下傳引導檔案

cobbler get-loaders
# cobbler get-loaders (成功如下)
task started: 2020-05-06_164813_get_loaders
task started (id=Download Bootloader Content, time=Wed May  6 16:48:13 2020)
path /var/lib/cobbler/loaders/README already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.elilo already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.yaboot already exists, not overwriting existing content, use --force if you wish to update
path /var/lib/cobbler/loaders/COPYING.syslinux already exists, not overwriting existing content, use --force if you wish to update
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
*** TASK COMPLETE ***
           

 會報錯

//原因是因為python的字元集編碼不一緻造成的
//解決辦法如下
[[email protected] /]# cat >> /usr/lib/python2.7/site-packages/sitecustomize.py  <<EOF
# encoding=utf8 
import sys
reload(sys)
sys.setdefaultencoding('utf8')
EOF
//然後reboot
           

 9.編輯dhcp檔案(根據實際情況改)

vim /etc/cobbler/dhcp.template
subnet 192.168.49.0 netmask 255.255.255.0 {
     option routers             192.168.49.2;
     option domain-name-servers 223.5.5.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.49.100 192.168.49.254;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;
           

10.重新開機cobbler并同步

systemctl restart cobblerd
cobbler sync
           

11.檢查 (根據提示來)

# cobbler check
1 : 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.
2 : 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.

Restart cobblerd and then run 'cobbler sync' to apply changes.
# cobbler check(成功如下)
No configuration problems found.  All systems go.
           

 12.cobbler驗證

# cobbler validateks
task started: 2020-05-06_164644_validateks
task started (id=Kickstart Validation, time=Wed May  6 16:46:44 2020)
*** all kickstarts seem to be ok ***
*** TASK COMPLETE ***
           

 13、下載下傳centos7鏡像,挂在到/mnt/iso下,并導入到cobbler

mkdir /mnt/iso
mount CentOS-7-x86_64-Everything-1810.iso /mnt/iso
cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS7
           

 14.回到cobbler網頁,點選kickstart templates,建立ks模闆。

Cobbler安裝centos7

 15.centos7安裝模闆

# CentOS 7 minimal(放到名稱那一欄)

text
install
bootloader --location=mbr
zerombr
auth --useshadow --passalgo=sha512
rootpw --iscrypted $default_password_crypted
firewall --disable
selinux --disabled
firstboot --disable
keyboard us
lang en_US
timezone Asia/Shanghai
url --url=$tree
$SNIPPET('network_config')
clearpart --all --initlabel
part /boot --fstype="xfs" --size=512
part swap --fstype="swap" --size=1024
part / --fstype="xfs" --grow --size=1
reboot

%pre
$SNIPPET('log_ks_pre')
$SNIPPET('kickstart_start')
$SNIPPET('pre_install_network_config')
$SNIPPET('pre_anamon')
%end

%packages
@^minimal
@core
kexec-tools
%end
           
Cobbler安裝centos7
Cobbler安裝centos7
Cobbler安裝centos7

 17.配置一台機器從網卡啟動看效果(注意記憶體給大一點,不然不成功)

Cobbler安裝centos7

https://www.cnblogs.com/ops-sylar/p/8243929.html

http://www.178linux.com/15099   有提元件

https://www.cnblogs.com/edenlong/p/10146446.html   foreman容器化部署圖形操作,有待實驗

https://www.cnblogs.com/zhangxingeng/p/9702625.html  centos7+cobbler+kickstart

https://www.cnblogs.com/zhangxingeng/p/10268171.html#auto_id_15     Centos7+puppet+foreman,圖形實作部署OS 

繼續閱讀