基于CentOS7系统部署cobbler批量安装系统(week3_day5_part1)-技术流ken
前言
cobbler是一个可以实现批量安装系统的Linux应用程序。它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本。
系统环境准备及其下载cobbler
一.系统环境
开启两个网卡。一个仅主机模式,一个桥接模式,主机模式对内提供cobbler服务。
[root@ken ~]# ip a
: lo: <LOOPBACK,UP,LOWER_UP> mtu qdisc noqueue state UNKNOWN group default qlen
link/loopback ::::: brd :::::
inet 127.0.0.1/ scope host lo
valid_lft forever preferred_lft forever
inet6 ::/ scope host
valid_lft forever preferred_lft forever
: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP group default qlen
link/ether :0c:::a1: brd ff:ff:ff:ff:ff:ff
inet 192.168.4.190/ brd 192.168.4.255 scope global noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 fe80::20c:29ff:fe13:a149/ scope link
valid_lft forever preferred_lft forever
: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu qdisc pfifo_fast state UP group default qlen
link/ether :0c:::a1: brd ff:ff:ff:ff:ff:ff
inet 192.168.182.128/ brd 192.168.182.255 scope global noprefixroute dynamic eth1
valid_lft 1786sec preferred_lft 1786sec
inet6 fe80::::e866:204f/ scope link noprefixroute
valid_lft forever preferred_lft forever
系统版本:CentOS Linux release 7.5.1804 (Core)
内网IP:192.168.182.128/24 #用来对内通信,提供cobbler服务
外网IP:192.168.4.190/24 #连接外网
二. 关闭安全服务
[root@ken ~]# systemctl stop firewalld #关闭防火墙
[root@ken ~]# setenforce 0 #关闭selinux
三. 下载cobbler及其所需服务程序
[root@ken ~]# yum install cobbler dhcp tftp-server xinetd syslinux httpd -y
syslinux: 提供pxelinux.0这个文件 ,pxelinux.0引导文件引导vmlinux和initrd两个启动文件
yum安装cobbler需要使用下面两个源,大家可以复制下面的代码到自己的yum仓库保存即可
[epel]
name=epel
enabled=1
gpgcheck=0
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
[centos]
name=centos base
enabled=1
gpgcheck=0
baseurl=http://mirrors.163.com/centos/7/os/x86_64/
配置相关服务
第一步:配置DHCP服务
[root@ken ~]# cat /etc/dhcp/dhcpd.conf
subnet 192.168.182.0 netmask 255.255.255.0 {
range 192.168.182.150 192.168.182.155;
default-lease-time ;
max-lease-time ;
filename "pxelinux.0";
}
[root@ken ~]# systemctl restart dhcpd
第二步:配置tftp
[root@ken ~]# cat /etc/xinetd.d/tftp
# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /var/lib/tftpboot
disable = no #yes改为no
per_source =
cps =
flags = IPv4
}
[root@ken ~]# systemctl restart xinetd
第三步:启动cobbler
[root@ken ~]# systemctl status cobblerd
第四步:启动httpd
[root@ken ~]# systemctl restart httpd
第五步:检查cobbler配置
[root@ken ~]# cobbler check
The following are potential configuration items that you may want to fix: : 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.
: 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.
: 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., menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
: enable and start rsyncd.service with systemctl
: debmirror package is not installed, it will be required to manage debian deployments and repositories
: 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
: 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.
根据如上反馈,需要一一进行修改才能继续进行
修改配置文件/etc/cobbler/settings
问题一:
cobbler文件默认是127.0.0.1本地回环地址,需要更改为提供cobbler服务的ip地址 192.168.182.128,在384行
384 server: 192.168.182.128
问题二:
netx_server也是默认本地127.0.0.1回环地址,需要修改为提供cobbler服务的ip地址 192.163.182,128,在272行出
272 next_server: 192.168.182.128
问题三:
可以忽略
问题四:
启动rsync即可
[root@ken ~]# systemctl restart rsyncd
[root@ken ~]# systemctl enable rsyncd
问题五:
可以忽略
问题六:
更改密码
[root@ken ~]# openssl passwd - -salt "" ""
$$$7mft0jKnzzvAdU4t0unTG1
并把新生成的加密数据填写进/etc/cobbler/settings
101 default_password_crypted: "$1$123$7mft0jKnzzvAdU4t0unTG1"
问题七:
可以忽略
以上问题解决之后,需要同步和重启
[root@ken ~]# systemctl restart cobblerd
[root@ken ~]# cobbler sync
再次检查是否已经更改完成
Created symlink from /etc/systemd/system/multi-user.target.wants/rsyncd.service to /usr/lib/systemd/system/rsyncd.service.
[root@ken ~]# cobbler check
The following are potential configuration items that you may want to fix: : 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., menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.
: debmirror package is not installed, it will be required to manage debian deployments and repositories
: 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.
已经更改完毕!
第六步:挂载光盘并进行数据导入
挂载光盘
[root@ken ~]# mount /dev/cdrom /mnt
数据导入(需要一些时间)
[root@ken ~]# cobbler import --path=/mnt --name="centos7.5"
task started: --13_001927_import
task started (id=Media import, time=Wed Mar :: )
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/centos7.:
creating new distro: centos7.-x86_64
trying symlink: /var/www/cobbler/ks_mirror/centos7. -> /var/www/cobbler/links/centos7.-x86_64
creating new profile: centos7.-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/centos7. for centos7.-x86_64
processing repo at : /var/www/cobbler/ks_mirror/centos7.
need to process repo/comps: /var/www/cobbler/ks_mirror/centos7.
looking for /var/www/cobbler/ks_mirror/centos7./repodata/*comps*.xml
Keeping repodata as-is :/var/www/cobbler/ks_mirror/centos7.5/repodata
*** TASK COMPLETE ***
查看distro
[root@ken ~]# cobbler distro list
centos7.5-x86_64
查看profile
[root@ken ~]# cobbler profile list
centos7.5-x86_64
distro : 发行版, 就是我们安装什么版本的linux操作系统的名称 一会我们会导入一个 distro.
profile : 类似于一个 配置文件,类似于你的 bash_profile, 里面包含你可以添加 kernel 参数,对应的kickstart 文件 以及 此profile 对应的 distro 等等.
第八步:准备kickstart文件
在root目录下找到ks文件,并移动到/var/lib/cobbler/kickstarts/到目录下改名为ks.cfg
[root@ken ~]# mv anaconda-ks.cfg /var/lib/cobbler/kickstarts/ks.cfg
[root@ken ~]# vim /var/lib/cobbler/kickstarts/ks.cfg
[root@ken ~]# cat /var/lib/cobbler/kickstarts/ks.cfg
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=http://192.168.182.128/cobbler/ks_mirror/centos7.5/ #这里需要更改为repodata所在的http地址
# Use graphical install
graphical
# 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.UTF- # Network information
network --bootproto=dhcp --device=ens33 --ipv6=auto --no-activate
network --hostname=localhost.localdomain # Root password
rootpw --iscrypted $$7zu1wIUDgBGEFV1Y$KsLVeaGmyN92.QHr1fqKdTqPu8PDmd8K9V/s3Ru8NxE53NZz4gQKsmP6K0udcXVvDtponekICYUwBD7tYZJqU/
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
autopart --type=lvm
# Partition clearing information
clearpart --none --initlabel %packages
@^minimal
@core %end %addon com_redhat_kdump --disable --reserve-mb='auto' %end %anaconda
pwpolicy root --minlen= --minquality= --notstrict --nochanges --notempty
pwpolicy user --minlen= --minquality= --notstrict --nochanges --emptyok
pwpolicy luks --minlen= --minquality= --notstrict --nochanges --notempty
%end
第八步:自定义profile
[root@ken ~]# cobbler profile add --distro=centos7.-x86_64 --name=centos7.5_ken --kickstart=/var/lib/cobbler/kickstarts/ks.cfg
[root@ken ~]# cobbler sync
task started: --13_002724_sync
task started (id=Sync, time=Wed Mar :: )
running pre-sync triggers
cleaning trees
removing: /var/www/cobbler/images/centos7.-x86_64
removing: /var/lib/tftpboot/pxelinux.cfg/default
removing: /var/lib/tftpboot/grub/images
removing: /var/lib/tftpboot/grub/efidefault
removing: /var/lib/tftpboot/images/centos7.-x86_64
removing: /var/lib/tftpboot/s390x/profile_list
copying bootloaders
copying distros to tftpboot
copying files for distro: centos7.-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7./images/pxeboot/vmlinuz -> /var/lib/tftpboot/images/centos7.-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7./images/pxeboot/initrd.img -> /var/lib/tftpboot/images/centos7.-x86_64/initrd.img
copying images
generating PXE configuration files
generating PXE menu structure
copying files for distro: centos7.-x86_64
trying hardlink /var/www/cobbler/ks_mirror/centos7./images/pxeboot/vmlinuz -> /var/www/cobbler/images/centos7.-x86_64/vmlinuz
trying hardlink /var/www/cobbler/ks_mirror/centos7./images/pxeboot/initrd.img -> /var/www/cobbler/images/centos7.-x86_64/initrd.img
Writing template files for centos7.-x86_64
rendering TFTPD files
generating /etc/xinetd.d/tftp
processing boot_files for distro: centos7.-x86_64
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.manage_genders
running python trigger cobbler.modules.scm_track
running shell triggers from /var/lib/cobbler/triggers/change/*
*** TASK COMPLETE ***
第九步:查看profile
[root@ken ~]# cobbler profile list
centos7.-x86_64
centos7.5_ken
第十步:删除不包含ks文件的profile
[root@ken ~]# cobbler profile remove --name=centos7.-x86_64
[root@ken ~]# cobbler profile list
centos7.5_ken
cobbler自动化安装测试
新建一个虚拟机,需要和cobbler服务器所在同一个虚拟网络中即与我们上面设置的cobbler服务器的主机模式。内存需要3个G以上。
选择第我们自定义的包即可进行自动化安装。
基于CentOS7系统部署cobbler批量安装系统(week3_day5_part1)-技术流ken的更多相关文章
- 基于Centos7系统部署cobbler批量安装系统
前言 cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本 系统环境的准备及下载cobbler 一 ...
- 末学者笔记--Centos7系统部署cobbler批量安装系统
[前言]: cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 系统环境准备及其下载cob ...
- 006-(成功环境记录)基于Centos7系统部署cobbler批量安装系统
1.1 cobbler简介 Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装.重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等. Cobbler可以使 ...
- centos7系统部署cobbler批量安装系统
系统环境: 一.开启两个网卡.一个仅主机模式,一个桥接模式,主机模式对内提供cobbler服务 [root@localhost ~]# ip a 1: lo: <LOOPBACK,UP,LOWE ...
- Jenkins+Git+Gitlab+Ansible实现持续集成自动化部署动态网站(二)--技术流ken
项目前言 在上一篇博客<Jenkins+Git+Gitlab+Ansible实现持续化集成一键部署静态网站(一)--技术流ken>中已经详细讲解了如何使用这四个工具来持续集成自动化部署一个 ...
- Jenkins+Git+Gitlab+Ansible实现持续集成自动化部署静态网站(一)--技术流ken
前言 在之前已经写了关于Git,Gitlab以及Ansible的两篇博客<Git+Gitlab+Ansible剧本实现一键部署Nginx--技术流ken>,<Git+Gitlab+A ...
- cobbler批量安装系统
cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 1.系统环境准备及其下载cobbler 1 ...
- cobbler批量安装系统使用详解-技术流ken
前言 cobbler是一个可以实现批量安装系统的Linux应用程序.它有别于pxe+kickstart,cobbler可以实现同个服务器批量安装不同操作系统版本. 系统环境准备及其下载cobbler ...
- 实战!基于lamp安装Discuz论坛-技术流ken
简介 我前面的博客已经详细介绍了lamp采用yum安装以及编译安装的方式,这篇博客将基于yum安装的lamp架构来实战安装Discuz论坛,你可以任选其一来完成. 系统环境 centos7.5 服务器 ...
随机推荐
- 计算机17-3,4作业E
E.complete number Description 完数是指一个整数的因子和等于这个数本身,例如6=1+2+3,所以6是一个完数. 按照给定数据范围,找出期中所有完数并输出. Input 数据 ...
- hystrix 结果缓存机制(5)
hystrix支持将一个请求结果缓存起来,下一个具有相同key的请求将直接从缓存中取出结果,减少请求开销.要使用hystrix cache功能 第一个要求是重写getCacheKey(),用来构造ca ...
- SpringCloud学习系列之五-----配置中心(Config)和消息总线(Bus)完美使用版
前言 在上篇中介绍了SpringCloud Config的使用,本篇则介绍基于SpringCloud(基于SpringBoot2.x,.SpringCloud Finchley版)中的分布式配置中心( ...
- 广州三本找Java实习经历
前言 只有光头才能变强 这阵子跑去面试Java实习生啦~~~我来简单介绍一下背景吧. 广州三本大三在读,在广州找实习.大学开始接触编程,一个非常平庸的人. 在学习编程时,跟我类似的人应该会有一个疑问: ...
- 【原创】详细案例解剖——浅谈Redis缓存的常用5种方式(String,Hash,List,set,SetSorted )
很多小伙伴没接触过Redis,以至于去学习的时候感觉云里雾里的,就有一种:教程随你出,懂了算我输的感觉. 每次听圈内人在谈论的时候总是插不上话,小编就偷偷去了解了一下,也算是初入门径. 然后就整理了一 ...
- 【开发记录】如何在B/S项目中使用中国天气的实时天气功能
好久没有更新我的博客了,正好手头有一个比较合适的项目经验可以分享出来,就是这个如何使用中国天气的天气预报功能,也正好做个项目经验记录. 功能需求 这个功能需求比较简单,就是想在网页端显示实时天气数据. ...
- JavaSE:关键字(全)
访问控制: private 访问控制方式:私有的 protected 访问控制方式:受保护的 public 访问控制方式:公共的 类.方法和变量修饰符: abstract 声明抽象,表明类或者成员方法 ...
- SpaceSyntax【空间句法】之DepthMapX学习:唠叨(目录)
最近花大力气学习了空间句法这一理论,以及其相关软件DepthMapX. 我觉得吧,你要是能搜索到这理论,这一软件名,这篇博客,那我甚至都不用介绍这软件是干什么用的——好吧,还是会说一下的. 虽然不知道 ...
- 在Salesforce成长:需要好奇心
今天的正题,今天谈谈好奇心和技术.这两天北大学霸Cherry分两次问了我两个问题,都触发了很好的结果和思考,让大家都受益. 第一天是她在做Salesforce和Flexible Report集成项目中 ...
- Spark初步 从wordcount开始
Spark初步-从wordcount开始 spark中自带的example,有一个wordcount例子,我们逐步分析wordcount代码,开始我们的spark之旅. 准备工作 把README.md ...