1.先设置我们的环境,给我们的服务端添加一块网卡 1.1装一个裸机的客户端(作为无人值守部署的验证,详细教程请看我之前的教程,下面的图片是要注意的地方)服务端:
1、DHCP服务 指定分配ip地址 定位引导文件next-server //指向TFTP路径
filename //引导程序文件位置
—————————————————————————2、TFTP服务(简单文件传输协议) UDP69端口
高效率 容量小(引导程序pxelinnx.0(syslinux包),压缩内核vmlinuz,
系统初始化文件initrd.img,启动菜单default)—————————————————————————
3.FTP (vsftp) 文件传输协议 系统镜像(centos7)
安全 容量大 TCP 20(数据传输), 21(连接)—————————————————————————
安装包:dhcp, tftp-server, vsftp, syslinux
4.安装并配置kickstart无人值守
记得重启我们的网卡才能生效 1.查看我们的网卡信息
[[email protected] ~]# ifconfig //查看网卡详细信息ens33: flags=4163<UP,broADCAST,RUNNING,MulTICAST> mtu 1500 inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255 inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeID 0x20<link> ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet) RX packets 622 bytes 385786 (376.7 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 217 bytes 18826 (18.3 KiB) TX errors 0 dropped 0 overruns 0 carrIEr 0 collisions 0ens36: flags=4163<UP,MulTICAST> mtu 1500 inet6 fe80::658e:4c2d:2273:9cf5 prefixlen 64 scopeID 0x20<link> ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet) RX packets 7 bytes 795 (795.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 82 bytes 13820 (13.4 KiB) TX errors 0 dropped 0 overruns 0 carrIEr 0 collisions 0//我们的两块网卡有了2.配置这两块网卡
[[email protected] ~]# cd /etc/sysconfig/network-scripts/ //到我们的网卡配置文件夹中[[email protected] network-scripts]# lsifcfg-ens33 ifdown-isdn ifup ifup-plip ifup-tunnelifcfg-lo ifdown-post ifup-aliases ifu-plusb ifup-wirelessifdown ifdown-ppp ifup-bnep ifup-post init.ipv6-globalifdown-bnep ifdown-routes ifup-eth ifup-ppp network-functionsifdown-eth ifdown-sit ifup-ib ifup-routes network-functions-ipv6ifdown-ib ifdown-Team ifup-ippp ifup-sitifdown-ippp ifdown-TeamPort ifup-ipv6 ifup-Teamifdown-ipv6 ifdown-tunnel ifup-isdn ifup-TeamPort[[email protected] network-scripts]# cp -p ifcfg-ens33 ifcfg-ens36 //复制ens33网卡的信息到ens36中[[email protected] network-scripts]# vim ifcfg-ens36 //进入ens36网卡进行配置TYPE=EthernetPROXY_METHOD=nonebroWSER_ONLY=noBOOTPROTO=static //静态DEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_autoCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_ADDR_GEN_MODE=stable-privacyname=ens36DEVICE=ens36ONBOOT=yesIPADDR=192.168.100.100 //IP地址NETMASK=255.255.255.0 //子网掩码GATWAY=192.168.100.100 //默认网关~ ~ ~ ~ ~ ~ ~ ~ ~ :wq //保存退出3.重启网络服务查看地址有没有生效
[[email protected] network-scripts]# systemctl restart network //重启网络服务,查看我们的网址有没有配上去[[email protected] network-scripts]# ifconfigens33: flags=4163<UP,MulTICAST> mtu 1500 inet 192.168.17.128 netmask 255.255.255.0 broadcast 192.168.17.255 inet6 fe80::e3c7:14af:6e4d:7216 prefixlen 64 scopeID 0x20<link> ether 00:0c:29:c9:dd:05 txqueuelen 1000 (Ethernet) RX packets 2302 bytes 679197 (663.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 951 bytes 111027 (108.4 KiB) TX errors 0 dropped 0 overruns 0 carrIEr 0 collisions 0ens36: flags=4163<UP,MulTICAST> mtu 1500 inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255 inet6 fe80::658e:4c2d:2273:9cf5 prefixlen 64 scopeID 0x20<link> ether 00:0c:29:c9:dd:0f txqueuelen 1000 (Ethernet) RX packets 9 bytes 1281 (1.2 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 230 bytes 39857 (38.9 KiB) TX errors 0 dropped 0 overruns 0 carrIEr 0 collisions 04.安装DHCP服务和复制模板
[[email protected] network-scripts]# yum install dhcp -y //安装DHCP服务[[email protected] network-scripts]# cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.confcp:是否覆盖"/etc/dhcp/dhcpd.conf"? yes //复制模板5.配置dhcp服务
[[email protected] network-scripts]# vim /etc/dhcp/dhcpd.conf //配置dhcp服务subnet 192.168.100.0 netmask 255.255.255.0 { range 192.168.100.20 192.168.100.30; //地址范围 option routers 192.168.100.100; //默认网关指向客户端 option domain-name-servers 114.114.114.114; //地址解析南京的服务器解析 next-server 192.168.100.100; //指向TFTP服务器是自己的地址 filename "pxelinux.0"; //ftp站点底下的引导程序文件位置}#This is a very basic subnet declaration.:wq6.安装引导程序文件和TFTP服务
[[email protected] network-scripts]# yum install syslinux -y[[email protected] network-scripts]# yum install tftp-server -y已加载插件:fastestmirror,langpacksLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: mirrors.aliyun.com正在解决依赖关系--> 正在检查事务---> 软件包 tftp-server.x86_64.0.5.2-22.el7 将被 安装--> 解决依赖关系完成7.查看tftp软件包文件
[[email protected] network-scripts]# rpm -ql tftp-server/etc/xinetd.d/tftp //配置文件/usr/lib/systemd/system/tftp.service/usr/lib/systemd/system/tftp.socket/usr/sbin/in.tftpd/usr/share/doc/tftp-server-5.2/usr/share/doc/tftp-server-5.2/CHANGES/usr/share/doc/tftp-server-5.2/README/usr/share/doc/tftp-server-5.2/README.security/usr/share/man/man8/in.tftpd.8.gz/usr/share/man/man8/tftpd.8.gz/var/lib/tftpboot //站点8.复制引导程序到站点中
cp /usr/share/syslinux/pxelinux.0[[email protected] network-scripts]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/ //复制引导程序到站点[[email protected] network-scripts]# ls /var/lib/tftpboot/pxelinux.09.配置TFTP服务(把yes改成no就行)
[[email protected] network-scripts]# 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 /var/lib/tftpboot disable = no //把yes改成no就行 per_source = 11 cps = 100 2 flags = IPv4}~ ~ ~ ~ ~ ~ ~ ~ ~ ~ :wq10.安装VSftpd文件传输协议 安全 容量大 TCP 20(数据传输), 21(连接)
[[email protected] network-scripts]# yum install vsftpd -y //安装站点已加载插件:fastestmirror,langpacksLoading mirror speeds from cached hostfile * base: centos.ustc.edu.cn * extras: centos.ustc.edu.cn * updates: mirrors.aliyun.com正在解决依赖关系11.挂载镜像(服务端要挂载镜像)
[[email protected] network-scripts]# cd /var/ftp[[email protected] ftp]# lspub[[email protected] ftp]# mkdir centos7 //创建一个文件夹[[email protected] ftp]# lscentos7 pub[[email protected] ftp]# mount /dev/sr0 /var/ftp/centos7 //挂载mount: /dev/sr0 写保护,将以只读方式挂载[[email protected] ftp]# df -hT文件系统 类型 容量 已用 可用 已用% 挂载点/dev/sda2 xfs 10G 4.3G 5.8G 43% /devtmpfs devtmpfs 898M 0 898M 0% /devtmpfs tmpfs 912M 0 912M 0% /dev/shmtmpfs tmpfs 912M 9.0M 903M 1% /runtmpfs tmpfs 912M 0 912M 0% /sys/fs/cgroup/dev/sda5 xfs 10G 37M 10G 1% /home/dev/sda1 xfs 6.0G 174M 5.9G 3% /boottmpfs tmpfs 183M 20K 183M 1% /run/user/0/dev/sr0 iso9660 4.3G 4.3G 0 100% /var/ftp/centos712.把镜像中的系统内核和初始化文件放到站点中
[[email protected] ftp]# cd centos7/[[email protected] centos7]# lsCentOS_BuildTag EulA images liveOS repodata RPM-GPG-KEY-CentOS-Testing-7EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL[[email protected] centos7]# cd images/[[email protected] images]# lsefiboot.img pxeboot TRANS.TBL[[email protected] images]# cd pxeboot/[[email protected] pxeboot]# lsinitrd.img TRANS.TBL vmlinuz[[email protected] pxeboot]# cp initrd.img vmlinuz /var/lib/tftpboot/ 把系统内核和初始化文件放到站点中[[email protected] pxeboot]# ls /var/lib/tftpboot/initrd.img pxelinux.0 vmlinuz[[email protected] pxeboot]#13.在站点中配置启动菜单
[[email protected] pxeboot]# cd /var/lib/tftpboot/[[email protected] tftpboot]# lsinitrd.img pxelinux.0 vmlinuz[[email protected] tftpboot]# mkdir pxelinux.cfg[[email protected] tftpboot]# lsinitrd.img pxelinux.0 pxelinux.cfg vmlinuz[[email protected] tftpboot]# cd pxelinux.cfg[[email protected] pxelinux.cfg]# vim default //配置启动菜单default autoprompt 1label auto kernel vmlinuz append initrd=initrd.img method=ftp://192.168.100.100/centos7label linux text kernel vmlinuz append text initrd=initrd.img method=ftp://192.168.100.100/centos7label linux rescue kernel vmlinuz append rescue initrd=initrd.img method=ftp://192.168.100.100/centos7~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ :wq14.关闭防火墙,增强功能,开启所有服务
[[email protected] pxelinux.cfg]# systemctl stop firewalld.service 关闭防火墙[[email protected] pxelinux.cfg]# setenforce 0 //关闭增强功能[[email protected] pxelinux.cfg]# systemctl start dhcpd //开启这三个服务[[email protected] pxelinux.cfg]# systemctl start tftp[[email protected] pxelinux.cfg]# systemctl start vsftpd[[email protected] pxelinux.cfg]#15.我们回到服务端安装kickstart 无人值守安装部署
[[email protected] pxelinux.cfg]# yum install system-config-kickstart -y //安装无人值守工具已加载插件:fastestmirror,langpacksLoading mirror speeds from cached hostfile16.开始配置kickstart 无人值守安装部署 设置中文,时区,ROOT密码 保存,记得必须要点保存,我图上没标。 16.1把这个配置文件放到我们的站点中 17.把系统的配置文件模板,放到我们的kickstart配置文件中
[[email protected] pxelinux.cfg]# cd /var/ftp/[[email protected] ftp]# lscentos7 ks.cfg pub[[email protected] ftp]# vim ks.cfg[[email protected] ftp]# cd /root[[email protected] ~]# lsanaconda-ks.cfg initial-setup-ks.cfg 公共 模板 视频 图片 文档 下载 音乐 桌面[[email protected] ~]# vim anaconda-ks.cfg //到这个模板下把这个模板复制到我们的无人值守工具配置文件中%packages@^gnome-desktop-environment@base@core@desktop-deBUGging@@R_648_5022@@directory-clIEnt@Fonts@gnome-desktop@guest-agents@guest-desktop-agents@input-methods@internet-browser@java-platform@multimedia@network-file-system-clIEnt@networkmanager-submodules@print-clIEnt@x11chronykexec-tools%end18.用引导程序加载这个模板
加个ks.cfg文件地址就可以了ks=ftp://192.168.100.100/ks.cfg
[[email protected] ftp]# cd /var/lib/tftpboot/[[email protected] tftpboot]# lsinitrd.img pxelinux.0 pxelinux.cfg vmlinuz[[email protected] tftpboot]# cd pxelinux.cfg/[[email protected] pxelinux.cfg]# lsdefault[[email protected] pxelinux.cfg]# vim defaultdefault autoprompt 1label auto kernel vmlinuz append initrd=initrd.img method=ftp://192.168.100.100/centos7 ks=ftp://192.168.100.100/ks.cfglabel linux text kernel vmlinuz append text initrd=initrd.img method=ftp://192.168.100.100/centos7label linux rescue kernel vmlinuz append rescue initrd=initrd.img method=ftp://192.168.100.100/centos719.我们验证是否是自动化安装 以上就是我们的所有内容了,绝对详细,绝对正确。 谢谢大家观看 总结
以上是内存溢出为你收集整理的企业必备———Linux Centos7 无人值守自动化装机(PXE部署)全部内容,希望文章能够帮你解决企业必备———Linux Centos7 无人值守自动化装机(PXE部署)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)