使用tftp、dhcp、nfs,网络PEX批量部署linux

简介:

[root@www ~]# yum install tftp-server -y 安装tftp服务 安装完启动

[root@www mnt]# vi /etc/xinetd.d/tftp 修改tfpt配置
service tftp
{
        disable = no
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -u nobody -s /tftpboot
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}
 
 
[root@www ~]# netstat -tunlp |grep 69 确保69端口打开状态
 
[root@www ~]# yum install dhcp -y 安装dhcp服务(安装过程出错,卸载dhclient安装成功)
 
[root@www ~]# vi /etc/dhcp/dhcpd.conf 修改dhcp配置文件
 
option domain-name "cnnb.com";
option domain-name-server 220.189.220.67;
filename "pxelinux.0";
net-server 192.168.0.241;
default-lease-time 600;
max-lease-time 7200;
 
subnet 192.168.0.0 netmask 255.255.255.0{
range 192.168.0.242 192.168.0.243;
option broadcast-address 192.168.0.0;
}
 
 
 
[root@www mnt]# mkdir -p /tftpboot 创建dhcp服务指定目录
[root@www tftpboot]# cd /tftpboot/ 进入目录
[root@localhost tftpboot]# yum install syslinux -y
[root@www tftpboot]# cp /usr/share/syslinux/pxelinux.0  ./ 复制pxelinux.0配置文件到/tftpboot
 
 
[root@www tftpboot]# mount -t iso9660 /dev/cdrom /mnt/cdrom/ 挂载centos系统镜像
[root@localhost tftpboot]# cp /mnt/cdrom/isolinux/vmlinuz ./
[root@localhost tftpboot]# cp /mnt/cdrom/isolinux/initrd.img  ./
[root@www tftpboot]# mkdir -p pxelinux.cfg 创建PXE服务的配置文件夹
[root@www tftpboot]# cp /mnt/cdrom/isolinux//isolinux.cfg pxelinux.cfg/default 复制ISO镜像中的isolinux.cfg 并重命名为default
[root@www tftpboot]# vi pxelinux.cfg/default  配置默认的配置
default linux
#prompt 1
timeout 10
 
display boot.msg
 
menu background splash.jpg
menu title Welcome to CentOS 6.0!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000
 
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append ks=nfs:192.168.0.241:/centosinstall/ks.cfg  ksdevice=eth0 initrd=initrd.img
 
 
label linux
  menu label ^Install or upgrade an existing system
  menu default
  kernel vmlinuz
  append initrd=initrd.img
label vesa
  menu label Install system with ^basic video driver
  kernel vmlinuz
  append initrd=initrd.img xdriver=vesa nomodeset
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff
 
 配置好后重启tftp
 
[root@www tftpboot]# mkdir -p /centosinstall 创建NFS的ISO镜像目录
[root@www tftpboot]# cp -rf /mnt/cdrom/* /centosinstall/ 复制镜像中的文件到/centosinstall/
 
[root@www mnt]# vi /etc/exports 设置共享
/centosinstall *(rw,sync)
 
[root@www mnt]# cd /centosinstall/ 进入/centosinstall/文件夹
[root@www centosinstall]# vi ks.cfg 创建ks.cfg配置文件
#ckstart file automatically generated by anaconda.
install
text
nfs --server=192.168.0.241 --dir=/centosinstall
key --skip
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto=dhcp --noipv6
rootpw 87688768
firewall --disabled
authconfig --enableshadow --enablemd5
selinux --disabled
timezone Asia/Shanghai
bootloader --location=mbr --driveorder=sda --append="rhgb quiet"
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
clearpart --all --initlabel
part /boot --fstype ext4 --size=100
part swap --size=8196
part / --fstype ext4 --size=100 --grow
 
[root@www centosinstall]# chmod 777 ks.cfg  将ks.cfg文件权限设置为777
 
service    xinetd  restart  &&  service nfs restart  && service  dhcpd restart 重启所有相关服务
 
 本文转自lustlost 51CTO博客,原文链接:http://blog.51cto.com/lustlost/844226,如需转载请自行联系原作者
