Cobbler自动安装RHEL7.3

1.实验环境

cobbler服务器: CentOS7.0 64位
IP地址: 192.168.126.120?
子网掩码: 255.255.255.0

2.Cobbler安装配置

2.1 安装CentOS7(略)

2.2 关闭SELinux

[[email protected] ~]# vim /etc/selinux/config
SELINUX=disabled
或者
[[email protected] ~]# sed -i ‘s/SELINUX=.*/SELINUX=disabled/g‘ /etc/selinux/config
修改SELinux配置文件后需要重启才能生效
[[email protected] ~]# reboot

2.3关闭防火墙

[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# systemctl disable firewalld.service
rm ‘/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service‘
rm ‘/etc/systemd/system/basic.target.wants/firewalld.service‘

2.4安装EPEL

下载并安装EPEL包

[[email protected] ~]# wget http://mirrors.ustc.edu.cn/fedora/epel//7/x86_64/e/epel-release-7-9.noarch.rpm
[[email protected] ~]# yum -y localinstall epel-release-7-9.noarch.rpm

安装完成后检查EPEL是否已添加到源列表

[[email protected] ~]# yum repolist

2.5安装cobbler/dhcp/xinetd/tcpdump/pykickstart

[[email protected] ~]# yum -y install cobbler-web
[[email protected] ~]# yum -y install dhcp
[[email protected] ~]# yum -y install xinetd
[[email protected] ~]# yum -y install tcpdump
[[email protected] ~]# yum -y install pykickstart

2.6 配置cobbler

启用cobbler及http服务

[[email protected] ~]# systemctl enable cobblerd.service
ln -s ‘/usr/lib/systemd/system/cobblerd.service‘ ‘/etc/systemd/system/multi-user.target.wants/cobblerd.service‘
[[email protected] ~]# systemctl start cobblerd.service
[[email protected] ~]# systemctl enable httpd.service
ln -s ‘/usr/lib/systemd/system/httpd.service‘ ‘/etc/systemd/system/multi-user.target.wants/httpd.service‘
[[email protected] ~]# systemctl start httpd.service

配置cobbler

生成密码:
[[email protected] ~]# openssl passwd -1 -salt "cobbler" "123456"
$1$cobbler$sqDDOBeLKJVmxTCZr52/11
密码是123456,此密码就是Linux安装完成后的root密码
修改cobbler配置:
[[email protected] ~]# vim /etc/cobbler/settings //打开配置文件,修改3处地方
server: 192.168.126.120 //把127.0.0.1改为本机的IP地址
next_server: 192.168.126.120 //把127.0.0.1改为本机的IP地址
default_password_crypted: "$1$cobbler$sqDDOBeLKJVmxTCZr52/11" //把原来的加密密码改为上面生成的密码

配置tftp

[[email protected] ~]# ?vim /etc/xinetd.d/tftp
disable = no //找到disable那行把yes改成no
[[email protected] ~]# systemctl enable xinetd.service
[[email protected] ~]# systemctl start xinetd.service
[[email protected] ~]# systemctl enable tftp.service
[[email protected] ~]# systemctl start tftp.service

get-loaders

[[email protected] ~]# cobbler get-loaders
task started: 2017-05-25_110906_get_loaders
task started (id=Download Bootloader Content, time=Thu May 25 11:09:06 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 ***

启用rsync

[[email protected] ~]# systemctl enable rsyncd.service
ln -s ‘/usr/lib/systemd/system/rsyncd.service‘ ‘/etc/systemd/system/multi-user.target.wants/rsyncd.service‘
[[email protected] ~]# systemctl start rsyncd.service

Cobbler check

[[email protected] ~]# systemctl restart cobblerd.service
[[email protected] ~]# 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.
以上警告可忽略

Cobbler sync

[[email protected] ~]# cobbler sync
task started: 2017-05-25_112231_sync
task started (id=Sync, time=Thu May 25 11:22:31 2017)
running pre-sync triggers
cleaning trees
removing: /var/lib/tftpboot/grub/images
copying bootloaders
trying hardlink /var/lib/cobbler/loaders/pxelinux.0 -> /var/lib/tftpboot/pxelinux.0
trying hardlink /var/lib/cobbler/loaders/menu.c32 -> /var/lib/tftpboot/menu.c32
trying hardlink /var/lib/cobbler/loaders/yaboot -> /var/lib/tftpboot/yaboot
copying: /usr/share/syslinux/memdisk -> /var/lib/tftpboot/memdisk
trying hardlink /var/lib/cobbler/loaders/grub-x86.efi -> /var/lib/tftpboot/grub/grub-x86.efi
trying hardlink /var/lib/cobbler/loaders/grub-x86_64.efi -> /var/lib/tftpboot/grub/grub-x86_64.efi
copying distros to tftpboot
copying images
generating PXE configuration files
generating PXE menu structure
rendering TFTPD files
generating /etc/xinetd.d/tftp
cleaning link caches
running post-sync triggers
running python triggers from /var/lib/cobbler/triggers/sync/post/*
running python trigger cobbler.modules.sync_post_restart_services
running shell triggers from /var/lib/cobbler/triggers/sync/post/*
running python triggers from /var/lib/cobbler/triggers/change/*
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***

2.7 导入distro

在虚拟机上挂载RHEL7.3的ISO

[[email protected] ~]# mount /dev/sr0 /mnt
mount: /dev/sr0 is write-protected, mounting read-only

然后导入distro

[[email protected] ~]# cobbler import --path=/mnt/ --name=rhel7
task started: 2017-05-25_112707_import
task started (id=Media import, time=Thu May 25 11:27:07 2017)
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/rhel7:
creating new distro: rhel7-x86_64
trying symlink: /var/www/cobbler/ks_mirror/rhel7 -> /var/www/cobbler/links/rhel7-x86_64
creating new profile: rhel7-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/rhel7 for rhel7-x86_64
processing repo at : /var/www/cobbler/ks_mirror/rhel7
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7
looking for /var/www/cobbler/ks_mirror/rhel7/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel7/addons/HighAvailability
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7/addons/HighAvailability
looking for /var/www/cobbler/ks_mirror/rhel7/addons/HighAvailability/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7/addons/HighAvailability/repodata
processing repo at : /var/www/cobbler/ks_mirror/rhel7/addons/ResilientStorage
need to process repo/comps: /var/www/cobbler/ks_mirror/rhel7/addons/ResilientStorage
looking for /var/www/cobbler/ks_mirror/rhel7/addons/ResilientStorage/repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/rhel7/addons/ResilientStorage/repodata
*** TASK COMPLETE ***

检查

[[email protected] ~]# cobbler distro list
   rhel7-x86_64
[[email protected] ~]# cobbler distro report rhel7-x86_64
Name                           : rhel7-x86_64
Architecture                   : x86_64
TFTP Boot Files                : {}
Breed                          : redhat
Comment                        :
Fetchable Files                : {}
Initrd                         : /var/www/cobbler/ks_mirror/rhel7/images/pxeboot/initrd.img
Kernel                         : /var/www/cobbler/ks_mirror/rhel7/images/pxeboot/vmlinuz
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart Metadata             : {‘tree‘: ‘http://@@[email protected]@/cblr/links/rhel7-x86_64‘}
Management Classes             : []
OS Version                     : rhel7
Owners                         : [‘admin‘]
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Template Files                 : {}

2.8配置dhcp

首先修改cobbler配置,让cobbler来管理dhcp服务

[[email protected] ~]# vim /etc/cobbler/settings
manage_dhcp: 1

接下来修改/etc/cobbler/dhcp.template,此文件是cobbler管理dhcp的模板

对于此文件,只需要修改如下部分:
subnet 192.168.126.0 netmask 255.255.255.0 {
     option routers             192.168.126.1;
     option domain-name-servers 192.168.126.10;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.126.150 192.168.126.250;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

同步cobbler

[[email protected] ~]# cobbler sync

2.9修改profile

在/var/lib/cobbler/kickstarts目录下创建kickstart profie文件

文件示例
[[email protected] kickstarts]# more rhel7.cfg
#version=RHEL7
# System authorization information
auth --enableshadow --passalgo=sha512

?

# Use CDROM installation media
install
url --url=http://192.168.126.120/cblr/links/rhel7-x86_64
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts=‘us‘
# System language
lang en_US

?

# Network information
# Root password
rootpw --iscrypted $6$V80MlXh4At3AojC.$.jm0Iz5MWo.l52ob9iA9Ov.e.AcD8L5guE3Vp6HSkwco.omLjPPEVFlBYC8rVzbR0IhqIXW3FGmz.z/VcW0rD1
# System timezone
timezone Asia/Shanghai
# X Window System configuration information
#xconfig  --startxonboot
text
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part pv.11 --fstype="lvmpv" --ondisk=sda --size=1 --grow
part /boot --fstype="xfs" --ondisk=sda --size=200
volgroup rootvg --pesize=4096 pv.11
logvol /tmp  --fstype="xfs" --size=5000 --name=tmplv --vgname=rootvg
logvol /var  --fstype="xfs" --size=5000 --name=varlv --vgname=rootvg
logvol swap  --fstype="swap" --size=4000 --name=swaplv --vgname=rootvg
logvol /usr  --fstype="xfs" --size=10000 --name=usrlv --vgname=rootvg
logvol /  --fstype="xfs" --size=5000 --name=rootlv --vgname=rootvg
logvol /home  --fstype="xfs" --size=10000 --name=homelv --vgname=rootvg

?

%packages
@^Server With GUI
%end

修改profile文件

[[email protected] ~]# cobbler profile list
   rhel7-x86_64
[[email protected] ~]# cobbler profile edit --name=rhel7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/rhel7.cfg
[[email protected] ~]# cobbler profile report rhel7-x86_64
Name                           : rhel7-x86_64
TFTP Boot Files                : {}
Comment                        :
DHCP Tag                       : default
Distribution                   : rhel7-x86_64
Enable gPXE?                   : 0
Enable PXE Menu?               : 1
Fetchable Files                : {}
Kernel Options                 : {}
Kernel Options (Post Install)  : {}
Kickstart                      : /var/lib/cobbler/kickstarts/rhel7.cfg
Kickstart Metadata             : {}
Management Classes             : []
Management Parameters          : <<inherit>>
Name Servers                   : []
Name Servers Search Path       : []
Owners                         : [‘admin‘]
Parent Profile                 :
Internal proxy                 :
Red Hat Management Key         : <<inherit>>
Red Hat Management Server      : <<inherit>>
Repos                          : []
Server Override                : <<inherit>>
Template Files                 : {}
Virt Auto Boot                 : 1
Virt Bridge                    : xenbr0
Virt CPUs                      : 1
Virt Disk Driver Type          : raw
Virt File Size(GB)             : 5
Virt Path                      :
Virt RAM (MB)                  : 512
Virt Type                      : kvm

?

[[email protected] ~]# cobbler sync
时间: 2024-11-08 15:46:17

Cobbler自动安装RHEL7.3的相关文章

Cobbler自动安装的Linux系统ssh无法进入

Linux ssh登陆老提示“permission denied,please try again” ,但是iptables已经关掉了 修改/etc/ssh/sshd_config文件.找如下的一句 #PermitRootLogin yes 改为如下的 PermitRootLogin yes 注意,要把前面的#号去掉. 重启sshd服务器 # service sshd restart Cobbler自动安装的Linux系统ssh无法进入,布布扣,bubuko.com

cobbler自动安装

Cobbler无人值守 环境准备[[email protected] ~]# cat /etc/redhat-releaseCentOS release 6.9 (Final)[[email protected] ~]# uname -r2.6.32-696.el6.x86_64[[email protected] ~]# getenforceDisabled[[email protected] ~]# /etc/init.d/iptables statusiptables: Firewall

cobbler自动安装系统

一.cobbler工作流程 远程裸机开机启动网络启动,开机后会广播给DHCP服务器,分配给远程主机一个IP地址 拿到IP地址后,远程主机向cobbler server发送请求OS启动文件的请求. cobbler服务器告诉远程主机OS应到文件的名字,和 TFTP 服务器的IP地址和端口. 远程主机根据IP地址和端口,到TFTP 服务器上下载引导文件. 远程主机执行OS引导文件,加载信息和menu.c32,启动选择菜单,选择要安装的OS,然后向cobbler服务器请求 kickstart 文件和OS

Cobbler 自动安装 配置

自动化安装适用于IDC机房批量安装服务器: 现在我们的自动化安装的方法有两种:今天我们来实现一下Cobbler的配置: 1.PXE,这种配置起来比较麻烦: 2.Cobbler,这种批量安装的方法,也是基于PEX结构执行的,但是Cobbler省去了我们配置文件的步骤,都交给了Cobbler来完成: 1)安装软件:查看服务是否启动 [[email protected] ~]# yum install tftp-server rsync xinetd httpd dhcp [[email protec

linux cobbler 自动安装centos6与centos7系统

1.1 Cobbler介绍 Cobbler 是一个免费开源系统安装部署软件,用于自动化网络安装操作系统. Cobbler 集成了 DNS, DHCP, 软件包更新,带外管理以及配置管理,方便操作系统安装自动化. Cobbler 可以支持PXE启动, 操作系统重新安装,以及虚拟化客户机创建,包括Xen, KVM or VMware.  Cobbler 透过koan程序以支持虚拟化客户机安装. Cobbler 可以支持管理复杂网路环境,如建立在链路聚合以太网的桥接环境. 1.2 cobbler 服务

运维自动化之Cobbler部署安装RHEL7.0(详细图解版)

一.简介     Cobbler 可以用来快速建立 Linux 网络安装环境,它已将 Linux 网络安装的技术门槛,从大专以上文化水平,成功降低到初中以下,连补鞋匠都能学会.          网络安装服务器套件 Cobbler(补鞋匠)从前,我们一直在做装机民工这份很有前途的职业.自打若干年前 Red Hat 推出了 Kickstart,此后我们顿觉身价倍增.不再需要刻了光盘一台一台地安装 Linux,只要搞定 PXE.DHCP.TFTP,还有那满屏眼花缭乱不知所云的 Kickstart 脚

cobbler自动安装操作系统

cobbler介绍 快速网络安装linux操作系统的服务,支持众多的Linux发行版: Red Hat, Fedora,CentOS,Debian,Ubuntu和SuSE 也可以支持网络安装windows PXE的二次封装,将多种安装参数封装到一个菜单 Python编写 提供了CLI和Web的管理形式 cobbler软件包来源于epel源中的软件包 cobbler 服务集成 cobbler可以和以下服务一起集成来对外提供服务  但是cobbler不能代替以下服务 PXE DHCP rsync H

使用cobbler自动安装操作系统(CentOS版)

Cobbler是简便的批量部署操作系统的工具,不仅操作不需要太复杂,而且使用cobbler还能在多个主机上部署多个操作系统,甚是方便. 部署cobbler需要依赖的组件有tftp服务器.dhcp服务器.rsync必要的时候还需要用到dns服务器. 本文就展示一下,多服务集于一个主机部署的cobbler. 文中所使用的工具有VMware虚拟机,两个虚拟主机,一个CentOS-6.5-x86_64系统镜像.部署环境:CentOS6.5-x86_64环境. 前提:由于cobbler需要依赖epel环境

Cobbler自动安装*nix系统

依赖软件:    yum install epel dhcp tftp rysnc xinetd httpd -y 关闭selinux: 临时关闭:       setenforce 0 永久关闭:       sed -i 's/SELINUX=.*/SELINUX=disable/g' /etc/selinux/config 安装cobbler:    yum install cobbler 配置xinetd启动tftp:/etc/xinetd.d/tftp 在DHCP服务器配置子网 cob