1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > CentOS7下的PXE无人值守系统安装

CentOS7下的PXE无人值守系统安装

时间:2022-02-26 09:31:17

相关推荐

CentOS7下的PXE无人值守系统安装

为了满足同时安装上百台linux,而且不需要人工干预。这就需要PXE来通过网线自动安装linux

1.搭建yum源来下载必要的工具,yum源的配置见点击打开链接。

2.下载syslinux,dhcp,http,tftp-server。

[root@localhost etc]# yum -y install syslinux dhcp httpd tftp-serverLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfilePackage syslinux-4.05-12.el7.x86_64 already installed and latest versionPackage 12:dhcp-4.2.5-42.el7.centos.x86_64 already installed and latest versionPackage httpd-2.4.6-40.el7.centos.x86_64 already installed and latest versionPackage tftp-server-5.2-12.el7.x86_64 already installed and latest versionNothing to do

因为我是安装好了,所以报告Nothing to do 。那没安装的就执行那个命令

yum -y install syslinux dhcp httpd tftp-server

3.下载自动安装kickstart工具命令

yum -y installsystem-config-kickstart

同样,我也安装过了,才报告Nothing to do

[root@localhost ~]# yum -y install system-config-kickstartLoaded plugins: fastestmirror, langpacksLoading mirror speeds from cached hostfilePackage system-config-kickstart-2.9.2-4.el7.noarch already installed and latest versionNothing to do

4.搭建一个http的安装源。

进入/var/www/html ,并创建一个目录CentOS用来挂载镜像

[root@localhost ~]# cd /var/www/html/[root@localhost html]# lsCentOS ks.cfg[root@localhost html]# mount /dev/sr0 /var/www/html/CentOS

注意:没那个CentOS目录的先创建一个目录。(那个ks.cfg先不用管,下步再教如何生成)。

命令是 mkdir /var/www/html/CentOS 。然后再挂载(sr0是镜像,也可以写成其他的镜像之类的)。

再执行以下命令

[root@localhost html]# systemctl start httpd[root@localhost html]# systemctl stop firewalld

可以在浏览器里。输入IP/CentOS.可以看到下图就代表成功

5.用system-config-kickstart工具来生成一个自动的安装的配置文件

运行命令,并弹出一个图形界面

[root@localhost ~]# system-config-kickstart

按下列图形填

第二个:Installation Method(这个填自己IP,HTTP Directory就填自己那个光盘镜像的目录)

第三个。Boot Loader Options

第四个。Partition Information

分区自己操作吧。点下面那个Add(那个1代表占用剩余磁盘)

第五个 NetWork Configuration

第六个(我没说的选项不用改)

第七个

保存下来,(因为CentOS7下这个软件的问题。还需要在vim编辑一下ks.cfg这个文件)

打开这个ks.cfg这个文件。在最后面加上

%packages@base%end

保存后。使用如下命令检查一下是否有语法错误

[root@localhost ~]# ksvalidator ks.cfg [root@localhost ~]#

将该文件移到/var/www/html/ks.cfg

[root@localhost html]# lsCentOS ks.cfg[root@localhost html]# pwd/var/www/html

再重启网络服务。

[root@localhost html]# systemctl restart httpd

如果能够在浏览器下看到如下的话,证明上述过程好了(这次我用的火狐浏览器。不要在意这些细节。。)

6.配置tftp(这个文件的位置在左下角)

再执行命令

[root@localhost ~]# systemctl start xinetd

7.将必要文件放到tftpboot内

[root@localhost ~]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

[root@localhost ~]# mkdir /var/lib/tftpboot/pxelinux.cfg

将镜像内的isolinux下的所有东西都考到tftpboot下

[root@localhost CentOS]# cp /var/www/html/CentOS/isolinux/* /var/lib/tftpboot/

再将isolinux.cfg拷给pxelinux.cfg下命名为default

[root@localhost CentOS]# cp /var/lib/tftpboot/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

8.配置dhcp服务器

在/etc/dhcp下编辑 dhcpd.conf 文件

这个文件下写如下内容

option domain-name "";option domain-name-servers 114.114.114.114;default-lease-time 6000;max-lease-time 72000;log-facility local7;subnet 192.168.1.0 netmask 255.255.255.0 {range 192.168.1.10 192.168.1.200;option routers 192.168.1.1;filename "pxelinux.0";next-server 192.168.1.192;}

注意:

好了。最后一步!!修改文件。这个文件是/var/lib/tftpboot/pxelinux.cfg/default

(还有就是将63行 加上menu default ,删去69行的menu default)

最后。再重启一下服务吧!!!!!(关闭防火墙)

<span style="font-size:18px;">[root@localhost pxelinux.cfg]# systemctl restart httpd[root@localhost pxelinux.cfg]# systemctl restart xinetd[root@localhost pxelinux.cfg]# systemctl restart dhcpd[root@localhost pxelinux.cfg]# systemctl stop firewalld</span>

来。用vmware试试效果

1.创建新的虚拟机

2.选择稍后安装操作系统

3.以后的都随意点。根据自己喜好

4.在这停一下

完成后。全自动安装虚拟机,无需手动!!!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。