- 论坛徽章:
- 0
|
本帖最后由 liutaostdio2 于 2011-05-06 15:56 编辑
网络无人职守安装linux ( 欢迎大家对我做的 http://www.sucha001.com IP查询 )
1 配置启动安装服务器
1)install and configure dhcp service
yum install dchp*
vi /etc/dhcpd.conf
option domain-name "pxe.domain";
ddns-update-style none;
max-lease-time 7200;
server-name "pxe_test_server";
default-lease-time 600;
allow booting;
allow bootp;
subnet 192.168.3.0 netmask 255.255.255.0 {
range 192.168.3.2 192.168.3.254;
deny unknown-clients;
}
group pxe {
filename "pxelinux.0";
host test_pxe_client1
{
hardware ethernet 00:0e:7b:88:15:06; fixed-address 192.168.3.21;
next-server 192.168.3.1;
# next-server 一定要加上,否则找不到网卡的适应性文件。
}
}
#文件 pxelinux.0(在 TFTP 服务器的根目录中)将作为启动映像被网卡ROM里的PXE客户端载入内存并运行。
cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
每增加一台需安装的机器,我们需在dhcpd.conf中增加一条host条目,将客户机的MAC地址输入进去,同时分配一个IP地址,如果
不输入MAC地址,客户机将无法通过DHCP取的IP地址。
2) 安装tftp 服务:
yum install xinetd
yum install tftp-server
yum install tftp
3)install and configure tftp service
/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
}
#将disable = yes 改成disable = no
重启xinetd服务,以使tftp服务生效;
#service xinetd restart
netstat -an|grep :69 (tftp udp 端口)
netstat -nlp
tftp 语法: tftp 192.168.10.201 get pxelinux.0 (可以做一些简单的文件共享)
2 将启动镜像文件pxelinux.0复制到TFTP服务器根目录,这是客户端机器刚开始启动的时候,pxe协议的引导文件。
启动镜像pxelinux.0可以在syslinux安装包里获得。安装好syslinux安装包后,将pxelinux.0复制到TFTP服务器根目录。
[root@bsvr]#cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
3 将Linux安装程序的内核/根文件系统文件复制到 TFTP 服务器的根目录
[root@bsvr]#cp /mnt/iso/isolinux/initrd.img /tftpboot
[root@bsvr]#cp /mnt/iso/isolinux/vmlinuz /tftpboot
4 nfs install
cp CentOS_5.4_Final.iso /tftpboot/iso/centos5.4_32/
vi /etc/exports
/tftpboot/iso/centos5.4_32 *(rw,no_root_squash)
#service nfs restart
#service nfs reload
#检查共享时候已经正确输出
#showmount –e
5 编辑启动菜单,或安装多个版本的linux
客户端通过pxe协议引导起来之后,会在服务器的/tftpboot/pxelinux.cfg/目录(该目录需要手工建立)下寻找启动配置文件,启动配置文件中定义了应该引导哪个版本的Linux,文件名默认为default,可以将第一张安装光盘中的 /isolinux/isolinux.cfg文件复制到/tftpboot/pxelinux.cfg/,并改名为default,格式写法请参考里面已有的格式。
新建01-00-0e-7b-88-15-06 文件 ,注意以01 打头,后面是客户机的mac地址,用小写。
default linux
label linux
kernel vmlinuz
append ks=nfs:192.168.3.1:/tftpboot/iso/centos5.4_32/ks.cfg initrd=initrd.img devfs=nomount ramdisk_size=9216
6 制作ks.cfg文件,如操作系统安装完后/root/anaconda-ks.cfg
cp /root/anaconda-ks.cfg /tftpboot/iso/centos5.4_32/ks.cfg
简单修改后如下:
# Kickstart file automatically generated by anaconda.
install
nfs --server=192.168.3.1 --dir=/tftpboot/iso/centos5.4_32
#cdrom
lang en_US.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto static --ip 192.168.3.21 --netmask 255.255.255.0 --gateway 192.168.3.1
rootpw --iscrypted $1$5EemI9ES$txW4ZHxUPIzTh4ZCYS09J1
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc 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 --linux
# 删除所有分区。
clearpart --all --initlabel
# as Kb
part / --fstype ext3 --size=20000
part swap --size=2000
#part /app --fstype ext3 --size=100 --grow
%packages
@development-libs
@editors
@system-tools
@text-internet
@core
@base
@base-x
@development-tools
audit
sysstat
device-mapper-multipath
xorg-x11-server-Xvfb
imake
gcc-objc
gcc-gnat
7 将客户机从pxe网卡启动,安装linux。 |
|