CentOS7下部署Cobbler实现PXE+Kickstart自动化安装

简介: CentOS7下部署Cobbler实现PXE+Kickstart自动化安装

CentOS7下部署Cobbler实现PXE+Kickstart自动化安装的操作步骤


1、使用腾讯软件源站点https://mirrors.cloud.tencent.com/640.jpg

下载epel镜像源配置文件

640.png

wget -O /etc/yum.repos.d/epel.repo http://mirrors.cloud.tencent.com/repo/epel-7.repo

640.png

2、 yum install cobbler cobbler-web

640.png

3、安装cobbler会用到的一些组件包


yum install dhcp tftp-server pykickstart httpd rsync xinetd


640.png

4、启动cobblerd和httpd服务

systemctl start cobblerd.service
systemctl start httpd.service

cobbler check检查配置


640.png


5、根据上面cobbler check检查配置给出的提示,一一进行配置

1)cd /etc/cobbler/
cp settings settings_default_bak

image.png


2)278行net_server:127.0.0.1改成192.168.31.200

640.png

390行server: 127.0.0.1改成192.168.31.200

640.png

3)vi /etc/xinetd.d/tftp

改disable=yes为disable= no

640.png

然后

systemctl enable xinetd  
systemctl enable tftp
systemctl start xinetd  
systemctl start tftp

image.png


4)cobbler get-loaders


下载操作系统引导文件

640.png

5)启动rsyncd服务,并设为开机自启动

systemctl enable rsyncd
systemctl start rsyncd

640.png

6)vi /etc/cobbler/dhcp.template

640.png

7)vi /etc/cobbler/settings  


manage_dhcp: 0改为manage_dhcp: 1

640.png

8)重启服务,同步配置文件

systemctl restart cobblerd
cobbler sync

640.png

9)cobbler check检查配置


640.png640.png

10)openssl passwd -1 -salt 'root' 'admin@2020'

vi /etc/cobbler/settings

default_password_crypted: "$1$root$afc2RZysD6SOx07LLBnwB0"

640.png


这时再重启cobblerd服务

systemctl restart cobblerd

cobbler sync同步配置


640.png

cobbler check 这时只有一个无关紧要的提示项

640.png


6、配置基本完成后,挂载CentOS7.7.1908版本的官方ISO镜像包

640.png

7、导入镜像


1)cobbler import --path=/mnt/cdrom --name=CentOS_7.7.1908

640.png


2)cobbler list

640.png

3)systemctl restart cobblerd.service  

cobbler sync

640.jpg


8、验证Web是否可以正常访问


http://192.168.31.200/cobbler/ks_mirror/

640.png

9、新建一台虚拟机,测试PXE安装

640.png

640.png

640.png


10、关于定制Kickstart实现一键安装的操作步骤

1)cd /var/lib/cobbler/kickstarts/  
vi CentOS7.ks

关于ks文件可以参考之前的文章


CentOS系统下PXE服务器的搭建与部署


PXE+Kickstart实现无人值守自动化安装CentOS系统


CentOS6.9下制作一键安装的ISO系统镜像


kickstart配置文件如下,


#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$.V2f7Wsz$0EdykaW/HEQoy./Zs3Tfu.
# System language
lang en_US
# System authorization information
auth  --useshadow  --passalgo=sha512
# Use network installation 
url --url="http://192.168.31.200/cobbler/ks_mirror/CentOS_7.7.1908"
# Use graphical install
graphical
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Firewall configuration
firewall --disabled
# Network information
network  --bootproto=dhcp --device=ens33 --onboot=on
# Reboot after installation
reboot
# System timezone
timezone Asia/Shanghai --isUtc
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
part /boot --fstype=ext4 --asprimary --size=1024
part / --fstype=ext4 --asprimary --size=20480
part swap --asprimary --size=16384
part pv.008006 --grow --size=200
volgroup vg_centos --pesize=4096 pv.008006
logvol /opt --fstype=ext4 --name=lv_opt --vgname=vg_centos --grow --size=200
%packages
@^infrastructure-server-environment
@base
@core
@debugging
@development
@file-server
@ftp-server
@ha
chrony
kexec-tools
%end

640.png

关于profile默认使用的ks是/var/lib/cobbler/kickstarts/sample_end.ks


640.png

使用cobbler profile edit 进行编辑

cobbler profile edit --name=CentOS_7.7.1908-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS7.ks

640.png

3)

