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安装操作系统的更多相关文章

  1. PXE+Kickstart+DHCP+TFTP实现无人值守安装操作系统

    PXE+Kickstart+DHCP+TFTP实现无人值守安装操作系统 PXE + Kickstart PXE的工作流程及配置文件 Kickstart的配置文件 Linux安装大致可以分为2个阶段 第 ...

  2. [转]CentOS 6.4下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  3. CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  4. RHEL7下PXE+NFS+Kickstart无人值守安装操作系统

    RHEL7下PXE+NFS+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] name= ...

  5. RHEL7下PXE+Apache+Kickstart无人值守安装操作系统

    RHEL7下PXE+Apache+Kickstart无人值守安装操作系统 1.配置yum源 vim /etc/yum.repos.d/development.repo [development] na ...

  6. CentOS 6.6下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  7. 【转载】CentOS 6.4下PXE+Kickstart无人值守安装操作系统

    [转载]CentOS 6.4下PXE+Kickstart无人值守安装操作系统 转自:CentOS 6.4下PXE+Kickstart无人值守安装操作系统 - David_Tang - 博客园 http ...

  8. Centos下PXE+Kickstart无人值守安装操作系统

    一.简介 1.1 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持 ...

  9. CentOS 7下PXE+Kickstart无人值守安装操作系统

    1.简介 1.1. 什么是PXE PXE(Pre-boot Execution Environment,预启动执行环境)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支 ...

随机推荐

  1. [Bayes] Improve HMM step by step

    以下是HMM,当emission probability变为高斯时,只需改变其中相关部分即可,也就是下图最后一行. 如下可见,在优化过程中套路没有太大的影响,但变为高斯后表达变得更精确了呢. 当然,这 ...

  2. iOS - WKWebView加载不受信任的https (因用到IP地址加端口号去请求数据)

    1.描述:因公司域名临时出现问题,所以项目中引用到了IP地址加端口号去请求数据,因而造成在wkwebView中某些网址打不开,查看错误是因为服务器证书无效,实际就是不受信任; 2.解决办法:在plis ...

  3. Cannot change version of project facet Dynamic Web Module to 3.0 异常问题处理

    如何解决Tomcat服务器在初始化应用的时候的以下异常问题 1,Cannot change version of project facet Dynamic Web Module to 3.0 2,O ...

  4. 利用System.Uri转URL为绝对地址

    在使用ASPOSE.Word生成Word文档时可以通过InsertHtml(html)来将图文信息写入Word文档(图片内嵌),但要求html里图片的src是绝对全路径,所以需要对html进行转化. ...

  5. ifnull与nvl

    mysql 用 ifnull ,oracle没有ifnull 但是有相应的替换函数  nvl NVL(eExpression1, eExpression2)

  6. Arm v8 中断处理

    转 https://blog.csdn.net/firefox_1980/article/details/40113637

  7. Docker Macvlan网络部署

    Macvlan Bridge模式 节点1创建 docker network create -d macvlan --subnet=172.100.1.0/24 --gateway=172.100.1. ...

  8. DB2 Version 10.5 补丁下载

    DB2 Version 10.5 for Linux, UNIX, and Windows fix pack summary https://www.ibm.com/support/knowledge ...

  9. Jexus .Net at System.Net.Sockets.Socket.Connect (System.Net.IPAddress[] addresses, System.Int32 port)

    环境:Jexus(独立版)+MVC(5.2.3) +Redis+EF(6.0) Application Exception System.Net.Sockets.SocketException Con ...

  10. Caused by: org.postgresql.util.PSQLException: ERROR: operator does not exist: character varying = integer

    Springboot项目,使用postgresql数据库,mybatis做持久层框架, <select id="select" resultMap="BaseRes ...