PXE DHCP TFTP NFS自动化部署Linux系统

简介:

1、安装准备工作

内核、根文件系统存放目录 系统文件存放目录 ks文件存放目录
/tftpboot/系统名/ /pxe/iso/系统名/ /pxe/ks/系统名/

mkdir  -p /tftpboot/{redhat6.6,centos6.5,pxelinux.cfg}

mkdir -p /pxe/iso/centos6.5 /pxe/iso/redhat6.6

mkdir -p /pxe/ks/centos6.5 /pxe/ks/redhat6.6


mount -o loop /iso/CentOS6.5_X86.iso /pxe/iso/centos6.5/

mount -o loop /iso/Redhat6.6_X86.iso /pxe/iso/redhat6.6/


2、安装DHCP、TFTP、NFS

yum -y install dhcp* nfs* tftp*


3、配置DHCP

vim /etc/dhcp/dhcpd.conf


allow booting;

allow bootp;

ignore client-updates;

option routers 172.16.1.254;

option subnet-mask 255.255.255.0;

subnet 172.16.1.0 netmask 255.255.255.0{

        range 172.16.1.150 172.16.1.200;

        next-server 172.16.1.254;

        filename "pxelinux.0";

}


vim /etc/rc.d/init.d/dhcpd

将user=dhcpd、group=dhcpd改为user=root、group=root


chkconfig dhcpd on

service dhcpd start


4、配置NFS

vi  /etc/exports


/pxe/iso/centos6.5 *(rw,sync)

/pxe/ks/centos6.5 *(rw,sync)

/pxe/iso/redhat6.6 *(rw,sync)

/pxe/ks/redhat6.6 *(rw,sync)


chkconfig nfs on

service nfs start


5、配置TFTP

vim /etc/xinetd.d/tftp


service tftp

{

socket_type= dgram

protocol= udp

wait= yes

user= root

server= /usr/sbin/in.tftpd

server_args= -s /tftpboot

disable= no

per_source= 11

cps= 100 2

flags= IPv4

}

chkconfig xinetd on

service xinetd start


通用配置引导文件、配置文件  

cd  /tftpboot  

cp /usr/share/syslinux/pxelinux.0 ./

cp /pxe/iso/centos6.5/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default


差异配置内核文件、根文件系统文件

cp /pxe/iso/centos6.5/images/pxeboot/vmlinuz /pxe/iso/centos6.5/images/pxeboot/initrd.img /tftpboot/centos6.5/

cp  /pxe/iso/redhat6.6/images/pxeboot/{vmlinuz,initrd.img}   /tftpboot/redhat6.6/


6、在/tftpboot目录下新建boot.msg文件

vim /tftpboot/boot.msg

################################################################

Please select system:

redhat6.6

centos6.5

################################################################


7、修改配置文件

vim /tftpboot/pxelinux.cfg/default


timeout 60


display boot.msg


label redhat6.6

 kernel redhat6.6/vmlinuz

 append ks=nfs:172.16.1.254:/pxe/ks/redhat6.6/ks.cfg ksdevice=eth0 initrd=redhat6.6/initrd.img

label centos6.5

 kernel centos6.5/vmlinuz

 append ks=nfs:172.16.1.254:/pxe/ks/centos6.5/ks.cfg ksdevice=eth0 initrd=centos6.5/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

label memtest86

  menu label ^Memory test

  kernel memtest

  append 



8、生成ks.cfg文件

#platform=x86, AMD64, or Intel EM64T

#version=DEVEL

# Firewall configuration

firewall --disabled

# Install OS instead of upgrade

install

# Use NFS installation media

nfs --server=172.16.1.254 --dir=/pxe/iso/centos6.5

# Root password

rootpw --iscrypted $1$OpOihMEn$H4fb.ML21Qxq1BeVJB/Fr0

# System authorization information

auth  --useshadow  --passalgo=sha512

# Use graphical install

graphical

firstboot --disable

# System keyboard

keyboard us

# System language

lang en_US

# SELinux configuration

