千锋云计算毕业设计论文:PXE网络装机流程二

281 阅读3分钟

每年进入3-4月所有的高等院校开始了一年一度的毕业生答辩准备阶段,现如今毕业论文或者毕业设计也更加的贴近了互联发展的趋势,很多学校开始做最热话题云计算openstack架构的实现以及云计算环境搭建,先不说这个毕业设计的切入点是否正确,就说选择该题目后你如何下手?下面给大家分享千锋讲师给学员准备的千锋云计算毕业设计论文:PXE网络装机流程第二部分内容。

3.配置http做文件仓库和修改ks.cfg文件

安装httpd服务

yum install –y httpd

启动并且配置开机启动httpd服务

systemctl start httpd

systemctl enable httpd

放入待安装系统盘,并直接用光盘的package当做安装仓库

mkdir /var/www/html/centos7

mount /dev/cdrom /var/www/html/centos7/

将当前系统中的ks文件拷贝到/var/www/html/路径下

cp /root/anaconda-ks.cfg /var/www/html/ks.cfg

修改ks.cfg配置文件/var/www/html/ks.cfg

ks.cfg的作用是预先指定好需要的安装选项(包括系统镜像路径,安装组件,系统语言,网络配置,用户及密码等),

当正式安装时PXE Client将会很据该文件去自动配置安装,从而避免了大规模部署时的大量重复操作。

主要修改的地方是将

Use CDROM installation media

cdrom

修改为

Use network installation

url --url="http://192.168.0.125/centos7"

从而指定PXE Client从哪里去获得镜像文件,ks.cfg文件修改后如下:

#version=DEVEL

System authorization information

auth --enableshadow --passalgo=sha512

Use network installation

url --url="http://192.168.0.125/centos7"

Use graphical install

graphical

Run the Setup Agent on first boot

firstboot --enable

Keyboard layouts

keyboard --vckeymap=cn --xlayouts='cn'

System language

lang zh_CN.UTF-8

Network information

network --bootproto=dhcp--device=eno16777736 --ipv6=auto --activate

network --hostname=localhost.localdomain

Root password

rootpw --iscrypted6qUeqvWWOr921mWBY$h5wjwdcnIOC/FS6rCaZblKNGELwN9jrGwJZuwlrNi9OHzI.n1lxaKKrkwdN7nadXP5f2mFRDrW9D9gYStXGZu/

System timezone

timezone Asia/Shanghai --isUtc

user --groups=wheel --name=pxetest--password=6.hgpJdCAhSMaf7yB$5GKYIAgTkLxfS1JHK5KSpN96LXhkKGFX3FbnQl0hTME3wbF1njxyezmPF/HXAtI9Bp8U6MsF3hRXlFvFfn9Nm/--iscrypted --gecos="pxetest"

System bootloader configuration

bootloader --append=" crashkernel=auto"--location=mbr --boot-drive=sda

autopart --type=lvm

Partition clearing information

clearpart --none --initlabel

%packages

@^infrastructure-server-environment

@base

@compat-libraries

@core

@debugging

@development

@dns-server

@file-server

@ftp-server

@security-tools

@smart-card

kexec-tools

%end

%addon com_redhat_kdump --enable--reserve-mb='auto'

%end

4.相关系统引导文件存储

安装syslinux,它是一个功能强大的引导加载程序,而且兼容各种介质。

yum install -y syslinux

pxelinux.0文件名要和dhcp配置文件内的一致

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

copy光盘目录中的vmlinuz和initrd.img,这两个文件相当于系统启动时/boot目录下的启动文件,这个用来引导anacoda而不是根

cp /mnt/cdrom/images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/

copy pxe引导所需要的配置文件,splash.png:背景图.boot.msg启动标语,vesamenu.c32:显示同行界面用的程序.

cp /mnt/cdrom/isolinux/{boot.msg,vesamenu.c32,splash.png} /var/lib/tftpboot/

pxe启动时显示配置文件信息,和光盘启动类似.

mkdir /var/lib/tftpboot/pxelinux.cfg

cp /mnt/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default

  1. 配置default系统启动文件

在default配置文件/var/lib/tftpboot/pxelinux.cfg/default中找到下面标签

label linux

menu label^Install CentOS 7

kernel vmlinuz

menu default

append initrd=initrd.img inst.stage2=http://192.168.0.125/centos7 inst.ks=http://192.168.0.125/ks.cfg quiet

注意标红的地方,它的目的是用于告诉PXEClient去哪里可以找到镜像文件以及ks.cfg配置文件。

6.检查PXE Server的状态并启动PXE Client

service dhcpd status

service tftp status

service httpd status

以上三者结果都应该为active(running)

service firewalld status

结果都应该为inactive(dead)

检查待安装系统盘是否以及挂载到指定目录下(/var/www/html/centos7/)

如果以上状态均正常,可以开始启动PXEClient,并将启动方式设置为网卡启动。