mount -t iso9660 /CentOS_ISO/CentOS-7-x86_64-DVD-1908.iso /temp_cdrom/
 cd /temp_cdrom/
cp -r * /mnt/cdrom/

640.png

4)先删除前面的cobbler profile 和distro


640.png

5)cobbler import --path=/mnt/cdrom --name=CentOS_7.7.1908


重新导入镜像并修改profile

640.png


6)重新启动cobblerd服务,并同步配置

systemctl restart cobblerd.service
cobbler sync

640.jpg

7)测试一键PXE+Kickstart自动安装,如下图所示全程无需操作可以直接实现一键安装

640.jpg


本次实验实现过程参考如下文章完成


1)《Linux就该这么学》公众号:实用帖:搭建Cobbler无人值守安装服务器

2)https://www.cnblogs.com/zhangxingeng/p/9702625.html

相关文章
|
5月前
|
存储 分布式计算 Linux
安装篇--CentOS 7 虚拟机安装
VMware 装 CentOS 7 不知道从哪下手?这篇超详细图文教程手把手教你在 VMware Workstation 中完成 CentOS 7 桌面系统的完整安装流程。从 ISO 镜像下载、虚拟机配置,到安装图形界面、设置用户密码,每一步都有截图讲解,适合零基础新手快速上手。装好之后无论你是要搭 Hadoop 集群,还是练 Linux ,这个环境都够你折腾一整天!
2209 3
|
5月前
|
安全 关系型数据库 MySQL
CentOS 7 yum 安装 MySQL教程
在CentOS 7上安装MySQL 8,其实流程很清晰。首先通过官方Yum仓库来安装服务,然后启动并设为开机自启。最重要的环节是首次安全设置:需要先从日志里找到临时密码来登录,再修改成你自己的密码,并为远程连接创建用户和授权。最后,也别忘了在服务器防火墙上放行3306端口,这样远程才能连上。
1079 16
|
6月前
|
存储 关系型数据库 MySQL
在CentOS 8.x上安装Percona Xtrabackup工具备份MySQL数据步骤。
以上就是在CentOS8.x上通过Perconaxtabbackup工具对Mysql进行高效率、高可靠性、无锁定影响地实现在线快速全量及增加式数据库资料保存与恢复流程。通过以上流程可以有效地将Mysql相关资料按需求完成定期或不定期地保存与灾难恢复需求。
532 10
|
4月前
|
数据采集 运维 监控
爬虫与自动化技术深度解析:从数据采集到智能运维的完整实战指南
本文系统解析爬虫与自动化核心技术,涵盖HTTP请求、数据解析、分布式架构及反爬策略,结合Scrapy、Selenium等框架实战,助力构建高效、稳定、合规的数据采集系统。
945 62
爬虫与自动化技术深度解析:从数据采集到智能运维的完整实战指南
|
5月前
|
运维 Linux 网络安全
自动化真能省钱?聊聊运维自动化如何帮企业优化IT成本
自动化真能省钱?聊聊运维自动化如何帮企业优化IT成本
186 4
|
运维 Linux Apache
,自动化运维成为现代IT基础设施的关键部分。Puppet是一款强大的自动化运维工具
【10月更文挑战第7天】随着云计算和容器化技术的发展,自动化运维成为现代IT基础设施的关键部分。Puppet是一款强大的自动化运维工具,通过定义资源状态和关系,确保系统始终处于期望配置状态。本文介绍Puppet的基本概念、安装配置及使用示例,帮助读者快速掌握Puppet,实现高效自动化运维。
345 4
|
7月前
|
运维 监控 安全
从实践到自动化:现代运维管理的转型与挑战
本文探讨了现代运维管理从传统人工模式向自动化转型的必要性与路径,分析了传统运维的痛点,如效率低、响应慢、依赖经验等问题,并介绍了自动化运维在提升效率、降低成本、增强系统稳定性与安全性方面的优势。结合技术工具与实践案例,文章展示了企业如何通过自动化实现运维升级,推动数字化转型,提升业务竞争力。
|
11月前
|
机器学习/深度学习 人工智能 运维
机器学习+自动化运维:让服务器自己修Bug,运维变轻松!
机器学习+自动化运维:让服务器自己修Bug,运维变轻松!
466 14
|
机器学习/深度学习 人工智能 运维
基于AI的自动化事件响应:智慧运维新时代
基于AI的自动化事件响应:智慧运维新时代
571 11