加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

LINUX实操:CentOS7下利用Cobbler安装部署CentOS

发布时间:2020-05-24 06:00:49 所属栏目:Linux 来源:互联网
导读:介绍《LINUX实操:CentOS7下利用Cobbler安装部署CentOS》开发教程,希望对您有用。

《LINUX实操:CentOS7下利用Cobbler安装部署CentOS》要点:
本文介绍了LINUX实操:CentOS7下利用Cobbler安装部署CentOS,希望对您有用。如果有疑问,可以联系我们。

CentOS7下应用Cobbler安装部署CentOS

Cobbler是一款快速的网络系统部署工具,其最大的特点是集合了所有系统部署所需服务,如DHCP、DNS、TFTP,这样你在部署一台操作系统的时候不需要在各个服务之前协调切换,Cobbler都可以替你来管理,Cobbler内部集成了一个镜像版本仓库,你可以自定义相关配置文件,实现不同系统不同安装需求的选择;当然,Cobbler还提供了包含yum源管理、Web界面管理、API接口、电源管理等功能,方便你自定义开发管理.

1)安装epel源和cobbler
[root@cobbler ~]# yum -y install http://mirrors.163.com/centos/7/extras/x86_64/Packages/epel-release-7-9.noarch.rpm
[root@cobbler ~]# yum install cobbler cobbler-web dhcp tftp-server pykickstart httpd xinetd -y
[root@cobbler ~]# systemctl start xinetd.service
[root@cobbler ~]# systemctl enable xinetd.service
[root@cobbler ~]# systemctl start httpd
[root@cobbler ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@cobbler ~]# systemctl start cobblerd.service
[root@cobbler ~]# systemctl enable cobblerd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/cobblerd.service to /usr/lib/systemd/system/cobblerd.service.

2)设置装备摆设cobbler

反省cobbler:
[root@cobbler ~]# cobbler check
The following are potential configuration items that you may want to fix:
1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost,or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.
2 : For PXE to be functional,the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1,and should match the IP of the boot server on the PXE network.
3 : change 'disable' to 'no' in /etc/xinetd.d/tftp
4 : 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.
5 : enable and start rsyncd.service with systemctl
6 : debmirror package is not installed,it will be required to manage debian deployments and repositories
7 : 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
8 : 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.

改动cobbler的配置文件:
[root@cobbler ~]# vim /etc/cobbler/settings
# if you do not set this correctly,this will be manifested in TFTP open timeouts.
将“next_server: 127.0.0.1”改动为“next_server: 10.10.10.222”
将“server: 127.0.0.1”改动为“server: 10.10.10.222”
# set to 1 to enable Cobbler's DHCP management features.
# the choice of DHCP management engine is in /etc/cobbler/modules.conf
将“manage_dhcp: 0”改动为“manage_dhcp: 1”

修改cobbler默认的暗码:

将“default_password_crypted: "$1$mF86/UHC$WvcIcX2t6crBz2onWxyac."”修改为“default_password_crypted: "$1$wanwan$K9lP0CajD0pbFaxI0if84/"”
随机生成一个暗码:
[root@cobbler ~]# openssl passwd -1 -salt 'wanwan' 'RedHat12345'
$1$wanwan$K9lP0CajD0pbFaxI0if84/
[root@cobbler ~]# vim /etc/xinetd.d/tftp
将“disable = yes”修改为“disable = no”

重启rsync服务:

[root@cobbler ~]# systemctl start rsyncd.service
[root@cobbler ~]# systemctl enable rsyncd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.

下载cobbler相关的包:
[root@cobbler ~]# cobbler get-loaders
task started: 2017-03-20_110931_get_loaders
task started (id=Download Bootloader Content,time=Mon Mar 20 11:09:31 2017)
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 淫乱
[root@cobbler ~]# systemctl restart cobblerd.service
[root@cobbler ~]# 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
[root@cobbler ~]# cd /etc/cobbler/
[root@cobbler cobbler]# ls
auth.conf dhcp.template ldap power rsync.template users.conf zone_templates
cheetah_macros dnsmasq.template modules.conf pxe secondary.template users.digest
cobbler_bash import_rsync_whitelist mongodb.conf reporting settings version
completions iso named.template rsync.exclude tftpd.template zone.template

3)设置装备摆设服务

[root@cobbler cobbler]# vim dhcp.template
subnet 10.10.10.0 netmask 255.255.255.0 {
option routers 10.10.10.2;
option domain-name-servers 10.10.10.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.10.10.100 10.10.10.200;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
class "pxeclients" {
match if substring (option vendor-class-identifier,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 {
filename "pxelinux.0";
}
}
}
备注:主要改动网段、DNS、网关等信息
[root@cobbler cobbler]# cobbler sync
通过cobbler管理的dhcp的配置文件
[root@cobbler cobbler]# egrep -v '^#|^$' /etc/dhcp/dhcpd.conf
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 10.10.10.0 netmask 255.255.255.0 {
option routers 10.10.10.2;
option domain-name-servers 10.10.10.2;
option subnet-mask 255.255.255.0;
range dynamic-bootp 10.10.10.100 10.10.10.200;
default-lease-time 21600;
max-lease-time 43200;
next-server 10.10.10.222;
class "pxeclients" {
match if substring (option vendor-class-identifier,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 {
filename "pxelinux.0";
}
}
}
group {
}

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读