PXE安装操作系统
TFTP服务
用PXE安装操作系统依赖于DHCP服务和TFTP服务
网卡一般都内置的TFTP客户端的程序
systemctl enable tftp systemctl enable dhcpd
[root@centos7 dhcp]# yum install tftp-server
[root@centos7 dhcp]# rpm -ql tftp-server
/etc/xinetd.d/tftp
/usr/lib/systemd/system/tftp.service
/usr/lib/systemd/system/tftp.socket
/usr/sbin/in.tftpd
/usr/share/doc/tftp-server-5.2
/usr/share/doc/tftp-server-5.2/CHANGES
/usr/share/doc/tftp-server-5.2/README
/usr/share/doc/tftp-server-5.2/README.security
/usr/share/man/man8/in.tftpd..gz
/usr/share/man/man8/tftpd..gz
/var/lib/tftpboot
#安装客户端
[root@yxh6 ~]# yum install tftp
[root@yxh6 ~]# tftp 192.168.231.7
tftp> get file
#file存在服务端的/var/lib/tftpboot目录下
TFTP配置
搭建PXE服务器
[root@centos7 html]#yum install httpd
[root@centos7 html]# systemctl start httpd
[root@centos7 html]# vi /etc/fstab
/dev/sr0 /var/www/html/centos7 iso9660 defautls
[root@centos7 html]# mount -a
mount: /dev/sr0 is write-protected, mounting read-only
[root@centos7 html]# mkdir ksdir{,}
[root@centos7 html]# ls
centos6 centos7 ksdir6 ksdir7
[root@centos7 html]# cp /root/anaconda-ks.cfg ksdir7/ks7_desktop.cfg
[root@centos7 html]# cd ksdir7
[root@centos7 ksdir7]# ls
ks7_desktop.cfg
[root@centos7 ksdir7]# ll
total
-rw------- root root May : ks7_desktop.cfg
[root@centos7 ksdir7]# chmod ks7_desktop.cfg
[root@centos7 ksdir7]# ll
total
-rw-r--r-- root root May : ks7_desktop.cfg
准备yum源和ks文件
[root@centos7 dhcp]# vi dhcpd.conf
#配置和自动安装系统相关的配置 subnet 192.168.231.0 netmask 255.255.255.224 {
range 192.168.231.10 192.168.231.20;
option routers 192.168.231.254;
next-server 192.168.231.7;
filename "pxelinux.0";
} [root@centos7 dhcp]# systemctl restart dhcpd.service
[root@centos7 dhcp]# systemctl enable dhcpd httpd
配置DHCP
[root@centos7 dhcp]# yum install tftp-server syslinux
[root@centos7 dhcp]# cd /var/lib/tftpboot
[root@centos7 tftpboot]# mkdir pxelinux.cfg/
#pxelinux. 文件来自于 syslinux软件包,必须先安装syslinux
[root@centos7 tftpboot]# cp /usr/share/syslinux/pxelinux. .
[root@centos7 tftpboot]# cp /var/www/html/centos7/isolinux/{vmlinuz,initrd.img,vesamenu.c32} /var/lib/tftpboot/
[root@centos7 tftpboot]#cp /var/www/html/centos7/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@centos7 pxelinux.cfg]# vi default
label linux
menu label ^Install Desktop7
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.231.7/ksdir7/ks7_desktop.cfg
[root@centos7 pxelinux.cfg]#systemctl enable tftp.socket
[root@centos7 pxelinux.cfg]#systemctl start tftp
配置TFTP
#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
url --url=http://192.168.231.7/centos7
# Use graphical install
#graphical
text
# 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-
reboot
# Network information
network --bootproto=dhcp --device=ens33 --onboot=on --ipv6=auto --no-activate
network --hostname=centosmy7.localdomain # Root password
rootpw --iscrypted $$RzUIKaLkncGUm9SL$FtuXzR8IpSz2OEQp.LlDrDH1O62SMrZ/Gj06iTSNqlxWma/aHf21lpikhNln6UgNyuL/HqGUrM45feTBkMC1T0
# System services
services --disabled="chronyd"
# System timezone
timezone Asia/Shanghai --isUtc --nontp
# X Window System configuration information
xconfig --startxonboot
# System bootloader configuration
bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
zerombr
# Partition clearing information
clearpart --none --initlabel
# Disk partitioning information
part swap --fstype="swap" --ondisk=sda --size=
part / --fstype="xfs" --ondisk=sda --size=
part /data --fstype="xfs" --ondisk=sda --size=
part /boot --fstype="xfs" --ondisk=sda --size= %packages
@base
@core
@dial-up
@fonts
@guest-agents
@print-client
@x11
kexec-tools %end %addon com_redhat_kdump --enable --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 %post
systemctl disable initial-setup.service
systemctl disable initial-setup-graphical.service
systemctl set-default multi-user.target
mkdir -p /root/oscreate
useradd laozijiadeuser
%end
ks文件示例
新创建一个虚拟机,把网卡的网段设置成和服务器为同一个网段,启动机器出现下图

