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,如需转载请自行联系原作者



相关文章
|
1月前
|
Linux
Linux安装NFS挂载NFS卸载客户端服务端都有
Linux安装NFS挂载NFS卸载客户端服务端都有
41 0
|
1月前
|
Ubuntu 网络协议 Unix
【Linux】新唐NUC977挂载NFS实现网络文件传输
【Linux】新唐NUC977挂载NFS实现网络文件传输
|
2月前
|
Linux Shell Windows
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
通过Linux挂载Windows端NFS服务实现板端Linux传输文件到PC
|
5天前
|
域名解析 Unix Linux
AIX上如何正确挂载Linux 的nfs共享目录分享篇
AIX上如何正确挂载Linux 的nfs共享目录分享篇
|
17天前
|
监控 负载均衡 网络协议
|
17天前
|
网络协议 Linux iOS开发
|
29天前
|
Unix Linux Shell
linux 配置NFS
NFS(Network File System)是跨平台的网络文件系统,允许不同操作系统和硬件通过RPC协议共享文件系统。服务端启动RPC服务和NFS,注册端口信息。客户端请求服务器的NFS端口,建立连接进行数据传输。优点包括配置简单、数据可靠、支持多系统间文件共享。缺点包括端口不固定、数据明文传输、安全性较低(基于IP认证)。在Redhat 9环境下,通过安装nfs-utils和rpcbind,配置共享目录和exports文件,设置权限,客户端安装相同软件包,使用showmount命令查看共享,挂载NFS目录,实现透明访问。
35 1
|
1月前
|
数据采集 存储 API
网络爬虫与数据采集:使用Python自动化获取网页数据
【4月更文挑战第12天】本文介绍了Python网络爬虫的基础知识,包括网络爬虫概念(请求网页、解析、存储数据和处理异常)和Python常用的爬虫库requests(发送HTTP请求)与BeautifulSoup(解析HTML)。通过基本流程示例展示了如何导入库、发送请求、解析网页、提取数据、存储数据及处理异常。还提到了Python爬虫的实际应用,如获取新闻数据和商品信息。
|
2月前
|
数据采集 机器学习/深度学习 算法框架/工具
利用Python实现基于图像识别的自动化数据采集系统
本文介绍了如何利用Python编程语言结合图像识别技术,构建一个自动化的数据采集系统。通过分析图像内容,实现对特定信息的提取和识别,并将其转化为结构化数据,从而实现高效、准确地采集需要的信息。本文将详细讨论系统的设计思路、技术实现以及应用场景。
|
2月前
|
Web App开发 Python
在ModelScope中,你可以使用Python的浏览器自动化库
在ModelScope中,你可以使用Python的浏览器自动化库
18 2