PXE无人值守部署centos7.4操作系统
1、基础环境:
镜像ISO文件名为:CentOS-7-x86_64-DVD-1804.iso
2、安装需要的软件包
yum install dhcp xinetd syslinux httpd tftp-server -y
dhcpd: 动态分配IP
xinetd: 对服务访问进行控制,这里主要是控制tftp
tftp: 从服务器端下载pxelinux.0、default文件
syslinux: 用于网络引导
httpd: 在网络上提供安装源,也就是镜像文件中的内容
3、配置对应的服务
vi /etc/xinetd.d/tftp
配置 dhcp下发地址
ddns-update-style none;
ignore client-updates;
default-lease-time 259200;
max-lease-time 518400;
option domain-name-servers 114.114.114.114; #dns地址
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.110 192.168.1.115;
option routers 192.168.1.254; #下发的网关
option subnet-mask 255.255.255.0;
next-server 192.168.1.104; #下发的本机ip
# the configuration file for pxe boot
filename "pxelinux.0";
}
systemctl enable dhcpd && systemctl start dhcpd
systemctl enable xinetd && systemctl start xinetd
systemctl enable tftp && systemctl start tftp
systemctl enable httpd && systemctl start httpd
依次执行以下命令,开放防火墙TCP-80端口及UDP-69端口,注意不要搞错了UDP和TCP。
firewall-cmd –zone=public –add-port=80/tcp –permanent
firewall-cmd –zone=public –add-port=69/udp –permanent
firewall-cmd –reload
firewall-cmd –zone=public –list-ports
也可以直接关闭防火墙
关闭selinux
## 以下配置生效需要系统重启##
临时关闭selinux: setenforce 0
mkdir /var/www/html/centos7
创建挂载点
mount -t iso9660 -o loop /dev/cdrom /mnt/
cp -rf /mnt/* /var/www/html/centos7/
建议挂载在/mnt 下(通用挂载点)
mkdir /var/lib/tftpboot/centos7
cp /var/www/html/centos7/images/pxeboot/initrd.img /var/lib/tftpboot/centos7/
cp /var/www/html/centos7/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg
vi /var/lib/tftpboot/pxelinux.cfg/default
4、创建Kickstart文件ks.cfg
这个需要安装kickstart执行:yum -y install system-config-kickstart
bash#下运行system-config-kickstart,打开kickstart桌面软件,选择安装步骤。
cat/var/www/html/centos7/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
#version=DEVEL
# Install OS instead of upgrade
install
# Keyboard layouts
keyboard 'us'
# Root password
rootpw --iscrypted $1$grc2urK7$tqnhPtOUV/SFfQT0DTeko0
# Use network installation
url --url="http://192.168.1.104/centos7/"
# System language
lang zh_CN
# System authorization information
auth --useshadow --passalgo=sha512
# Use text mode install
text
# SELinux configuration
selinux --disabled
# Do not configure the X Window System
skipx
# Firewall configuration
firewall --disabled
# Network information
network --bootproto=dhcp --device=ens33
# Reboot after installation
reboot
# System timezone
timezone Asia/Hong_Kong --isUtc
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Disk partitioning information
clearpart --all --initlabel #清空分区
part /boot --fstype xfs --size 1024 #/boot分区
part swap --size 1024 #swap分区
part / --fstype xfs --size 1 --grow #根分区
firstboot --disable
%packages
@compat-libraries
@core
@debugging
@development
@fonts
@gnome-apps
@gnome-desktop
@graphics
@ha
@input-methods
@internet-applications
@load-balancer
@mainframe-access
@mariadb-client
@network-tools
@office-suite
@platform-devel
@remote-system-management
@resilient-storage
@system-admin-tools
@system-management
@web-server
crypto-utils
fence-agents-all
%end
%post
cat >>/etc/yum.repos.d/base.repo<<eof
[base]
name=CentOS-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-7
eof
sed -i "s/ONBOOT.*$/ONBOOT=yes/" /etc/sysconfig/network-scripts/ifcfg-ens33 #设置网卡为启动
sed -i "s/rhgb //" /boot/grub/grub.conf # 设置启动系统时不使用图形进度条方
式
sed -i "s/HOSTNAME=.*$/HOSTNAME=xuexi.longshuai.com/" /etc/sysconfig/network #设置主机名
%end
有个小彩蛋,kickstart安装之后默认是起不来软件包选择项的需要修改yum源
PXE无人值守部署centos7.4操作系统的更多相关文章
- pxe+kickstart 无人值守安装CentOS7.1
CentOS6.6下PXE+Kickstart无人值守安装CentOS7.1操作系统 一.简介 1.1 什么是PXE Pxe(Pre-boot Execution Environment,预启动执行 ...
- Vmware部署Linux无人值守安装Centos7系统
Linux - 无人值守安装服务 # 需求分析 - 使用光盘镜像来安装 Linux 系统的方式; 坦白讲, 该方法适用于只安装少量 Linux 系统的情况, 如果生产环境中有数百台服务器都需安装系统, ...
- 第19章 使用PXE+Kickstart部署无人值守安装
章节概述: 本章节将教会您通过PXE+DHCP+TFTP+VSftpd+Kickstart服务程序搭建出无人值守安装系统,从而批量部署客户机系统. 这种系统能够实现自动化运维.避免了重复性劳动,帮助提 ...
- PXE无人值守实现批量化自动安装Linux系统
设想一个场景:假如让你给1000台服务器装系统,你会怎么做?跑去每一台服务器给它安装系统吗?显然不会.. 一.概括 通过网络引导系统的做法可以不必从硬盘.软盘或CD-ROM硬盘,而是完全通过网络来引导 ...
- Linux PXE无人值守网络装机
Linux PXE无人值守网络装机 一.实验环境: 2台Linux系统(RHEL6.5版本),1台作为:PXE远程安装服务器(安装dhcp服务.ftp服务.tftp服务),另1台作为:客户端(未装RH ...
- 在docker中部署centos7镜像
本篇文章参考自: https://www.cnblogs.com/linjj/p/5606911.html https://blog.csdn.net/u012767761/article/detai ...
- .net core 2.2 部署CentOS7(2)给虚拟机安装CentOS7
目录: .net core 2.2 部署CentOS7(1)安装虚拟机 .net core 2.2 部署CentOS7(2)给虚拟机安装CentOS7 .net core 2.2 部署CentOS7( ...
- 利用PXE引导安装centos7
# 利用PXE引导安装centos7 # ###简介### > PXE (Pre-boot Execution Environment,PXE client 在网卡的 ROM 中,当计算机引导时 ...
- PXE自动化部署
PXE 预启动执行环境,基于tftp条件下完成基于网络的自动化部署软件 原理: 网卡利用自身的tftp 请求dhcp 服务器获取ip和一个pxelinux.0的地址 在给定的tftp目录下存有ks的配 ...
随机推荐
- Java的TreeMap,C++的lower_bound,合并间隔
https://leetcode.com/problems/data-stream-as-disjoint-intervals/?tab=Description 这道题目是合并间隔的经典题目. htt ...
- Irrlicht 3D Engine 笔记系列 之 教程6- 2D Graphics
作者:i_dovelemon 日期:2015 / 7 / 1 来源: CSDN 主题:2D Graphics, Irrlicht 教程翻译 本篇教程将要向大家展示怎样使用Irrlicht引擎绘制2D图 ...
- 关于Android真机调測Profiler
u3d中的Profile也是能够直接在链接安卓设备执行游戏下查看的,导出真机链接U3D的Profile看数据,这样能更好的測试详细原因. 大概看了下官方的做法.看了几张帖子顺带把做法记录下来. 參考: ...
- Leaflet--建设移动设备友好的互动地图
Leaflet 是一个为建设移动设备友好的互动地图,而开发的现代的.开源的 JavaScript 库.它是由 Vladimir Agafonkin 带领一个专业贡献者团队开发,尽管代码仅有 33 KB ...
- Java 类和对象12
构造一辆汽车,油箱容量100L,当前里程数0,当前油量0,可以根据道路状况确定油耗,根据行驶速度与行驶时间, 输出当前油量与总里程数. public class Car_1 { // 车牌 priva ...
- 未能加载文件或程序集“MICROSOFT.REPORTVIEWER.WEBFORMS …
此类问题说明没有安装 REPORT .请下载 ReportViewer.msi 安装包. 和sqlsysclrtypes.msi 两个都是对应版本的安装包. 这样再次启动就不会报错了.
- EasyUI 之 DataGrid利用用拉姆达表达式实现分页查询
首先,我们在DataGrid的URL中加上我们要查询的条件:查询用户名不是“呵呵”的所有用户. <div> <table id="dg" class=&quo ...
- 最大优先队列 A - 奇怪的玩意
我们的化学生物学家发明了一种新的叫stripies非常神奇的生命.该stripies是透明的无定形变形虫似的生物,生活在果冻状的营养培养基平板菌落.大部分的时间stripies在移动.当他们两个碰撞, ...
- NodeJS学习笔记 (28)流操作-stream(ok)
模块概览 nodejs的核心模块,基本上都是stream的的实例,比如process.stdout.http.clientRequest. 对于大部分的nodejs开发者来说,平常并不会直接用到str ...
- [译] 我最终是怎么玩转了 Vue 的作用域插槽
原文链接:https://juejin.im/post/5c8856e6e51d456b30397f31#comment 原文地址:How I finally got my head around S ...