首页 | 资讯动态 | linux基础 | 系统管理 | 网络管理 | 编程开发 | linux数据库 | 服务器技术 | linux相关 | linux认证 | 嵌入式 | 下载中心 | 专题 | linux招聘 | HR | 镜像
OKLinux中文技术站
·设为首页
·加入收藏
·联系我们
系统管理: 中文环境 系统管理 桌面应用 内核技术 | Linux基础: 基础入门 安装配置 常用命令 经验技巧 软件应用 | Linux数据库: Mysql Postgre Oracle DB2 Sybase other
网络管理: 网络安全 网络应用 Linux服务器 环境配置 黑客安全 | 编程开发: PHP CC++ Python Perl Shell 嵌入式开发 java jsp | PHP技术: PHP基础 PHP技巧 PHP应用 PHP文摘
搜索中心 Linux招聘 Linux专题 Apache | Linux相关: 硬件相关 Linux解决方案 Linux认证 企业应用 其它Unix | 相关下载: 资料下载 参考手册 开发工具 服务器类 软路由 其它
 技术搜索:
会员中心 注册会员 高级搜索  
  → 当前位置:首页>网络管理>linux服务器>正文

Linux下搭建PXE自动化安装环境

http://www.oklinux.cn  2009-06-23  imysql.cn    会员收藏  游客收藏  【 】 
您查看的文章来源于http://www.oklinux.cn

目录:
1. 前言
2. 配置dhcpd
3. 配置tftpd
4. 配置httpd
5. 测试

1. 前言

现在企业采购的很多计算机都是没光驱的,怎么安装系统呢?另外,如何能快速大规模安装Linux服务器操作系统呢,有什么好办法吗?

答案是有的,那就是本文要说的:PXE。

整个安装的过程是这样的:PXE网卡启动 => DHCP获得IP地址 => 从TFTP上下载 pxelinux.0、vmlinuz、initr.img 等 => 引导系统进入安装步骤 => 通过PEX linux 下载ks.cfg文件并跟据ks.cfg自动化安装系统 => 完成。

接下来,我们将PXE环境中的各个步骤分解开,逐一部署。

服务器环境描述:

IP:192.168.0.2
GW: 192.168.0.1
NETMASK: 255.255.255.0

2. 配置dhcpd

dhcpd的作用就是在客户端启动时,从中分配IP,便于继续后面的网络化自动安装。首先,我们需要安装 dhcp rpm包。
rpm -ivhU dhcp*rpm
[[email protected] ~yejr]# cat /etc/dhcpd.conf
option space PXE;
option PXE.mtftp-ip code 1 = ip-address;
option PXE.mtftp-cport code 2 = unsigned integer 16;
option PXE.mtftp-sport code 3 = unsigned integer 16;
option PXE.mtftp-tmout code 4 = unsigned integer 8;
option PXE.mtftp-delay code 5 = unsigned integer 8;
option PXE.discovery-control code 6 = unsigned integer 8;
option PXE.discovery-mcast-addr code 7 = ip-address;
class "pxeclients" {
match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
option vendor-class-identifier "PXEClient";
vendor-option-space PXE;
option PXE.mtftp-ip 0.0.0.0;
filename "pxelinux.0";
next-server 192.168.0.2;
}
ddns-update-style interim;
ignore client-updates;
allow booting;
allow bootp;
ddns-updates on;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.1;
option subnet-mask 255.255.255.0;
option domain-name-servers 202.106.0.20;
option time-offset 28800;
pool {
range 192.168.0.3 192.168.0.253;
default-lease-time 200;
max-lease-time 400;
allow members of "pxeclients";
}
}

其中,next-server就是指定tftp服务器的地址,filename是pxe引导文件。

3. 配置tftpd

安装rpm包,修改 xinet.d 下的 tftpd 配置文件,然后配置 tftpd 服务端环境。
[[email protected] ~yejr]# rpm -ivhU syslinux*rpm tftp*rpm
[[email protected] ~yejr]# mkdir -p /var/www/html/as4u7 /tftpboot/
[[email protected] ~yejr]# mount path/as4u7_x86_64.iso -t iso9660 -o loop /var/www/html/as4u7
[[email protected] ~yejr]# cd /var/www/html/as4u7
[[email protected] ~yejr]# cp isolinux/vmlinuz isolinux/initrd.img /usr/lib/syslinux/pxelinux.0 /tftpboot
[[email protected] ~yejr]# mkdir -p /tftpboot/pxelinux.cfg/
[[email protected] ~yejr]# cat /tftpboot/pxelinux.cfg/default
default local
prompt 1
timeout 600
label local
localboot 0
label as4u6_x86_64
kernel vmlinuz
append netmask=255.255.255.0 gateway=192.168.0.2 ksdevice=eth0 initrd=initrd.img nofb text ks=http://192.168.0.2/ks.cfg
[[email protected] ~yejr]# cat /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
}
这里需要注意的是,/etc/xinetd.d/tftp 文件中的 disable 改成 no。另外,我们也可以采用其他网络方式安装,常见的有 HTTP、NFS、FTP,在这里,我们采用熟悉的 HTTP 方式。