PXE安装多个版本的系统
安装不同版本的操作系统,需要分别拷贝对应的内核文件和ks文件,不能混合使用
mkdir /var/lib/tftpboot/pxelinux.cfg/
cp /usr/share/syslinux/pxelinux. /var/lib/tftpboot/
cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot/
mkdir /var/lib/tftpboot/centos{,} cp /var/www/html/centos//isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos7/
cp /var/www/html/centos//isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/centos6/ cp /var/www/html/centos//isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
vim /var/lib/tftpboot/pxelinux.cfg/default cat /var/lib/tftpboot/pxelinux.cfg/default cat /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
timeout menu title www.yxh.com label centos7
menu label ^Install Desktop CentOS
kernel centos7/vmlinuz
append initrd=centos7/initrd.img ks=http://192.168.30.17/ksdir/ks7_desktop.cfg label centos6
menu label install ^Mini CentOS
menu default
kernel centos6/vmlinuz
append initrd=centos6/initrd.img ks=http://192.168.30.17/ksdir/ks6_mini.cfg
label local
menu label Boot from ^local drive
localboot 0xffff
menu end
代码示例
tree /var/lib/tftpboot/
/var/lib/tftpboot/
├── centos6
│├── initrd.img
│└── vmlinuz
├── centos7
│├── initrd.img
│ └── vmlinuz
├── menu.c32
├── pxelinux.
└── pxelinux.cfg
└── default
文件结构目录
Linux配置服务的一般步骤
1.检查防火墙和selinux
2.安装包
3.启动服务
4.检查服务是否成功启动
5.在客户端执行命令测试
6.每个服务都有自己的工作主目录
PXE安装操作系统的更多相关文章
- PXE+Kickstart+DHCP+TFTP实现无人值守安装操作系统
PXE+Kickstart+DHCP+TFTP实现无人值守安装操作系统 PXE + Kickstart PXE的工作流程及配置文件 Kickstart的配置文件 Linux安装大致可以分为2个阶段 第 ...
- [转]CentOS 6.4下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- RHEL7下PXE+NFS+Kickstart无人值守安装操作系统
RHEL7下PXE+NFS+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] name= ...
- RHEL7下PXE+Apache+Kickstart无人值守安装操作系统
RHEL7下PXE+Apache+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] na ...
- CentOS 6.6下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- 【转载】CentOS 6.4下PXE+Kickstart无人值守安装操作系统
[转载]CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转自:CentOS 6.4下PXE+Kickstart无人值守安装操作系统 - David_Tang - 博客园 http ...
- Centos下PXE+Kickstart无人值守安装操作系统
一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...
- CentOS 7下PXE+Kickstart无人值守安装操作系统
1.简介 1.1. 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支 ...
随机推荐
- [Tensorflow] Cookbook - Neural Network
In this chapter, we'll cover the following recipes: Implementing Operational Gates Working with Gate ...
- [JS] Topic - define "class" by tricky methods
Ref:Javascript定义类(class)的三种方法 Javascript是一种基于对象(object-based)的语言,你遇到的所有东西几乎都是对象.但是,它又不是一种真正的面向对象编程(O ...
- 【GIS】无人机影像数据关系换算(转)
----------------------------------------------------------------------------------------------- H=f× ...
- ios 消除 字符串 首尾空格
本文转载至 http://blog.csdn.net/reylen/article/details/8233353 (1)系统去首尾空格方法,使用NSString中的str = [str string ...
- mongodb new file allocation failure
话说那天正在向mongodb中写入数据,突然就蹦出了 new file allocation failure ,以为是数据有错误,就检查了一番,可没问题啊,看着像是mongo自己的问题,于是百度了一番 ...
- POJ 1958 Strange Towers of Hanoi
Strange Towers of Hanoi Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 3784 Accepted: 23 ...
- 从一条巨慢SQL看基于Oracle的SQL优化(重磅彩蛋+PPT)
本文根据DBAplus社群第110期线上分享整理而成,文末还有好书送哦~ 讲师介绍 丁俊 新炬网络首席性能优化专家 SQL审核产品经理 DBAplus社群联合发起人.<剑破冰山-Oracle开发 ...
- 【每日一题】 UVA - 213 Message Decoding 模拟解码+读入函数+阅读题
题意:阅读理解难度一道比一道难orz.手摸了好久样例 题解: 读入:大循环用getline读入header顺便处理一下, 里面再写两重循环,外层一次读三个串,内层一次读num个串. 之后就查表,线性 ...
- 启用hive hwi方法
hive启动hwi: ./hive --service hwi ls: cannot access /opt/cdh-5.3.6/hive-0.13.1/lib/hive-hwi-*.war: No ...
- MyCAT 在 Cobar 的基础上,完成了彻底的 NIO 通讯,并且合并了两个线程池
研读: 1.http://www.mycat.io <Mycat权威指南> 第 2 章 Mycat 前世今生: 浏览: 深度认识 Sharding-JDBC:做最轻量级的数据库中间层 - ...