您的位置:首页 > 编程语言 > PHP开发

vsftp+tftp+dhcp+pxe+kickstart自动化安装操作系统

2014-12-30 14:32 387 查看
实验环境 “
rhel 5
ip 192.168.0.106
#把防火墙关掉
service iptables stop
setenforce 0

#挂载镜像到/mnt下
[root@localhost ~]# mount /dev/cdrom /mnt

[root@localhost ~]# vim /etc/yum.repos.d/yum.repo
[aaa]
name=an
baseurl=file:///mnt/Server
gpgcheck=0
~
[root@localhost ~]# yum -y install dhcp
Running Transaction
Installing : dhcp 1/3
Installing : dhcpv6 2/3
Installing : dhcp-devel 3/3
Installed:
dhcp.i386 12:3.0.5-23.el5 dhcp-devel.i386 12:3.0.5-23.el5
dhcpv6.i386 0:1.0.10-18.el5
Complete!

#复制模版到DHCP的配置文件下
[root@localhost ~]# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
cp: overwrite `/etc/dhcpd.conf'? y

#配置DHCP的配置文件
[root@localhost ~]# vim /etc/dhcpd.conf
ddns-update-style interim;
ignore client-updates;
subnet 192.168.0.0 netmask 255.255.255.0 {
option routers 192.168.0.106;
option subnet-mask 255.255.255.0;
next-server 192.168.0.106;
filename "pxelinux.0";
option nis-domain "domain.org";
option domain-name "domain.org";
option domain-name-servers 192.168.0.106;
option time-offset -18000; # Eastern Standard Time
range dynamic-bootp 192.168.0.128 192.168.0.254;
default-lease-time 21600;
max-lease-time 43200;
}
#重启dhcpd服务
[root@localhost ~]# service dhcpd restart
Starting dhcpd: [ ok ]
#查看/ 下是否有tftpboot
[root@localhost /]# ls
backup dev lib misc opt sbin srv tmp
bin etc lost+found mnt proc selinux sys usr
boot home media net root share tftpboot var
如果没有 yum -y install tftp-server
#安装下 ftp
[root@localhost /]# yum -y install vsftpd

[root@localhost ~]# cd /mnt/images/pxeboot/
[root@localhost pxeboot]# ls
initrd.img README TRANS.TBL vmlinuz

[root@localhost pxeboot]# cp vmlinuz initrd.img /tftpboot/

[root@localhost syslinux]# cp pxelinux.0 /tftpboot/
[root@localhost syslinux]# pwd
/usr/lib/syslinux
[root@localhost tftpboot]# mkdir pxelinux.cfg
[root@localhost tftpboot]# cp /mnt/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
[root@localhost tftpboot]# vim pxelinux.cfg/default
default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label linux
kernel vmlinuz
append initrd=initrd.img ks=ftp://192.168.0.106/ks.cfg #添加软件包地址
label text
kernel vmlinuz
append initrd=initrd.img text
label ks
kernel vmlinuz
append ks initrd=initrd.img
label local
localboot 1
label memtest86
kernel memtest
append -
[root@localhost ~]# vim /etc/xinetd.d/tftp

# default: off
# description: The tftp server serves files using the trivial file transfer \
# protocol. The tftp protocol is often used to boot diskless \
# workstations, download configuration files to network-aware printers, \
# and to start the installation process for some operating systems.
service tftp
{
socket_type = dgram
protocol = udp
wait = yes
user = root
server = /usr/sbin/in.tftpd
server_args = -s /tftpboot
disable = yes # 把yes 改成 no
per_source = 11
cps = 100 2
flags = IPv4
}
#service xinetd restart
[root@localhost ~]# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
[root@localhost ~]#
root@localhost ~]# umount /dev/cdrom /mnt
[root@localhost ~]# vim /etc/yum.repos.d/yum.repo
[base]
name=an
baseurl=ftp://192.168.0.106/pub
gpgcheck=0
~
[root@localhost ~]# mount /dev/cdrom /var/ftp/pub
mount: block device /dev/cdrom is write-protected, mounting read-only
yum -y install system-config-kickstart
system-config-kickstart

cp ./ks.cfg /var/ftp

service dhcpd restart
service xinetd restart
service vsftp restart
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: