(1)DHCP搭建
[root@localhost Desktop]# yum install dhcp #安装DHCP服务
[root@localhost Desktop]# rpm -qc dhcp #查找DHCP的配置文件
/etc/dhcp/dhcpd.conf
/etc/dhcp/dhcpd6.conf
/etc/openldap/schema/dhcp.schema
/etc/sysconfig/dhcpd
/var/lib/dhcpd/dhcpd.leases
/var/lib/dhcpd/dhcpd6.leases
[root@localhost Desktop]# vim /etc/dhcp/dhcpd.conf
dhcpd.conf文件中没有内容,但有提示,可以去/usr/share/doc/dhcp查找
[root@localhost Desktop]# cd /usr/share/doc/dhcp-4.2.5
[root@localhost dhcp-4.2.5]# ls
dhcpd6.conf.example dhcpd.conf.example ldap
[root@localhost dhcp-4.2.5]# cp dhcpd.conf.example /etc/dhcp/dhcpd.conf
以dhcpd.conf.example为模板,拷贝生成dhcpd.conf文件
cp: overwrite ‘/etc/dhcp/dhcpd.conf’? y
[root@localhost dhcp-4.2.5]#vim /etc/dhcp/dhcpd.conf
#将文件改变如下:
------------------------------------------------------------------------------
option domain-name "example.com";
option domain-name-servers 172.25.254.250; #设置DNS
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet 172.25.254.0 netmask 255.255.255.0 { #IP地址池
range 172.25.254.100 172.25.254.110;
option routers 172.25.254.11;
}
------------------------------------------------------ ------------------------
(2)HTTP搭建
[root@foundation156 isolinux]# yum install httpd -y
[root@foundation156 isolinux]# systemctl start httpd
[root@foundation156 isolinux]# cd /var/www/html #用rpm -ql httpd查找服务的记录文件
[root@foundation156 html]# mkdir http
[root@foundation156 html]# setenforce 0
[root@foundation156 html]# getenforce
Permissive
[root@foundation156 html]# mount /iso/rhel-server-7.0-x86_64-dvd.iso /software #挂载镜像文件
mount: /dev/loop0 is write-protected, mounting read-only
[root@foundation156 html]# mount -a
[root@foundation156 html]# vim /etc/fstab
在/etc/fstab 中写入
-----------------------------------------------------
/iso/rhel-server-7.0-x86_64-dvd.iso /var/www/html/http iso9660 defaults 0 0
-----------------------------------------------------
[root@foundation156 html]# ln -s /software/* http/
(3)kickstart生成.cfg脚本文件
yum search yum search kickstart
yum install system-config-kickstart.noarch
system-config-kickstart #先打开图形管理界面
在图形界面下,对左栏的11项分别设置
-----------------------------------------------------------------
basic configuration : 设置timezone,passwd, 选择 reboot after installation
installation method : 选择perform new installation , 选择HTTP,并填写相应的安装源地址
boot loader option : 选择 install new boot loader后不做任何改变
partition information : 选择每一选项的第一个,添加两个分区,/和swap
network configuration : 选择add network device ,为 eht0
authentication : 不做设置
firewall configuration : 都设置为disabled
display configuration : 去掉graphical environment
packages selection : 后期手动添加
pre-installation script 和 post-installation script 不做设置
-----------------------------------------------------------------
设置完成后,保存为 .cfg 文件,并编辑 ks.cfg 文件
------------------------------------
url --url="" #注意,URL一定不能出错
%packages
@base #包含很多软件的一个集合的名称
vim-enhanced #安装vim软件
%end
------------------------------------
最后将此文件放到 /var/www/html/
(4)搭建TFTP
[root@server ~]#yum install tftp-server.x86_64 #编辑文件,开启tftp ,将disable设为 no。这个操作必须进行,否则安装时找不到资源。由于这个问题,可是把我折腾的够惨,唉~
[root@foundation156 software]# vim /etc/xinetd.d/tftp
-----------------------------------------------------
disable = no
-----------------------------------------------------
[root@foundation156 software]# systemctl restart xinetd.service #重启服务
[root@server ~]#rpm -ql tftp-server #找到 /var/lib/tftpboot
[root@server ~]# cd /var/www/html/http/
[root@server http]# ls
addons images Packages RPM-GPG-KEY-redhat-release
EFI isolinux release-notes TRANS.TBL
EULA LiveOS repodata
GPL media.repo RPM-GPG-KEY-redhat-beta
[root@server http]# cd isolinux/
[root@server isolinux]# cp -r * /var/lib/tftpboot/
[root@server isolinux]# cd /var/lib/tftpboot/
[root@server tftpboot]# mkdir pxelinux.cfg
[root@server tftpboot]# cp isolinux.cfg pxelinux.cfg/default
[root@server tftpboot]# ls
boot.cat initrd.img memtest TRANS.TBL vmlinuz boot.msg isolinux.bin pxelinux.cfg upgrade.img
grub.conf isolinux.cfg splash.png vesamenu.c32
[root@server tftpboot]# vim pxelinux.cfg/default
---------------------------------------------------------------------------------------------------------
label linux
menu label ^Install Red Hat Enterprise Linux 7.0
kernel vmlinuz
append initrd=initrd.img repo= quiet ks=
---------------------------------------------------------------------------------------------------------
(5)后续修补
[root@server ~]# yum whatprovides */pxelinux.0
[root@server ~]# yum install syslinux-4.05-8.el7.x86_64
[root@server ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/
[root@server ~]# vim /etc/dhcp/dhcpd.conf
---------------------------------------
next-server 192.168.1.1;
filename "pxelinux.0";
---------------------------------------
(6)关闭火墙,重启各服务,应该就可以正常安装
注意:每一步操作及文件的编辑,一定要小心仔细。否则就要一点点的排错,一遍遍的重做。
阅读(2853) | 评论(0) | 转发(0) |