Centos7 pxe
yum install dnsmasq
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
# vim /etc/dnsmasq.conf
interface=eth0,lo
#bind-interfaces
domain=centos7.lan
# DHCP range-leases
dhcp-range= eth0,10.10.0.20,10.10.0.30,255.255.255.0,1h
# PXE
dhcp-boot=pxelinux.,pxeserver,192.168.1.20
# Gateway
dhcp-option=,10.10.0.240
# DNS
dhcp-option=,10.10.0.240,114.114.114.114
server=114.114.114.114
# Broadcast Address
dhcp-option=,10.0.0.255
# NTP Server
dhcp-option=,0.0.0.0 pxe-prompt="Press F8 for menu.",60
pxe-service=x86PC,"Install CentOS 7 from network server 10.10.0.240", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot
interface – 服务器需要监听并提供服务的网络接口。
bind-interfaces – 取消注释来绑定到该网络接口
domain – 替换为你的域名。
dhcp-range – 替换为你的网络掩码定义的网段。
dhcp-boot – 替换该IP地址为你的网络接口IP地址。
dhcp-option=,192.168.1.1 – 替换该IP地址为你的网段的网关。
dhcp-option=,92.168.1.1 – 替换该IP地址为你的DNS服务器IP——可以定义多个IP地址。h
server=8.8.4.4 – 这里放置DNS转发服务器IP地址。
dhcp-option=,10.0.0.255 – 替换该IP地址为网络广播地址——可选项。
dhcp-option=,0.0.0.0 – 这里放置网络时钟服务器——可选项(0.0..0地址表示参考自身)。
pxe-prompt – 保持默认——按F8进入菜单,60秒等待时间。
pxe=service – 使用x86PC作为32为/64位架构,并在字符串引述中输入菜单描述提示。其它类型值可以是:PC98,IAEFI,Alpha,Arcx86,IntelLeanClient,IA32EFI,BCEFI,XscaleEFI和X86-64EFI。
enable-tftp – 启用内建TFTP服务器。
tftp-root – 使用/var/lib/tftpboot——所有网络启动文件所在位置。 yum install syslinux
yum install tftp-server
cp -r /usr/share/syslinux/* /var/lib/tftpboot
mkdir /var/lib/tftpboot/pxelinux.cfg
touch /var/lib/tftpboot/pxelinux.cfg/default
Vim /var/lib/tftpboot/pxelinux.cfg/default
default menu.c32
prompt
timeout
ONTIMEOUT local menu title ########## PXE Boot Menu ########## label
menu label ^)InstallCentOS7 x64 withLocalRepo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://10.10.0.240/pub devfs=nomount label
menu label ^)InstallCentOS7 x64 with http://mirror.centos.org Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=http://mirror.centos.org/centos//os/x86_64/ devfs=nomount ip=dhcp label
menu label ^)InstallCentOS7 x64 withLocalRepousing VNC
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://10.10.0.240/pub devfs=nomount inst.vnc inst.vncpassword=password label
menu label ^)Bootfromlocal drive mount /dev/sr0 /mnt
# ls /mnt/
mkdir /var/lib/tftpboot/centos7
cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7
cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7
yum install vsftpd
cp -r /mnt/* /var/ftp/pub/
chmod -R /var/ftp/pub
systemctl start dnsmasq
systemctl status dnsmasq
systemctl start vsftpd
systemctl status vsftpd
systemctl enable dnsmasq
systemctl enable vsftpd
# netstat -tulpn
# firewall-cmd --add-service=ftp --permanent ## Port
# firewall-cmd --add-service=dns --permanent ## Port
# firewall-cmd --add-service=dhcp --permanent ## Port
# firewall-cmd --add-port=/udp --permanent ## Port for TFTP
# firewall-cmd --add-port=/udp --permanent ## Port for ProxyDHCP
# firewall-cmd --reload ## Apply rules tailf /var/log/messages
# umount /dev/sr0
# PXE安装脚本
# 安装前配置好centos和epel yum源
# 网卡ip和localip一致
localip="10.10.0.240"
eth_name='eth0' dnsmasq_install() {
yum -y install dnsmasq
mv /etc/dnsmasq.conf /etc/dnsmasq.conf.backup
dnsmasq_conf='interface='$eth_name'
#bind-interfaces
domain=centos7.lan
# DHCP range-leases
dhcp-range= '$eth_name',10.10.0.100,10.10.0.110,255.255.255.0,1h
# PXE
dhcp-boot=pxelinux.0,pxeserver,'$localip'
# Gateway
dhcp-option=3,'$localip'
# DNS
dhcp-option=6,'$localip',114.114.114.114
server=114.114.114.114
# Broadcast Address
dhcp-option=28,10.10.0.255
# NTP Server
dhcp-option=42,0.0.0.0 pxe-prompt="Press F8 for menu.",60
pxe-service=x86PC,"Install CentOS 7 from network server '$localip'", pxelinux
enable-tftp
tftp-root=/var/lib/tftpboot'
echo "$dnsmasq_conf" > /etc/dnsmasq.conf
}
tftp_pxe_install() {
yum -y install syslinux
yum -y install tftp-server
cp -r /usr/share/syslinux/* /var/lib/tftpboot/
if [[ ! -d /var/lib/tftpboot/pxelinux.cfg ]]
then
mkdir /var/lib/tftpboot/pxelinux.cfg
touch /var/lib/tftpboot/pxelinux.cfg/default
default_conf='default menu.c32
prompt 0
timeout 300
ONTIMEOUT local menu title ########## PXE Boot Menu ########## label 1
menu label ^1)InstallCentOS7 x64 withLocalRepo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://'$localip'/pub devfs=nomount label 2
menu label ^2)InstallCentOS7 x64 with http://mirror.centos.org Repo
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=http://mirror.centos.org/centos/7/os/x86_64/ devfs=nomount ip=dhcp label 3
menu label ^3)InstallCentOS7 x64 withLocalRepousing VNC
kernel centos7/vmlinuz
append initrd=centos7/initrd.img method=ftp://'$localip'/pub devfs=nomount inst.vnc inst.vncpassword=password label 4
menu label ^4)Bootfromlocal drive'
echo "$default_conf" > /var/lib/tftpboot/pxelinux.cfg/default
fi
}
mount_cd() {
mount|grep '^/dev/sr0'
if [[ $? -eq ]]
then
echo '光盘已挂载。'
else
mount /dev/sr0 /mnt/ &> /dev/null
if [[ $? -ne ]]
then
count=$(( $count + ))
if [[ $count -eq ]];then
echo '超时退出';
exit ;
fi
echo "sr0没有光盘,挂载失败,将在5秒后重试"
sleep
mount_cd
else
echo '光盘挂载成功。';
fi
fi
}
confing_pxeserver() {
if [[ ! -d /var/lib/tftpboot/centos7 ]];then
mkdir /var/lib/tftpboot/centos7
cp /mnt/images/pxeboot/vmlinuz /var/lib/tftpboot/centos7/
cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/centos7/
fi
yum -y install vsftpd
if [[ `ls -A /var/ftp/pub/` == "" ]];then
echo 'copy光盘文件到/var/ftp/pub/ ...';
cp -r /mnt/* /var/ftp/pub/
chmod -R /var/ftp/pub
fi
}
start_service() {
systemctl start dnsmasq
systemctl status dnsmasq
systemctl start vsftpd
systemctl status vsftpd
systemctl enable dnsmasq
systemctl enable vsftpd
} dnsmasq_install
tftp_pxe_install
mount_cd
confing_pxeserver
start_service
Centos7 pxe的更多相关文章
- CentOS7 PXE安装批量安装操作系统
1.安装相关软件 yum -y install tftp-server httpd dhcp syslinux 2.配置DHCP cp /usr/share/doc/dhcp-4.2.5/dhcpd. ...
- 自动化安装操作系统(Centos7+PXE+Cobbler+kickstart)
一.简介 PXE称作是一种引导方式而不是安装方式似乎更加准确,PXE(Pre-boot Execution Environment)是由Intel设计的协议,它可以使计算机通过网络启动,但是有一个前提 ...
- centos7 PXE自动安装环境搭建
原理: 要进行自动安装的主机A,加电启动时以网卡为第一启动设备 1.启动时会向网络广播,找到dhcp服务器B请求分配IP地址信息,服务器B除了给其分配基本的IP信息(ip.netmask.getewa ...
- Centos7 PXE Server Install Script
#安装前配置好centos和epel yum源 #网卡ip和localip一致 localip="192.168.88.200" eth_name='eth0' dnsmasq_i ...
- centos7 pxe minimal install
# 01-78-2b-cb-69-10-f3 default menu.c32 prompt 0 timeout 50 label CentOS 7 MENU DEFAULT MENU LABEL C ...
- 一键部署pxe环境
系统:Centos6.5 环境:VMware Workstation12 #!/bin/bash # Please prepare CentOS ISO image first # root pass ...
- (转)Cobbler无人值守批量安装Linux系统
本文目录: 1.1 pxe安装系统 1.2 cobbler基本介绍 1.3 安装和配置cobbler 1.3.1 安装cobbler 1.3.2 配置dhcp和tftp 1.4 cobbler从本地光 ...
- PXE+Kickstart 全自动安装部署CentOS7.4
一.简介 1.什么是PXE PXE(preboot execute environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站通过 ...
- pxe自动化批量安装系统(Centos7)
PXE:preboot execute environment 环境实现:主服务器ip:10.0.10.1 1 tfpt trivial简单文件共享服务,基于udp协议工作: 加载系统安装程序: 69 ...
随机推荐
- 021_IO流
IO流 I——input 输入 O——Output 输出 文件 File 所有文件类的父类 创建方式 File file = new File("文件路径"); 文件对象常用的方法 ...
- 并发新构件之Exchanger:交换器
Exchanger:JDK描述:可以在对中对元素进行配对和交换的线程的同步点.每个线程将条目上的某个方法呈现给 exchange 方法,与伙伴线程进行匹配,并且在返回时接收其伙伴的对象.Exchang ...
- 为Python终端提供持久性历史记录
有没有办法告诉交互式Python shell在会话之间保留其执行命令的历史记录? 当会话正在运行时,在执行命令之后,我可以向上箭头并访问所述命令,我只是想知道是否有某种方法可以保存这些命令,直到下次我 ...
- C语言结构体内存分配详情
#include <stdio.h> int main() { /*************************************************** * * 结构体内存 ...
- D3.js(v3)+react 制作 一个带坐标与比例尺的散点图 (V3版本)
上一章做了柱形图,https://www.cnblogs.com/littleSpill/p/10835041.html 这一章做散点图. 散点图(Scatter Chart),通常是一横一竖 ...
- 小白如何在Windows下使用Redis
一.redis下载按装 Nuget 可以直接下载 redis 将下来的包拷贝到自已需要的目录如我放到桌面文件夹“近期需要\Redis应用\redis-64.3.0.503” 操作 cmd进入命令操作 ...
- WdatePicker设置时间与倒计时
之前苦于jQuery的datetimepicker插件不知道如何设置秒数,用了同学推荐的WdatePicker,真心好用. 相关文档用法可以上http://www.my97.net/dp/index. ...
- zic2xpm - 将 ZIICS 象棋片段 (chess pieces) 转换为 XBoard (XPM/XIM) 片段的工具。
总览 SYNOPSIS zic2xpm file1 [file2 ...] 描述 zic2xpm 将一个或多个 ZIICS 片段文件转换为 XBoard 可用的格式.如果你给出一个以上的文件名,小心同 ...
- 15_TLB中的G属性
> TLB 是为了增加访问内存的效率 即 如果 是 29 9 12 分页 请求数据 可能需要访问 4次内存:为了解决这个问题:出现了 TLB (虚拟地址到物理地址的转换关系),如果目标地址在TL ...
- Bash 脚本 set 命令教程
http://www.ruanyifeng.com/blog/2017/11/bash-set.html set命令是 Bash 脚本的重要环节,却常常被忽视,导致脚本的安全性和可维护性出问题.本文介 ...