A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

本帖最后由 xiaozuoquan 于 2019-3-28 16:19 编辑

Cobbler 安装

基础部署约定基本情况
名称
详情
关闭服务
selinux

程序版本及配置文件位置


应用名称
版本
安装方式
配置文件目录
Cobbler
2.8.2
YUM
/etc/cobbler/settings
DHCP
4.2.5
YUM
/etc/cobbler/dhcpd.conf.template
Apache
2.4.6
YUM
/etc/httpd/conf.d/(cobbler.conf & cobbler_web.conf)
Xinetd
2.3.15
YUM
/etc/xinetd.conf
TFTP
5.2-13
YUM
/etc/xinetd.d/tftp
pykickstart
1.99.66
YUM
-

备注:Centos 6 中,Cobbler版本为2.6了

YUM源配置
Centos 6

#clean OS default repo

mkdir /etc/yum.repos.d/old && mv /etc/yum.repos.d/C* /etc/yum.repos.d/old/yum clean all

#add extend repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

Centos 7

#clean OS default repomk

dir /etc/yum.repos.d/old && mv /etc/yum.repos.d/C* /etc/yum.repos.d/old/yum clean all

#add extend repo

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

Cobbler服务部署YUM安装服务

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

增加服务到自启动

Centos 6 命令

chkconfig httpd onchkconfig xinetd onchkconfig dhcpd onchkconfig tftp onchkconfig cobblerd on

Centos 7 命令

systemctl enable httpdsystemctl enable xinetdsystemctl enable rsyncdsystemctl enable tftpsystemctl enable cobblerd

启动相关服务
Centos 6 命令

/etc/init.d/httpd restart/etc/init.d/xinetd restart/etc/init.d/cobblerd restart/etc/init.d/dhcpd restart

Centos 7 命令

systemctl start httpdsystemctl start xinetdsystemctl start tftpsystemctl start cobblerd

执行cobbler check
[root@cobbler yum.repos.d# cobbler checkThe following are potential configuration items that you may want to fix:


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 : change 'disable' to 'no' in /etc/xinetd.d/tftp


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.


5 : enable and start rsyncd.service with systemctl


6 : debmirror package is not installed, it will be required to manage debian deployments and repositories


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 themRestart cobblerd and then run 'cobbler sync' to apply changes.

先解决问题1、2、7

生成新的默认密码

openssl passwd -1 -salt `openssl rand 15 -base64` '123qwe!@#'$1$V0M16k3j$XMyrGlBjyCk1q.MZxQlBl.

修改setting配置文件
#sed -i 's%server: 127.0.0.1%server: 192.168.0.238%g' /etc/cobbler/settingssed -i 's%^server: 127.0.0.1%server: 192.168.0.238%g' /etc/cobbler/settingssed -i 's%^next_server: 127.0.0.1%next_server: 192.168.0.238%g' /etc/cobbler/settingssed -i 's%manage_dhcp: 0%manage_dhcp: 1%g' /etc/cobbler/settingssed -i 's%^default_password_crypted.*%default_password_crypted: "$1$V0M16k3j$XMyrGlBjyCk1q.MZxQlBl."%g' /etc/cobbler/settings

备注:cobbler为系统安装后设置的密码,请配置强密码!

配置DHCP(根据需求更改)
dhcp_conf=`grep -n "subnet 192" /etc/cobbler/dhcp.template|awk -F':' '{print $1}'`sed -i '/192.168/d' /etc/cobbler/dhcp.templatesed -i '/255.255.255.0/d' /etc/cobbler/dhcp.templatesed -i "21 i\subnet 192.168.0.0 netmask 255.255.255.0 { " /etc/cobbler/dhcp.templatesed -i "22 i\ option routers 192.168.0.1; " /etc/cobbler/dhcp.templatesed -i "23 i\ option domain-name-servers 114.114.114.114; " /etc/cobbler/dhcp.templatesed -i "24 i\ option subnet-mask 255.255.255.0; " /etc/cobbler/dhcp.templatesed -i "25 i\ range 192.168.0.100 192.168.0.200; " /etc/cobbler/dhcp.template
注释:

option routers:路由地址option domain-name-servers:DNS服务器地址option subnet-mask:子网掩码range:DHCP地址范围range dynamic-bootp:为无盘工作站准备的

解决问题3,启动tftp服务

配置TFTP

tftp_disable_conf=`grep -n disable /etc/xinetd.d/tftp|awk -F':' '{print $1}'`sed -i '/disable/d' /etc/xinetd.d/tftpsed -i "$tftp_disable_conf i\ disable = no" /etc/xinetd.d/tftp

解决问题5
Centos 6

rsync_disable_conf=`grep -n disable /etc/xinetd.d/rsync|awk -F':' '{print $1}'`sed -i '/disable/d' /etc/xinetd.d/rsyncsed -i "$rsync_disable_conf i\ disable = no" /etc/xinetd.d/rsync
备注:这个问题可以忽略,在Centos 6下未解决

Centos 7

systemctl enable rsyncd.service

解决问题4,可能解析失败,重新执行
cobbler get-loaders

问题8,待补充(真机电源管理)
问题6为deban包,不需要处理

重启cobbler服务并同步改变
systemctl restart cobblerd

cobbler check




0 个回复

您需要登录后才可以回帖 登录 | 加入黑马