CentOS 7.4下Cobbler安装详解

系统:
[root@cobbler ~]# more /etc/RedHat-release
CentOS Linux release 7.4.1708 (Core)

一、安装基础软件:
yum -y install wget net-tools curl epel-release
更新:
yum -y update
关闭iptables与selinux:
[root@cobbler ~]# vim /etc/selinux/config
SELINUX=disabled
重启后查看:
[root@cobbler ~]# sestatus
SELinux status: disabled

二、安装基础服务:
yum -y install dhcp httpd xinetd tftp-server rsync fence-agents pykickstart
设置开机启动
systemctl enable xinetd dhcpd httpd rsyncd
systemctl start xinetd dhcpd httpd rsyncd
1、安装cobbler
[root@cobbler ~]# yum -y install cobbler-web
设置开机启动:
systemctl enable cobblerd
systemctl start cobblerd

2、效验cobbler安装条件
[root@cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix:

1 : comment out 'dists' on /etc/debmirror.conf for proper debian support
2 : comment out 'arches' on /etc/debmirror.conf for proper debian support

Restart cobblerd and then run 'cobbler sync' to apply changes

3、随机生成一个密码
[root@cobbler ~]# openssl passwd -1 -salt "cobbler" "huangzai"
$1$cobbler$zPOuqy9SLOb87DIQb3RbQ.

4、更改cobbler配置文件
[root@cobbler ~]# vim /etc/cobbler/settings
..........
default_password_crypted: "$1$cobbler$zPOuqy9SLOb87DIQb3RbQ." #第三步生成的密码
manage_dhcp: 1 #dhcp服务
manage_tftpd: 1 #xinetd服务
manage_rsync: 1 #rsyncd服务
next_server: 192.168.3.222 #替换成本机IP地址,dhcp服务地址
server: 192.168.3.222 #替换为本机IP地址,cobber服务地址
..........

5、更新load信息:
[root@cobbler ~]# cobbler get-loaders
task started: 2018-03-06_051434_get_loaders
task started (id=Download Bootloader Content, time=Tue Mar 6 05:14:34 2018)
downloading https://cobbler.github.io/loaders/README to /var/lib/cobbler/loaders/README
downloading https://cobbler.github.io/loaders/COPYING.elilo to /var/lib/cobbler/loaders/COPYING.elilo
downloading https://cobbler.github.io/loaders/COPYING.yaboot to /var/lib/cobbler/loaders/COPYING.yaboot
downloading https://cobbler.github.io/loaders/COPYING.syslinux to /var/lib/cobbler/loaders/COPYING.syslinux
downloading https://cobbler.github.io/loaders/elilo-3.8-ia64.efi to /var/lib/cobbler/loaders/elilo-ia64.efi
downloading https://cobbler.github.io/loaders/yaboot-1.3.17 to /var/lib/cobbler/loaders/yaboot
downloading https://cobbler.github.io/loaders/pxelinux.0-3.86 to /var/lib/cobbler/loaders/pxelinux.0
downloading https://cobbler.github.io/loaders/menu.c32-3.86 to /var/lib/cobbler/loaders/menu.c32
downloading https://cobbler.github.io/loaders/grub-0.97-x86.efi to /var/lib/cobbler/loaders/grub-x86.efi
downloading https://cobbler.github.io/loaders/grub-0.97-x86_64.efi to /var/lib/cobbler/loaders/grub-x86_64.efi
 TASK COMPLETE

6、设置tftp配置文件,‘disable'为'no'
[root@cobbler ~]# cat /etc/xinetd.d/tftp | grep -v '^#'
service tftp
{
disable = no
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -B 1380 -v -s /var/lib/tftpboot
per_source = 11
cps = 100 2
flags = IPv4
}

7、修改dhcp配置文件
[root@cobbler ~]# vim /etc/cobbler/dhcp.template
ddns-update-style interim;
allow booting;
allow bootp;
ignore client-updates;
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
subnet 192.168.3.0 netmask 255.255.255.0 {
option routers 192.168.3.222;
option domain-name-servers 202.96.209.5,202.96.209.133;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.3.60 192.168.3.100;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
if option pxe-system-type = 00:02 {
filename "ia64/elilo.efi";
} else if option pxe-system-type = 00:06 {
filename "grub/grub-x86.efi";
} else if option pxe-system-type = 00:07 {
filename "grub/grub-x86_64.efi";
} else if option pxe-system-type = 00:09 {
filename "grub/grub-x86_64.efi";
} else {
filename "pxelinux.0";
}
}

}
.........

三、导入镜像进行配置
1、上传iso镜像到服务器
2、创建文件夹
mkdir -p /data/centos7.0
3、将镜像文件挂载或copy到文件夹
[root@cobbler ~]# mount /dev/cdrom /data/centos7.0/

4、把挂载光盘镜像的mnt目录中的内容导入到cobbler
[root@cobbler ~]# cobbler import --path=/data/centos7.0/ --name=cent7.0
task started: 2018-03-06_055628_import
task started (id=Media import, time=Tue Mar 6 05:56:28 2018)
Found a candidate signature: breed=redhat, version=rhel6
Found a candidate signature: breed=redhat, version=rhel7
Found a matching signature: breed=redhat, version=rhel7
Adding distros from path /var/www/cobbler/ks_mirror/cent7.0:
creating new distro: cent7.0-x86_64
trying symlink: /var/www/cobbler/ks_mirror/cent7.0 -> /var/www/cobbler/links/cent7.0-x86_64
creating new profile: cent7.0-x86_64
associating repos
checking for rsync repo(s)
checking for rhn repo(s)
checking for yum repo(s)
starting descent into /var/www/cobbler/ks_mirror/cent7.0 for cent7.0-x86_64
processing repo at : /var/www/cobbler/ks_mirror/cent7.0
need to process repo/comps: /var/www/cobbler/ks_mirror/cent7.0
looking for /var/www/cobbler/ks_mirror/cent7.0/repodata/comps.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/cent7.0/repodata
 TASK COMPLETE

5、cobber report查看导入信息
[root@cobbler ~]# cobbler report
distros:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/12905.html