cobbler安装步骤记录

 

安装步骤
一.安装epel源
[root@linux-node1 ~]# rpm -ivh https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
Retrieving https://mirrors.aliyun.com/epel/epel-release-latest-7.noarch.rpm
warning: /var/tmp/rpm-tmp.cm5Tmb: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:epel-release-7-9 ################################# [100%]
[root@linux-node1 ~]# ll /etc/yum.repos.d/epel
epel.repo epel-testing.repo


二.开始安装cobbler

1.安装cobbler环境所需的包

[root@linux-node1 ~]# yum -y install httpd dhcp tftp python-ctypes cobbler xinetd pykickstart
。。。。。
Nothing to do

2.启动服务

[root@linux-node1 ~]# systemctl start httpd
[root@linux-node1 ~]# systemctl enable httpd
[root@linux-node1 ~]# systemct1 enable cobblerd
[root@linux-node1 ~]# systemctl start cobblerd

关闭防火墙和SElinux功能
[root@linux-node1 ~]#systemctl disable firewalld.service
[root@linux-node1 ~]#systemctl stop firewalld.service

[root@linux-node1 ~]#setenforce 0

 


3.看看哪些配置文件没有改,下面的工做就是要处理掉这些提示信息。这样cobbler就可以正常工做了。
[root@linux-node1 ~]# cobbler check
列出一堆。。。。省略 以下(5,6,7,8均为解决配置的问题)

4.修改配置文件
[root@linux-node1 ~]# vim /etc/cobbler/settings
server: 192.168.56.11 # 把这些地址都改成本机的IP
next_server: 192.168.56.11

pxe_just_once: 1 #避免重复安装

 

5.配置cobbler的密码 ,密码为2023
[root@linux-node1 ~]# openssl passwd -1 -salt '123' 2023'
生成密码

[root@linux-node1 ~]# vim /etc/cobbler/settings
default_password_crypted: "生成密码"


6.修改xinetd的配置文件以及启动和启动rsyn
[root@linux-node1 ~]# vim /etc/xinetd.d/tftp
disable : no
[root@linux-node1 ~]# systemctl start rsyncd
[root@linux-node1 ~]# systemctl enable rsyncd.service
[root@linux-node1 ~]# systemctl restart xinetd

7.安装syslinux
[root@inux-node1 ~]# yum -y install syslinux*
[root@inux-node1 ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/cobbler/loaders/
[root@inux-node1 ~]# cp /usr/share/syslinux/menu.c32 /var/lib/cobbler/loaders/
[root@inux-node1 ~]# ls /var/lib/cobbler/loaders/

8.再次检查配置
[root@linux-node1 ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to manage debian deployments and repositories
2 : 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.
这两个可以不解决, 提示如果是deb系统需要安装debmirror,这里我们是centos,可以不做

 

三.配置cobbler-DHCP

1.修改cobbler配置:
[root@linux-node1 cobbler]# vim /etc/cobbler/settings
manage_dhcp: 1 # set to 1 to enable Cobbler's DHCP management features.

2.修改dhcp.templates配置文件

[root@linux-node1 ~]# cd /etc/cobbler/
[root@linux-node1 cobbler]# vim dhcp.template # 主要是修改了下面几项
subnet 192.168.56.0 netmask 255.255.255.0 { # 子网
option routers 192.168.56.2; # 网关
option domain-name-servers 192.168.56.2; # dns-server
option subnet-mask 255.255.255.0; # 子网掩码
range dynamic-bootp 192.168.56.100 192.168.56.254; # 地址池

3.重启服务并同步配置,改完dhcp必需要sync同步配置。

[root@linux-node1 cobbler]# systemctl restart cobblerd
[root@linux-node1 cobbler]# cobbler sync
task started: 2021-12-25_051458_sync
task started (id=Sync, time=Sat Feb 25 05:14:58 2017)
...省略N行提示
generating /etc/dhcp/dhcpd.conf # 注意这个dhcp,会自动生成咱们刚才的配置。
*** TASK COMPLETE ***


四.导入CentOs-7的镜像

1.导入CentOs-7的镜像 CentOS-7.3-x86_64-DVD.iso 咱们先上传一个镜像到/opt 目录下上。而后开始导入:(见附件)

2.挂载镜像
[root@linux-node1 cobbler]# mount -o loop /opt/CentOS-7.3-x86_64-DVD.iso /mnt/
mount: /dev/loop0 is write-protected, mounting read-only
[root@linux-node1 cobbler]# cobbler import --path=/mnt --name=CentOS-7.3-x86_64 --arch=x86_64
查看系统镜像的目录
[root@linux-node1 ~]# ll /var/www/cobbler/ks_mirror/

3.导入完镜像之后,查看下cobbler
[root@linux-node1 cobbler]# cobbler list
distros:
CentOS-7.3-x86_64

profiles:
CentOS-7.3-x86_64

systems:

repos:

images:

mgmtclasses:

packages:

files:


4.导入提前准备好的kickstarts配置文件 (见附件)
[root@linux-node1 kickstarts]# pwd
/var/lib/cobbler/kickstarts


5.更改centos7的ks文件位置
[root@linux-node1 kickstarts]# cobbler profile edit --name CentOS-7.3-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7.3-x86_64.cfg
[root@linux-node1 kickstarts]# cobbler profile report


6.修改网卡名称为eth0
[root@linux-node1 kickstarts]# cobbler profile edit --name=CentOS-7.3-x86_64 --kopts='net.ifnames=0 biosdevname=0'

7.检查 ks 文件语法是否有误,根据结果行数可检查
[root@linux-node1 ]#cobbler validateks

8.同步数据
[root@linux-node1 kickstarts]# cobbler sync

 参考:

http://www.javashuo.com/article/p-nsvgwqgk-eg.html 
https://www.likecs.com/show-305859824.html

离线安装cobbler参考:

https://www.cnblogs.com/hengjiu/p/16494519.html

posted @ 2023-01-05 18:03  ni当像鸟飞往你的山  阅读(267)  评论(0编辑  收藏  举报