Cobbler服务简介:
Cobbler是一个使用Python开发的开源项目,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
服务部署:Dhcp + Tftp + Apache + Kickstart + Rsync
实验环境:
一台CentOs7服务器:192.168.38.128
epel源:https://fedoraproject.org/wiki/EPEL?rd=Epel
实验过程:
一、安装实验环境
1、导入epel源(注意版本)
[root@localhost ~]# mkdir /opt/abc
[root@localhost ~]# mount.cifs //192.168.38.1/SHARE /opt/abc
[root@localhost abc]# rpm -ivh epel-release-latest-7.noarch.rpm
注:[root@localhost abc]# yum list #导入完成后可直接加载yum仓库
2、安装cobbler及相关服务的软件包
[root@localhost abc]#yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd rsync xinetd –y
二、编辑配置文件
3、编辑cobbler配置文件
[root@localhost abc]# vim /etc/cobbler/setting
next_server: 192.168.38.128 #指定cobbler地址
server: 192.168.38.128
manage_dhcp: 1 #开启dhcp服务
4、开启服务、关闭防火墙、关闭安全×××
[root@localhost abc]# systemctl stop firewalld.service
[root@localhost abc]# setenforce 0
[root@localhost abc]# systemctl start cobblerd.service
[root@localhost abc]# systemctl start httpd.service
5、查看cobbler配置
[root@localhost abc]# cobbler check
6、修改第2条
[root@localhost abc]# vim /etc/xinetd.d/tftp
disable = no
7、修改第3条
[root@localhost abc]# cobbler get-loaders
8、修改第5条
[root@localhost abc]# systemctl enable rsyncd.service
9、修改第6条
[root@localhost abc]# openssl passwd -1 -salt 'abc123' 'abc123'
将盐值加密后的密码复制放到cobbler配置文件中
[root@localhost abc]# vim /etc/cobbler/settings
default_password_crypted: "$1$abc123$9v8z2./E/PZihXrVcy3II0"
10、重启服务后再次查看
[root@localhost abc]# systemctl restart cobblerd.service
[root@localhost abc]# systemctl restart xinetd.service
[root@localhost abc]# cobbler check
11、配置DHCP后同步
[root@localhost abc]# vim /etc/cobbler/dhcp.template
[root@localhost abc]# cobbler sync
[root@localhost abc]# systemctl restart dhcpd.service
三、导入iso镜像,重启服务
12、导入iso镜像,查看结果及文件存放位置
[root@localhost abc]# mount /dev/sr0 /mnt
[root@localhost abc]# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
13、重启所有服务
[root@localhost ~]# systemctl restart cobblerd.service
[root@localhost ~]# systemctl restart dhcpd.service
[root@localhost ~]# systemctl restart xinetd.service
[root@localhost ~]# systemctl restart httpd.service