selinux --disabled

# Installation logging level

logging --level=info

# Reboot after installation

reboot

# System timezone

timezone  Africa/Abidjan

# System bootloader configuration

bootloader --location=mbr

# Clear the Master Boot Record

zerombr

# Partition clearing information

clearpart --all --initlabel 

# Disk partitioning information

part /boot --asprimary --fstype="ext4" --size=1024

part swap --asprimary --fstype="swap" --size=1024

part / --asprimary --fstype="ext4" --grow --size=1


%packages

@base


%end


9、客户端测试

wKioL1YKU0Kh4VwVAAK3ooeOfxc147.jpg






      本文转自开源殿堂 51CTO博客,原文链接:http://blog.51cto.com/kaiyuandiantang/1699236,如需转载请自行联系原作者



相关文章
|
6月前
|
Web App开发 编解码 Linux
使用Selenium自动化测试解决报告生成失败问题及Linux部署指南
这篇文章介绍了使用Selenium自动化测试解决报告生成失败问题的方法,包括Linux环境下的部署指南和代码实现。
83 1
使用Selenium自动化测试解决报告生成失败问题及Linux部署指南
|
6月前
|
Ubuntu Linux 持续交付
在Linux中,如何在Linux中使用Ansible进行自动化部署?
在Linux中,如何在Linux中使用Ansible进行自动化部署?
|
6月前
|
存储 监控 Linux
|
6月前
|
运维 Linux 持续交付
在Linux中,如何进行配置管理和自动化部署?
在Linux中,如何进行配置管理和自动化部署?
|
6月前
|
存储 运维 监控
|
7月前
|
Shell Linux
Linux Shell 脚本入门教程:开启你的自动化之旅
Shell是一种计算机程序,它充当了用户与操作系统之间的接口。在Linux系统中,Shell允许用户通过命令行界面(CLI)来控制计算机。Shell脚本则是一种使用Shell语言编写的脚本,它可以自动执行一系列的命令,帮助用户实现任务自动化,提高工作效率。
175 2
|
8月前
|
关系型数据库 MySQL Shell
【权限提升】Linux系统&环境变量&定时任务&权限配置不当&MDUT自动化
【权限提升】Linux系统&环境变量&定时任务&权限配置不当&MDUT自动化
151 4
|
7月前
|
Linux 持续交付 Apache
在Linux中通过ansible自动化部署apache服务
【7月更文挑战第11天】Linux中用Ansible自动化部署Apache服务:1. 确保Ansible已安装;2. 在`/etc/ansible/hosts`配置目标主机,如\[webservers\] server1 server2;3. 编写Playbook `apache_deploy.yml`更新系统并安装、启动Apache;4. 执行`ansible-playbook apache_deploy.yml`。适用于快速部署至多台服务器,减少配置错误和成本。
|
9月前
|
存储 数据管理 Java
基于OSS、NFS构建高性能可扩展的遥感智能解译系统实践之路
该文探讨了构建高性能、可扩展的遥感智能解译系统的架构演进过程。作者强调架构应根据业务场景而定,而非追求单一的“最佳”架构。文章分为五个部分,介绍了从初步的业务场景分析到逐步优化的架构设计。 1. 业务场景描述了服务于地理信息行业的遥感数据管理平台,包括数据湖和遥感智能解译系统的功能和架构设计。 2. 初代系统解决了数据管理和智能解译的基本需求,但存在数据同步效率低下的问题。 3. 自动化阶段通过消息推送和数据接收模块减少了人工干预,将处理时间减半,但仍存在效率和稳定性问题。 4. 高性能阶段引入数据订阅/推送和数据接收Agent,实现了稳定、高速的数据传输,性能提升了6倍。
48887 2
|
8月前
|
NoSQL 编译器 Linux
【Linux】--- Linux编译器-gcc/g++、调试器-gdb、项目自动化构建工具-make/Makefile 使用
【Linux】--- Linux编译器-gcc/g++、调试器-gdb、项目自动化构建工具-make/Makefile 使用
145 0