DHCP+HTTP+KICKSTART自动化光盘启动部署服务器
2016-12-08 17:02
531 查看
自动化光盘启动部署服务器这里是通过虚拟机进行实际部署前的测试,完全可用于实际的部署工作,完成后可实现一张自制启动光盘和一台可装有HTTP和DHCP服务的linux系统服务器自动化安装操作系统。虚拟环境:操作系统 rhel-server-5.4-x86 IP:192.168.1.3客户端需要安装的系统:rhel-server-5.4-x86NOTICE:网络自动化安装操作系统,需要客户端支持网卡启动和PXE功能。实施步骤:一、配置DHCP服务器:1)安装DHCP服务器
[root@test isolinux]# lsTRANS.TBL boot.msg initrd.img isolinux.cfg options.msg rescue.msg vmlinuzboot.cat general.msg isolinux.bin memtest param.msg splash.lss[root@test ~]# vi /tftpboot/pxelinux.cfg/defaultdefault linuxprompt 1timeout 30 #红色部分为已更改...append initrd=initrd.img text #因使用光盘访问方式,此处不改#若此文件通过HTTP访问红色部分改为:ks=http://192.168.1.3/ks.cfg[root@test isolinux]# cd /tmp #切换到非iso目录[root@test tmp]#mkisofs -R -b isolinux/isolinux.bin -no-emul-boot -boot-load-size 4 -boot-info-table -o boot.iso iso/![](http://s5.51cto.com/wyfs02/M00/8B/4D/wKiom1hJFv3gMdQwAAAjF5i-AQw554.png-wh_500x0-wm_3-wmp_4-s_2513173874.png)
1.3.文件ks.cfg纯手工打造方式,就是自己使用文本工具(如:vi)直接进行编辑配置;[root@test iso]# cat ks.cfg# Kickstart file automatically generated by anaconda.#version=DEVELInstall#nfs --server=192.168.1.3 --dir=/media/cdrom#url --url=ftp://root:root@192.168.1.3/var/ftpurl --url=ftp://192.168.1.3/rhel5.4lang en_USlangsupport --default en_US en_USkeyboard ustextkey –skipnetwork –bootproto=dhcp --device=eth0 --onboot=onrootpw root# Reboot after installationrebootfirewall --disabledauthconfig --useshadow --passalgo=sha512selinux --disabledtimezone Asia/Shanghaibootloader --location=mbr --driveorder=sda# 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 workclearpart --all --initlabel#part /boot --fstype=ext4 --size=500#part swap --size=2048#part / --fstype=ext4 --grow --size=2 # --grow表示剩余的所有空间分配于此
part /boot --bytes-per-inode=4096 --fstype="ext3" --size=1024part /home --bytes-per-inode=4096 --fstype="ext3" --size=4096part /tmp --bytes-per-inode=4096 --fstype="ext3" --size=4096part /usr --bytes-per-inode=4096 --fstype="ext3" --size=4096part swap --bytes-per-inode=4096 --fstype="swap" --size=2048part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1
# X Window System configuration informationxconfig --defaultdesktop=GNOME --depth=16 --resolution=1024x768 --startxonboot%packages@Base@Core@base@client-mgmt-tools@debugging@emacs@ftp-server@hardware-monitoring@large-systems@network-file-system-clientopensshopenssh-serveropenssh-clientsvim-enhancedfirefoxmuttscreenNOTICE:红帽5系列与红帽6系列的kickstart文件有点区别,在红帽5系列中如果有%end选项的话,在安装过程中会报错,红帽6.0以后的系统支持该选项。红帽5系列的最高支持ext3文件系统,红帽6系列的最高支持ext4文件系统,所以在kickstart文件中要根据系统的版本进行相应的修改。
---end---
[root@rrl ~]#yum install -y dhcp*2)编辑DHCP服务器配置文件/etc/dhcp/dhcpd.conf因目的是安装操作系统,而不是将其作为专门的DHCP服务器,所以只需配置几项简单的参数ddns-update-style interim;allow booting;allow bootp;ignore client-updates;set vendorclass = option vendor-class-identifier;subnet 192.168.1.0 netmask 255.255.255.0 {option routers 192.168.1.1;# option domain-name "ns.rrl.com";# option domain-name-servers 192.168.1.1;option subnet-mask 255.255.255.0;range dynamic-bootp 192.168.1.100 192.168.1.199;filename "/pxelinux.0";default-lease-time 21600;max-lease-time 43200;next-server 192.168.1.3;}简单介绍:Option routers指定网关;Option domain-name-server指定DNS服务器;Option subnet-mask指定掩码;range dynamic-bootp指定分配给客户端的IP地址段;Filename 指定启动镜像;Next-server 指定TFTP服务器。将DNS配置注释掉,因在安装某些版本的红帽系统时,会需要指定的DNS服务器进行解析,从而导致自动化安装失败。3)启动DHCP服务[root@rrl ~]#service dhcpd start[root@rrl ~]#chkconfig --add dhcpd #设置dhcp服务开机自动启动4)查看已分配的DHCP地址
[root@rrl ~]#cat /var/lib/dhcp/dhcpd.leaseslease 192.168.1.199 {starts 4 2016/12/08 08:13:17;ends 4 2016/12/08 14:13:17;binding state active;next binding state free;hardware ethernet 00:50:56:9c:7b:a5;client-hostname "jacktest";}二、配置WEB服务器1)安装httpd服务器
[root@rrl~]#yum install –y httpd*2)配置Web服务器通过yum安装的httpd服务器网页文件放置的位置在/var/www/html目录中。我们在这个目录中创建rhel5.4镜像的挂载目录。然后将镜像重新挂载到这个目录下。
[root@rrl~]#mkdir /var/www/html/rhel5.4[root@rrl~]#umount /media/iso[root@rrl~]#mount –o loop,ro rhel-server-5.4-i386-dvd.iso /var/www/html/rhel5.43)启动httpd服务器
[root@rrl~]#service httpd start[root@rrl~]#chkconfig --add httpd #设置httpd服务开机自动启动在这个阶段我们也可以使用NFS或者FTP的方式进行部署,配置过程同样很简单。只需要执行几个命令并且修改对应的kickstart文件中的如何指定安装树的指向的配置选项。在下面kickstart文件中我会给出nfs和ftp的指向配置,可以参考一下。三、配置kickstart文件三种方式创建kickstart文件1.1.System-config-kickstart方式:这需要我们事先安装好syste-config-kickstart软件包,使用yum安装即可。然后使用这个软件定制我们的kickstart文件;[root@test ~]# yum install system-config-kickstart.noarch[root@test ~]# ksvalidator /root/anaconda-ks.cfg #检查文件错误[root@test ~]# timeconfig[root@test ~]# system-config-kickstart & #图形化生成/root/class.cfg文件 1.2复制/root/anaconda-ks.cfg文件方式:因Red Hat操作系统,在系统安装完成后,会自动在root家目录下创建一个anaconda-ks.cfg文件,这个文件真实的记录了系统安装过程中的配置。我们可以复制这个文件,然后在其基础上进行配置。[root@test ~]# mount /dev/cdrom /media # 将安装光盘mount到/media[root@test images]# ls /media/imagesREADME TRANS.TBL boot.iso diskboot.img minstg2.img pxeboot stage2.img xen[root@test images]# cp /media/images/boot.iso /root/[root@test ~]# ls /root/boot.iso[root@test ~]# mount -o loop boot.iso /mnt/cdrom/ # 将该文件mount到/mnt/cdrom/[root@test ~]# cd /mnt/cdrom/[root@test cdrom]# lsTRANS.TBL isolinux[root@test isolinux]# ls /mnt/cdrom/isolinux/TRANS.TBL boot.msg initrd.img isolinux.cfg options.msg rescue.msg vmlinuzboot.cat general.msg isolinux.bin memtest param.msg splash.lss[root@test ~]# mv class.cfg ks.cfg #更改后的ks.cfg文件如附件[root@test tmp]# mkdir iso[root@test tmp]# cd iso/[root@test iso]# cp /mnt/cdrom/* ./ -r #将/mnt/cdrom内容复制到当前目录中[root@test iso]# lsTRANS.TBL isolinux[root@test iso]# cd isolinux/[root@test isolinux]# lsTRANS.TBL boot.msg initrd.img isolinux.cfg options.msg rescue.msg vmlinuzboot.cat general.msg isolinux.bin memtest param.msg splash.lss[root@test iso]# cp /root/class.cfg ./ks.cfg[root@test iso]# lsTRANS.TBL isolinux ks.cfg[root@test iso]# chmod +r /root/ks.cfg[root@test iso]# ll /root/ks.cfg-rw-r--r-- 1 root root 2064 Dec 7 09:51 /root/ks.cfg[root@test isolinux]# vim isolinux.cfgdefault linux ks=cdrom:/ks.cfg #红色为新增部分,表示光盘启动[root@test isolinux]# vi /tmp/iso/isolinux/boot.msg #编辑此文件后显示如下图^L^Xsplash.lss- To install or upgrade in graphical mode, press the ^O01<ENTER>^O07 key.XXX- To install or upgrade in text mode, type: ^O01linux text <ENTER>^O07.XXX- Use the function keys listed below for more information.XXX^O0f[F1-Main] [F2-Options] [F3-General] [F4-Kernel] [F5-Rescue]^O07
![](http://s2.51cto.com/wyfs02/M02/8B/4A/wKioL1hJFviigON5AAL1wzWjN7s521.png-wh_500x0-wm_3-wmp_4-s_103818842.png)
![](http://s5.51cto.com/wyfs02/M00/8B/4D/wKiom1hJFv3gMdQwAAAjF5i-AQw554.png-wh_500x0-wm_3-wmp_4-s_2513173874.png)
![](http://s2.51cto.com/wyfs02/M00/8B/4A/wKioL1hJFvmARA4NAACnwwQfe40351.png-wh_500x0-wm_3-wmp_4-s_2344212822.png)
![](http://s4.51cto.com/wyfs02/M02/8B/4A/wKioL1hJFUrx2KdFAAEPKNArN6E631.png-wh_500x0-wm_3-wmp_4-s_1163300925.png)
![](http://s3.51cto.com/wyfs02/M01/8B/4D/wKiom1hJE2KSQYruAADebTJf1jg327.png-wh_500x0-wm_3-wmp_4-s_2600767859.png)
![](http://s1.51cto.com/wyfs02/M01/8B/4D/wKiom1hJFqSjF21xAAFNVyoA0KI782.png-wh_500x0-wm_3-wmp_4-s_3565127325.png)
相关文章推荐
- DHCP+TFTP+HTTP+kickstart实现PXE自动化部署系统Centos
- LINUX下基于http+tftp+dhcp的PXE+Kickstart自动化安装
- Kickstart+HTTP+DHCP+TFTP全自动批量安装部署Linux系统
- PXE+NFS+TFTP+DHCP+Kickstart 批量自动化部署操作系统
- Kickstart+HTTP+DHCP+TFTP全自动批量安装部署Linux系统
- centos6.4 http dhcp nfs pxe kickstart 自动化安装系统
- CentOS 6 kickstart 自动化部署
- PXE+Kickstart+DHCP+Apache+tftp 批量部署常见错误总结
- Linux下kickstart服务器部署
- PXE+HTTP+tftp+kickstart 网络自动化安装centos6.5
- Kickstart自动化安装部署Centos系统平台的搭建
- Kickstart+HTTP+DHCP+TFTP+PXElinux实现RedHat的网络自动安装
- 脚本部署CentOS 6.0的PXE+DHCP+TFTP+kickstart安装环境
- 基于sturts2.1.6的项目文件部署到tomcat6.0之后,服务器启动时报错:严重: Error filterStart
- CentOS6.4-x86_64搭建cobbler+kickstart的网络无盘启动服务器
- Linux+dhcp+httpd+kickstart无人值守的批量部署
- 自动化配置kickstart 服务器
- 如何利用kickstart实现Linux快速部署(kickstart启动过程演示)
- 基于sturts2.1.6的项目文件部署到tomcat6.0之后,服务器启动时报错:严重: Error filterStart
- vsftp+tftp+dhcp+pxe+kickstart自动化安装操作系统