4. 配置httpd以及pxe自动安装脚本

httpd的安装不再多说,我们只需要把 pxe 自动化配置文件放到 DocumentRoot 指定的位置下,然后根据文件中配置的参数挂载iso影响文件。在这里,我们假定 DocumentRoot 就是默认的 /var/www/html。
[[email protected] ~yejr]# cat /var/www/html/ks.cfg
#基础设置
lang en_US
langsupport zh_HK zh_CN zh_TW --default=en_US
keyboard us
mouse
timezone Asia/Shanghai
rootpw yejr
selinux --disabled
reboot
text
install
#http安装路径
url --url http://192.168.1.12/as4u7/
zerombr yes
auth --useshadow --enablemd5
firewall --disabled
skipx
#定制安装包
%packages --resolvedeps
@ admin-tools
@ system-tools
@ editors
@ emacs
@ compat-arch-support
@ chinese-support
@ development-tools
kernel
kernel-utils
curl
grub
sysstat
#初始化设置
%pre --interpreter /bin/sh
export PATH=$PATH:/sbin:/bin:/usr/sbin:/usr/bin
DRIVER_INSTALL="`fdisk -l | grep -i '^Disk /dev/' | awk '{print $2, $3}' | sed 's/://g' | sed 's#/dev/##g' | awk 'BEGIN{ disk=""; size=0}{if(size == 0 || size > $2) {size = $2; disk = $1}}END{print disk}'`"
%post --interpreter /bin/sh
/sbin/chkconfig --level 2345 irqbalance on
/sbin/chkconfig --level 2345 psacct on
/sbin/chkconfig --level 2345 anacron off
/sbin/chkconfig --level 2345 apmd off
/sbin/chkconfig --level 2345 atd off
/sbin/chkconfig --level 2345 autofs off
/sbin/chkconfig --level 2345 gpm off
/sbin/chkconfig --level 2345 httpd off

共2页: 上一页 1 [2] 下一页

上一篇:四大浏览器最新版本的内存占用比较   下一篇:使用Ubuntu源安装LAMP

收藏于收藏夹】 【评论】 【推荐】 【打印】 【关闭
相关文档
·使用Ubuntu源安装LAMP
·RHEL/CentOS:利用ISO 建立本地YUM服务器
·使用Linux下的TC进行服务器流量控制
·使用Linux做文件服务器共享
·在Ubuntu下基于zimbra轻松建立自己公司的邮件办公系统
·Apache 环境中.htaccess配置举例
·在Linux上搭建Java WEB开发环境
·Linux 向外TCP最大连接只能打开28232个端口限制tuning
·Linux下Apache php.ini httpd.conf调试
·Linux:配置DNS客户端及需要解决的一些问题
·Ubuntu 9.04 下使用Apache2,mod_mono 配置asp.net 2.0
·实例:Linux reiserfs文件系统损坏后的数据恢复
·迅闪Linux虚拟磁盘安装、配置、群集
·实际测试Linux登陆档的轮替
·Linux登陆档应用示例
·在UNIX操作系统下架设简单路由器
发表评论
密码: 匿名评论
评论内容:

(不超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规)
 
  最新文档
·利用VSFTP架设Linux环境下的FTP服务器
·Linux下安装Apache 2.2.6 笔记
·Linux下的主要VPN技术
·Linux下Samba服务器搭建实例
·用Sendmail在Linux下架设邮件服务器
·2009服务器盘点:再见Sun 再见麦克利尼
·SUSE 10上做VPN服务器
·在Ubuntu 9.10中打造带tdbsam Backend
·Ubuntu服务器上SSH Server 的安装配置
·Nginx 禁止某个 User_Agent 的方法
·Linux-Apache-MySQL-PHP网站架构方案分
·Nginx 对某些 User_Agent 进行限速的方
  阅读排行
·Linux系统下架设APACHE SVN服务器全过
·Linux下用vsftp轻松搭建FTP服务器(修订
·Ubuntu下安装tftp服务器的步骤
·Linux 下配置vsftp虚拟用户总结
·详解远程SHELL下安装配置RedHat ES 5的
·Linux下安装eclipse与myeclipse
·Linux DNS Server -bind 9.5.0 安装配
·Linux与Linux,Linux与Windows之间使用S
·Ubuntu上搭建SVN服务器全攻略
·LVS集群学习笔记(NAT\DR\IP tunnel)
·Linux下tomcat启动jvm内存设置
·Linux shell 中FTP实现自动下载上传文
·安装大型Linux集群(4):节点安装和 GPFS
·Linux系统下架设PPTP VPN服务器
·Linux系统中下查看内存的方法
网摘收藏: