2、配置防火墙 允许:TCP 80 端口 和 UDP 69 端口 或者 关闭防火墙
[root@localhost ~]# yum -y install firewalld //centos 7一般上面都没有安装包,它是用来启动防火墙服务的,类似于service iptables start
参数详解:
--zone 作用域
--add-port=80/tcp 添加端口, 格式为: 端口/ 通讯协议
--permanent 永久生效,没有此参数,重启失效
[root@localhost ~]# systemctl start httpd //启动httpd服务
[root@localhost ~]# systemctl enable httpd //将httpd服务加入开机自动启动
4、挂在系统安装镜像到httpd服务器站点根目录
[root@localhost ~]# mkdir /var/www/html/os/ //创建挂载目录
[root@localhost ~]# mount /dev/cdrom /var/www/html/os/ //挂载系统镜像
5、安装tftp服务
[root@localhost ~]# yum -y install tftp tftp-server xinetd//安装
[root@localhost ~]# vim /etc/xinetd.d/tftp //编辑
disable = no //修改
[root@localhost ~]# systemctl start xinetd //启动
[root@localhost ~]# systemctl enable xinetd //将xinetd服务加入开机自动启动
[root@localhost ~]# cp /var/www/html/os/images/pxeboot/vmlinuz /var/lib/tftpboot/
[root@localhost ~]# cp /var/www/html/os/images/pxeboot/initrd.img /var/lib/tftpboot/
[root@localhost ~]# mkdir -p /var/lib/tftpboot/pxelinux.cfg
[root@localhost ~]# cp /var/www/html/os/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@localhost ~]# vim /var/lib/tftpboot/pxelinux.cfg/default
default linux //修改
timeout 600
display boot.msg
# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title CentOS Linux 7
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13
# Border Area
menu color border * #00000000 #00000000 none
# Selected item
menu color sel 0 #ffffffff #00000000 none
# Title bar
menu color title 0 #ff7ba3d0 #00000000 none
# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none
# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none
# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none
# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none
# Help text
menu color help 0 #ffffffff #00000000 none
# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none
# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none
# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none
# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty line
label linux
menu label ^Install CentOS Linux 7
kernel vmlinuz
append initrd=initrd.img ks=http://172.16.1.90/ks.cfg ksdevice=ens33 ip=dhcp //修改
[root@localhost ~]# chmod -R 644 /var/lib/tftpboot/pxelinux.cfg/default //设置文件文件权限
[root@localhost ~]# yum -y install syslinux //安装引导程序
[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ //拷贝引导文件到tftp服务根目录下
6、[root@localhost ~]# yum -y install dhcp //安装dhcp服务
ddns-update-style interim; //设置DHCP服务器模式
subnet 172.16.1.0 netmask 255.255.255.0 { //配置网段
range 172.16.1.100 172.16.1.200; //配置dhcp服务器的租用地址范围
option domain-name-servers 222.222.222.222; //配置dns
option domain-name "internal.example.org";
option routers 172.16.1.254; // 配置网关
option broadcast-address 10.5.5.31;
default-lease-time 600; //默认租约时间
max-lease-time 7200; //最大租约时间
next-server 172.16.1.90; // tftp服务器地址
filename "pxelinux.0"; //tftp服务器根目录下的文件名
[root@localhost ~]# vim /etc/sysconfig/dhcpd //
DHCPDARGS=ens33 //设置dhcp服务器模式
[root@localhost ~]# dhcpd //测试dhcp服务配置是否正确
[root@localhost ~]# systemctl start dhcpd //启动dhcpd服务
[root@localhost ~]# systemctl enable dhcpd //
7、配置kickstart自动安装文件
注意:在安装kickstart之前先编辑下面的文件,亲 一定要写否则会报错 例如:下面的这个图
配置这个文件就不会显示软件包选择被禁止了
vim /etc/yum.repos.d/lxy.repo//编辑
[development] //添加
name=my-centos7
baseurl=file:///var/www/html/os/
enabled=1
gpgcheck=0
[root@localhost ~]# yum -y install system-config-kickstart //安装kickstart
[root@localhost ~]# system-config-kickstart //打开图形界面配置kickstart文件
注意:下面详细配置、请看大屏幕 呵呵!!!
下面软件包选择根据自己需要吧i
第二部分在pxe客户机上做
注意:内存一定要2GB否则会报错
进入Boot设置从网络启动
开机之后,如图所示,系统已经自动启动了;以下是安装过程
备注:系统安装完成之后,第一启动请设置为硬盘,否则系统重新之后又自动安装系统了,然后把自己的网卡断开
就是慢,哎没办法 ,多等一会!
安装成功,
最后表扬一下自己!!!