成功最有效的方法就是向有经验的人学习!

CentOS7安装配置Cobbler

为什么需要自动布署

让自动化变得简单,让整个安装变得非常的智能
使用一个以前定义的模板来配置DHCP服务(如果启用了管理DHCP)
将一个存储库(yum或rsync)建立镜像或解压缩一个媒介,以注册一个新操作系统
在DHCP配置文件中为需要安装的机器创建一个条目,并使用您指定的参数(IP,MAC)
在TFTP服务目录下创建适当的PXE文件
重新启动DHCP服务以反映更改
重新启动机器以开始安装(如果电源管理已启用)

开始安装

服务器IP:10.0.0.210
rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm

安装后会在/etc/yum.repos.d下创建一个epel.repo文件

yum install -y httpd dhcp tftp bind bind-chroot caching-nameserver xinetd python-ctypes cobbler cobbler-web

systemctl start httpd
systemctl start xinetd
systemctl start  cobblerd
systemctl start rsyncd
cobbler check

cd /etc/httpd/conf.d/

cobbler在目录中创建了些配置文件
-rw-r--r--. 1 root root 2926 Jun 27 21:48 autoindex.conf
-rw-r--r--. 1 root root 1087 May 28 20:41 cobbler.conf
-rw-r--r--. 1 root root 1165 May 28 20:43 cobbler_web.conf
-rw-r--r--. 1 root root  401 Dec  2  2017 fcgid.conf
-rw-r--r--. 1 root root  323 Jun 27 02:07 manual.conf
-rw-r--r--. 1 root root  366 Jun 27 21:49 README
-rw-r--r--. 1 root root 9443 Jun 27 02:07 ssl.conf
-rw-r--r--. 1 root root 1252 Jun 27 02:07 userdir.conf
-rw-r--r--. 1 root root  824 Jun 27 02:07 welcome.conf

systemctl start httpd   #启动apache   cobbler通过APACHE对外提供服务

systemctl start cobblerd.service  #启动cobbler
cobbler check  #检查cobbler配置
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
  File “/usr/lib/python2.7/site-packages/cobbler/cli.py”, line 251, in check_setup
    s.ping()
  File “/usr/lib64/python2.7/xmlrpclib.py”, line 1233, in __call__
    return self.__send(self.__name, args)
  File “/usr/lib64/python2.7/xmlrpclib.py”, line 1591, in __request
    verbose=self.__verbose
  File “/usr/lib64/python2.7/xmlrpclib.py”, line 1273, in request
    return self.single_request(host, handler, request_body, verbose)
  File “/usr/lib64/python2.7/xmlrpclib.py”, line 1321, in single_request
    response.msg,
ProtocolError: <ProtocolError for 127.0.0.1:80/cobbler_api: 503 Service Unavailable>
报错了,很经典的错
iptables -vnL   #执行一看居然开着的。
iptables -F
iptables -t nat -F
systemctl stop firewalld
systemctl disable firewalld
vim /etc/selinux/config
setenforce 0

配置Cobbler

vim /etc/cobbler/settings
272行    next_server 127.0.0.1—->next_server: 10.0.0.210
384行    server: 127.0.0.1—->server: 10.0.0.210
vim /etc/xinetd.d/tftp
disable                 = yes
改为
disable                 = no
cobbler get-loaders #下载网络安装相关的文件
设置一个密码,客户机安装好以后root的默认的密码
openssl passwd -1 -salt ‘random-phrase-here’ ‘your-password-her’
                                         随机值,加密密码用的       要设置的密码
执行后会生成一个密码,复制下来。
vim /etc/cobbler/settings
101行,将复密的密码放在引号里
default_password_crypted: “$1$guilin$eldXr2DHHmz.kDXrH8mwx0”
systemctl restart cobblerd.service
再次检查
cobbler check
接着配置
开启DHCP,COBBLER可以管理DHCP,一般也建议让COBBLER管理DHCP
vim /etc/cobbler/settings
242行    manage_dhcp: 0改为 manage_dhcp: 1
修改DHCP模板文件
vim /etc/cobbler/dhcp.template
我们只需要修改这个模板文件,修改完后它会自动帮我们生成DHCP配置文件
修改21号到25行的IP信息
subnet 10.0.0.0 netmask 255.255.255.0 {
     option routers             10.0.0.254;
     option domain-name-servers 223.5.5.5;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        10.0.0.10 10.0.0.50;
systemctl restart cobblerd.service  #重启cobbler
cobbler sync  #自动生成DHCP配置文件,自动重启DHCP
可以去/etc/dhcp/dhcpd.conf中查看,可以看到
# ******************************************************************
# Cobbler managed dhcpd.conf file
# generated from cobbler dhcp.conf template (Thu Aug 30 00:49:22 2018)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
# ******************************************************************
导入操作系统镜像
准备一个光盘,我这里用的是centos7
然后将光盘挂载
mount /dev/cdrom /mnt
cobbler import –path=/mnt/ –name=CentOS-7-x86_64 –arch=x86_64
               导入                 路径                   名称                          架构64位还是32位
它会将文件导入到:/var/www/cobbler/ks_mirror/
[root@localhost ks_mirror]# pwd
/var/www/cobbler/ks_mirror
[root@localhost ks_mirror]# ll
total 0
drwxr-xr-x  8 root root 254 May  4 04:54 CentOS-7-x86_64
drwxr-xr-x. 2 root root   6 May 28 20:41 config

再导入一个centos6的镜像

mount /dev/cdrom /mnt
cobbler import –path=/mnt/ –name=CentOS-6-x86_64 –arch=x86_64
cobbler profile  #执行这个命令,它会告诉我们都有哪些命令
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report
[root@localhost ~]# cobbler profile list
   CentOS-6-x86_64
   CentOS-7-x86_64
可以用cobbler profile report查看配置文件
使用cobbler profile edit –name=CentOS-7-x86_64 –kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x86_64.cfg
编辑配置文件我们统一放在/var/lib/cobbler/kickstarts/
让网卡名变成eth0: cobbler profile edit –name=CentOS-7-x86_64 –kopts=’net.ifnames=0 biosdevname=0′
可以用cobbler profile report再次查看配置
cobbler sync同步配置,使所有配置重新生成并生效

使用cobbler进行LINUX安装

/sbin/dmsquash-live-root:line286:printf:write error:no space left on device
内存不足,增加客户机内存最少为2G
参考:https://access.redhat.com/solutions/3353961
Issue
Provisioning a system via kickstart using Red Hat Satellite fails with the below error:
dracut-initqueue[552]: /sbin/dmsquash-live-root: line 273: printf: write error: No space left on device
Resolution
In the compute profile for the affected Compute Resource, increase the value of the memory to 2048 MB and then provision a system.
Root Cause
The memory defined for the system is not sufficient hence it is unable to process/download the live image.
Minimum of 2GB of memory should be allocated.

深入理解Cobbler

赞(1) 打赏
未经允许不得转载:竹影清风阁 » CentOS7安装配置Cobbler
分享到

大佬们的评论 抢沙发

全新“一站式”建站,高质量、高售后的一条龙服务

微信 抖音 支付宝 百度 头条 快手全平台打通信息流

橙子建站.极速智能建站8折购买虚拟主机

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码

注册