1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 服务器红帽操作系统安装 pxe无人值守安装 红帽操作系统

服务器红帽操作系统安装 pxe无人值守安装 红帽操作系统

时间:2021-05-27 16:23:26

相关推荐

服务器红帽操作系统安装 pxe无人值守安装 红帽操作系统

在日常生活中,安装系统是家常便饭的事情,对于我们linux来说也是,但是每次安装系统,他都要耗费我们几个小时的时间,去格式化分区,设置语言,设置根口令密码,设置防火墙等等,真是一个麻烦耗时的东西,而且万一碰上要安装一个机房的多台计算机,而且由于预算的原因,很有可能这些计算机根本没有光驱,即使有那个一台一台安装的心思,也没有办法全装啦!!

所以我们要学会使用pxe自动安装的方法。

那什么是pxe呢?pxe的安装方法又是什么??它的运行过程又是怎么样的呢?

/*****什么是pxe********/

pxe他是微软开发的一项技术,它使用C/S技术,客户端从服务器上面下载镜像,通过网络来安装操作系统。

他的工作原理:当计算机boot引导的时候,把pxe 客户端调入内存中去,然后用客户端从服务器上面下载镜像文件来进行操作系统的安装。

/*****linux pxe自动安装方法*******/

在linux 中的pxe自动安装主要就是个各部分:1.pxe 客户端下载镜像文件 2.kickstart文件进行配置linux的自动安装过程。

实验:pxe无人值守安装linux

规划:虚拟机linux redhat5.4一台 虚拟机客户机 一台【要安装操作系统的那个】,

ftp server, tftp server ,dhcp server【都设置在我们的第一台虚拟机上面】,

redhat linux 5.4 iso镜像文件。

开始:

1.ftp server

安装:

[root@localhost~]# mount /dev/cdrom /mnt/cdrom

[root@localhost~]# rpm -ivh /mnt/cdrom/Server/vsftpd-2.0.5-16.el5.i386.rpm

[root@localhost~]# service vsftpd start

拷贝文件 生成,安装树。【以客户端方便为准】

[root@localhost~]# cd /var/ftp/

[root@localhostftp]# cp -r /mnt/cdrom/. .

2.dhcp server

安装:

[root@localhost~]# rpm -ivh /mnt/cdrom/Server/dhcp-3.0.5-21.el5.i386.rpm

编辑/etc/dhcpd.conf文件

subnet 192.168.1.0netmask 255.255.255.0 {

# --- defaultgateway

option routers 192.168.1.254;

option subnet-mask 255.255.255.0;

option domain-name-servers 222.88.88.88;

option time-offset -18000;

range dynamic-bootp 192.168.1.1 192.168.1.254;

default-lease-time 21600;

max-lease-time 43200;

host ns {

next-server ;

hardware ethernet 12:34:56:78:AB:CD;

fixed-address 207.175.42.254;

}

}

启动,测试

[root@localhost ~]# service dhcpdstart //启动dhcpd服务

Startingdhcpd: [ OK ]

[root@localhost~]# service dhcpd configtest //检测配置命令是否正确

Syntax: OK

[root@localhost~]# chkconfig dhcpd on //设置为开机自动启动

3.TFTP server 安装并设置

安装tftp服务

[root@localhost ~]# rpm -ql tftp-server

/etc/xinetd.d/tftp //他的服务器是依赖超级守护进程的

/tftpboot //tftp服务的 根目录

修改tftp server的配置文件

[root@localhost ~]# vim /etc/xinetd.d/tftp

6 service tftp

7 {

8socket_type= dgram

9protocol = udp

10wait= yes

11user= root

12server = /usr/sbin/in.tftpd

13server_args= -s /tftpboot

14 disable = yes//当程序启动时,先传给超级守护进程,然后由超级守护进程,来唤醒tftp服务。默认不唤醒。在这里要改为 唤醒

15per_source= 11//每个来源建立十一个链接

16 cps = 100 2//每秒的链接数不超过100个,超过就停止2s再打开

17flags= IPv4

18 }

[root@localhost~]# service xinetd restart //重启超级守护进程

将内核,驱动文件,引导文件,拷贝到 tftp服务器的根目录

[root@localhostpxeboot]# cp initrd.img /tftpboot/

[root@localhostpxeboot]# cp vmlinuz /tftpboot/

[root@localhostpxeboot]# cp /usr/lib/syslinux/pxelinux.0 /tftpboot///引导文件

配置引导文件

[root@localhosttftpboot]# mkdir pxelinux.cfg

[root@localhosttftpboot]# cp /mnt/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

[root@localhostpxelinux.cfg]# vim default//修改引导文件的内容

/*defaultlinux

prompt1

timeout6

displayboot.msg

F1boot.msg

F2options.msg

F3general.msg

F4param.msg

F5rescue.msg

labellinux

kernel vmlinuz

append ks=ftp://192.168.1.137/ks.cfginitrd=initrd.img

labeltext

kernel vmlinuz

append initrd=initrd.img text

labelks

kernel vmlinuz

append ks initrd=initrd.img

labellocal

localboot 1

labelmemtest86

kernel memtest

append –*/

更改dhcpd.conf配置 文件,添加内容,指明tftp服务器的地址

4.生成 ks.cfg文件

要安装kickstart,以生成ks.cfg文件,但是要安装kickstart就需要使用yum来安装,所以先配置yum服务器【在这里设置成为本地yum】

[root@localhost yum.repos.d]# vimrhel-debuginfo.repo

[rhel-server]

name=Red HatEnterprise Linux $releasever - $basearch - Debug

baseurl=file:///mnt/cdrom/Server

enabled=1

gpgcheck=1

gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

[rhel-vt]

name=Red HatEnterprise Linux vt

baseurl=file:///mnt/cdrom/VT

enabled=1

gpgcheck=1

gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

[rhel-cluster]

name=Red HatEnterprise Linux cluster

baseurl=file:///mnt/cdrom/Cluster

enabled=1

gpgcheck=1

gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-redhat-release

[rhel-clusterstorage]

name=Red HatEnterprise Linux clusterstorate

baseurl=file:///mnt/cdrom/ClusterStorage

enabled=1

gpgcheck=1

安装kickstart

[root@localhostyum.repos.d]# yum installsystem-config-kickstart –y

-y参数,对于安装过程中的交互问题,一律yes

然后再图形界面下,或者支持system-config-kickstart的软件下执行命令【system-config-kickstart】,然后就会出现一个菜单,配置ks.cfg。

另存为 ks.cfg文件,我们将它保存在root目录下面

测试:新建一个红帽5虚拟机,不设置 光盘镜像等,,只加电,它就自动安装了

安装成功!!!!

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