PXE服务支持
DHCP服务管理
DNS服务管理(可选bind,dnsmasq)
Kickstart服务支持
YUM仓库管理
TFTP(PXE启动时需要)
Apache(提供kickstart的安装源,并提供定制化的kickstart配置)
cobbler check //核对当前设置是否有问题
cobbler list //列出所有的cobbler元素
cobbler report //列出元素的详细信息
cobbler sync //同步配置到数据目录,更改配置最好都要执行下
cobbler reposync //同步yum仓库
cobbler distro //查看导入的发行版系统信息
cobbler system //查看添加的系统信息
cobbler profile //查看配置信息
[root@promote opt]# rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm #下载epel源
[root@promote opt]# cd /etc/yum.repos.d/
[root@promote yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo epel-testing.repo
CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo epel.repo
##此处已经有了epel源,可以安装cobbler和相关软件包
[root@promote /]# yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd xinetd
[root@promote /]# cd /etc/cobbler/ #查看cobbler配置文件
[root@promote cobbler]# ls
auth.conf dnsmasq.template modules.conf reporting tftpd.template zone_templates
cheetah_macros genders.template mongodb.conf rsync.exclude users.conf
cobbler_bash import_rsync_whitelist named.template rsync.template users.digest
completions iso power secondary.template version
dhcp.template ldap pxe settings zone.template
[root@promote cobbler]# vim settings #主配置文件
manage_dhcp: 1 #开启托管DHCP服务
......
next_server: 192.168.10.10 # 提供tftp服务的地址
......
server: 192.168.10.10
[root@promote cobbler]# iptables -F #开启httpd和cobbler服务,关闭防火墙
[root@promote cobbler]# setenforce 0
[root@promote cobbler]# systemctl start httpd
[root@promote cobbler]# systemctl start cobblerd
[root@promote cobbler]# cobbler check ##检查
The following are potential configuration items that you may want to fix:
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 : change 'disable' to 'no' in /etc/xinetd.d/tftp
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 : 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
7 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
Restart cobblerd and then run 'cobbler sync' to apply changes.
#可以看到需要优化的项目,其中第一条已经关闭。
[root@promote cobbler]# vim /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no ##改成no
per_source = 11
cps = 100 2
flags = IPv4
}
[root@promote cobbler]# systemctl start rsyncd
[root@promote cobbler]# openssl passwd -1 -salt '123123' '123123' ##生成盐值加密,密码为123123
$1$123123$MAV.kVI/b3swmFLErPD2b0 ##加密后的密码
[root@promote cobbler]# vim /etc/cobbler/settings
......
# cobbler has various sample kickstart templates stored
# in /var/lib/cobbler/kickstarts/. This controls
# what install (root) password is set up for those
# systems that reference this variable. The factory
# default is "cobbler" and cobbler check will warn if
# this is not changed.
# The simplest way to change the password is to run
# openssl passwd -1
# and put the output between the "" below.
default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac." ##将密文复制到配置文件中使用
[root@promote cobbler]# systemctl restart rsyncd
[root@promote cobbler]# systemctl restart xinetd.service
[root@promote cobbler]# systemctl restart cobblerd
[root@promote cobbler]# vim /etc/cobbler/dhcp.template
......
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.10.0 netmask 255.255.255.0 { ##改成当前的地址
option routers 192.168.10.1; #网关
option domain-name-servers 192.168.10.2; #dns服务
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.10.100 192.168.10.200; #地址池
[root@promote cobbler]# cobbler sync ##同步服务
[root@promote cobbler]# vim /etc/dhcp/dhcpd.conf #查看dhcp服务
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Mon Jul 20 03:19:49 2020)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be #显示不能更改,被cobbler控制
[root@promote cobbler]# cobbler get-loaders #下载镜像文件
[root@promote cobbler]# mount /dev/sr0 /mnt #挂载光盘
mount: /dev/sr0 写保护,将以只读方式挂载
[root@promote cobbler]# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
##导入镜像
[root@promote cobbler]# cd /var/www/cobbler/ks_mirror/
[root@promote ks_mirror]# ls
CentOS-7-x86_64 config ##导入成功
[root@promote ks_mirror]# cobbler list
distros:
CentOS-7-x86_64
profiles:
CentOS-7-x86_64
systems:
repos:
images:
mgmtclasses:
packages:
files:
[root@promote ks_mirror]# systemctl restart cobblerd
[root@promote ks_mirror]# systemctl restart dhcpd
[root@promote ks_mirror]# systemctl restart xinetd.service
[root@promote ks_mirror]# systemctl restart httpd.service
[root@promote ks_mirror]# htdigest -c /etc/cobbler/users.digest Cobbler zhangsan #创建一个用户名为zhangsan的用户
Adding password for zhangsan in realm Cobbler.
New password:
Re-type new password:
[root@promote ks_mirror]# systemctl restart cobblerd #重启服务
[root@promote ks_mirror]# systemctl restart httpd
[root@promote ks_mirror]# vim /etc/cobbler/modules.conf
[authentication]
module = authn_pam #添加pam模块
......
[authorization]
module = authz_ownership
[root@promote ks_mirror]# useradd webuser #创建用户
[root@promote ks_mirror]# passwd webuser
更改用户 webuser 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@promote ks_mirror]# vim /etc/cobbler/users.conf
[admins]
admin = ""
cobbler = ""
webuser = "" #将用户添加到cobbler的用户配置文件中
[root@promote ks_mirror]# systemctl restart cobblerd #重启服务
[root@promote ks_mirror]# systemctl restart httpd