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的网络模式,支 ...
随机推荐
- 正整数序列Q中的每个元素都至少能被正整数a和b中的一个整除,现给定a和b,如何生成Q中的前几项
思路分析:可以与归并排序联系起来,给定两个变量A.B,变量A轮着存放:a*1,a*2,a*3,……变量组B轮着存放:b*1,b*2,b*3,……有两个整数i.j,分别代表A.B第i.j次存放的值,每次 ...
- VS 开发必用插件
C# outline --代码折叠 Indent Guides 虚线对齐 productivity power tools 功能集中在编辑.浏览以及其他常见的构造代码时会使用到的任务 Web Esse ...
- angular 4 和django 1.11.1 前后端交互 总结
首先 angular4 和django 1.11.1交互 有跨域问题 所以先关闭cors 和csrf验证 一.解决跨域问题 cors github django-cors-headers 1)安装co ...
- 关于JSON call 的一个小问题
如图当我们在做Json call 的时候,一定要切记,建立的model 一定要与JSON 字符串严格的一一对应,否者会解析不出来
- qt tableWidget 表格控件使用
//创建表格头 (灰色冻结状态的) QStringList header; header<<"Time"<<" ID "<< ...
- 实验一:基于STM32F1的流水灯实验(库函数)
参考原子哥学习程序 条件:实验板STM32103ZET6:固件库STM32F10x_StdPeriph_Lib_V3.5.0:环境MDK5: 目的:了解STM32 的 IO 口如何作为输出使用 :以两 ...
- ElasticSearch入门 第七篇:分词
这是ElasticSearch 2.4 版本系列的第七篇: ElasticSearch入门 第一篇:Windows下安装ElasticSearch ElasticSearch入门 第二篇:集群配置 E ...
- Eclipse各个版本区别
1.eclipse下载地址: 最新版:http://www.eclipse.org/downloads/ 历史版:http://archive.eclipse.org/eclipse/download ...
- express链接mysql, 用数据库连接池管理链接
1.在API的开发当中,数据库的处理显得尤为重要,express 工程 链接mysql数据库有很好的模板可以借鉴. 1.1 创建数据库链接 新建一个DB目录,在DB目录下新建文件 db.js 内容如下 ...
- HTTP缓存机制及原理
前言 Http 缓存机制作为 web 性能优化的重要手段,对于从事 Web 开发的同学们来说,应该是知识体系库中的一个基础环节,同时对于有志成为前端架构师的同学来说是必备的知识技能.但是对于很多前端同 ...