1. 程式人生 > >Linux運維學習之cobbler自動安裝系統

Linux運維學習之cobbler自動安裝系統

cobbler 自動

本篇博文是使用cobbler的小工具來實現我們的系統的自動安裝,說這個工具小吧,其實它其中包含了很多的工具,當然了我們需要使用epel源來實現我們的安裝,epel的源的修改地址在/etc/yum.repos.d/下,我們可以把自己想配置的epel源或者本地倉庫的修改文件放在這下面,通過yum clean all,yum makecache,yum repolist,來進行一系列操作。

當我們通過epel源安裝之後,我們可以打開我們的這幾個工具(dhcpd cobblerd httpd tftp)的開機啟動,部分工具立即啟動,因為dhcp需要配置,所以在配置好之前還不能使其啟動,我使用的是centos7的系統,所以

systemctl enable dhcpd cobblerd httpd tftp //開機啟動
systemctl start cobblerd httpd tftp        //立即啟動

檢查cobbler換將,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 : For PXE to be functional, the ‘next_server’ field in /etc/cobbler/settings must be set
to something other than 127.0.0.1, and should match the IP of the boot server on the
PXE network.
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 : change ‘disable’ to ‘no’ in /etc/xinetd.d/rsync
5 : comment ‘dists’ on /etc/debmirror.conf for proper debian support
6 : comment ‘arches’ on /etc/debmirror.conf for proper debian support
7 : 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
8 : fencing tools were not found, and are required to use the (optional) power
management features. install cman or fence-agents to use them

解決方法:在文件/etc/cobbler/settings下修改這些內容,其中的密碼我生成的是123

vim /etc/cobbler/settings
default_password_crypted: "$1$9/k4QnLN$RpMDw8oILNAfkpOA2Qkth."  #openssl passwd -1生成口令
next_server: 192.168.91.127
server: 192.168.91.127
manage_dhcp: 1
保存退出
systemctl restart cobblerd

獲取相關的啟動文件

聯網:
cobbler get-loaders #聯網情況下會自動獲取這兩個文件到指定目錄
不聯網:
cp /usr/share/syslinux/{pxelinux.0,menu.c32} /var/lib/tftpboot/

修改dhcp的配置文件

vim /etc/cobbler/dhcp.template 
subnet 192.168.91.0 netmask 255.255.255.0 {
range dynamic-bootp        192.168.91.100 192.168.91.254;
cobbler sync
systemctl start dhcpd #啟動dhcp

管理distro

cobbler import --path=/misc/cd/ --name=centos7.3
cobbler distro list

設置cobbler的各個屬性

cp /root/ks7.cfg  /var/lib/cobbler/kickstarts/
cobbler profile add --name=centos7.3-x86_64-desktop  --distro=centos7.3-x86_64 --kickstar
t=/var/lib/cobbler/kickstarts/ks7.cfg
cobbler profile list
cobbler profile remove --name=centos7.3-x86_64

然後我們新建虛擬機,並在其網絡上選擇和試驗機一個網段的僅主機模式,然後開機選擇network boot from Inter E1000。

Linux運維學習之cobbler自動安裝系統