相关文章
|
4月前
|
安全 Linux 网络安全
Nipper 3.9.0 for Windows & Linux - 网络设备漏洞评估
Nipper 3.9.0 for Windows & Linux - 网络设备漏洞评估
141 0
Nipper 3.9.0 for Windows & Linux - 网络设备漏洞评估
|
5月前
|
运维 Linux 开发者
Linux系统中使用Python的ping3库进行网络连通性测试
以上步骤展示了如何利用 Python 的 `ping3` 库来检测网络连通性,并且提供了基本错误处理方法以确保程序能够优雅地处理各种意外情形。通过简洁明快、易读易懂、实操性强等特点使得该方法非常适合开发者或系统管理员快速集成至自动化工具链之内进行日常运维任务之需求满足。
337 18
|
5月前
|
网络协议 关系型数据库 Linux
【App Service Linux】在Linux App Service中安装 tcpdump 并抓取网络包
在App Service for Linux环境中,无法像Windows一样直接使用网络排查工具抓包。本文介绍了如何通过TCPDUMP在Linux环境下抓取网络包,包括SSH进入容器、安装tcpdump、执行抓包命令及下载分析文件的完整操作步骤。
268 5
|
6月前
|
NoSQL 关系型数据库 Linux
ERPNext 搭建教程:Linux 一键部署与维护
ERPNext 是一款开源免费的企业资源计划系统,适用于中小企业信息化管理。基于 Python 和 Frappe 框架开发,支持财务、销售、人力、库存等模块,具备高度可定制性。本文介绍如何通过 Websoft9 在 Linux 下快速部署 ERPNext,并提供环境配置、系统维护等实用建议,适合开发者和企业用户快速上手。
1033 7
ERPNext 搭建教程:Linux 一键部署与维护
|
6月前
|
Web App开发 网络协议 Linux
【Linux】网络基础
TCP/IP五层模型是网络通信的基础框架,将复杂的数据传输过程分为物理层、数据链路层、网络层、传输层和应用层,每层各司其职,协同完成远程通信。该模型确保了不同设备和网络之间的互联互通,是现代互联网运行的核心机制。
460 5
|
6月前
|
Java Linux 网络安全
Linux云端服务器上部署Spring Boot应用的教程。
此流程涉及Linux命令行操作、系统服务管理及网络安全知识,需要管理员权限以进行配置和服务管理。务必在一个测试环境中验证所有步骤,确保一切配置正确无误后,再将应用部署到生产环境中。也可以使用如Ansible、Chef等配置管理工具来自动化部署过程,提升效率和可靠性。
661 13
|
6月前
|
关系型数据库 Linux Nacos
Rocky Linux 部署 Docker 和 NACOS 实例
本文介绍在阿里云环境下基于 Rocky Linux 搭建 Docker 并部署 Nacos 的完整流程。涵盖 Docker 安装、镜像加速配置、网络设置及 MySQL 与 Nacos 容器的创建,适用于开发与生产环境。
872 0
|
6月前
|
网络协议 Linux 开发者
深入Linux中UDP网络通信机制编程探索
以上步骤概述了Linux中UDP网络通信的编程机制。在实现时,因关注细节和上下文环境可能有所调整,但大致流程是一致的。这些知识片段旨在帮助开发者快速上手Linux下的UDP编程,并提供可靠的信息作为编程的基础。在编程实践中,应结合实际业务需求,设计合适的数据传输协议,确保数据的正确性和实时性。
170 0
|
8月前
|
安全 网络协议 Linux
Linux网络应用层协议展示:HTTP与HTTPS
此外,必须注意,从HTTP迁移到HTTPS是一项重要且必要的任务,因为这不仅关乎用户信息的安全,也有利于你的网站评级和粉丝的信心。在网络世界中,信息的安全就是一切,选择HTTPS,让您的网站更加安全,使您的用户满意,也使您感到满意。
237 18