码迷,mamicode.com
首页 > 其他好文 > 详细

PXE网络安装RHELS 7.1 x86_64

时间:2015-11-19 18:46:49      阅读:300      评论:0      收藏:0      [点我收藏+]

标签:

PXE网络安装RHELS 7.1 x86_64

PXE – Preboot Execute Environment – 预启动执行环境

我们在Red Hat Enterprise Linux Server 7.1上搭建PXE

配置DHCPD服务

查看dhcpd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep dhcpd

搜索dhcp软件包

[root@localhost ~]# yum search dhcp

安装dhcp软件包

[root@localhost ~]# yum install dhcp –y

查看dhcpd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep dhcpd

查看dhcpd服务状态

[root@localhost ~]# systemctl status dhcpd

查看dhcp软件包配置文件

[root@localhost ~]# rpm -qc dhcp

查看dhcp软件包帮助文档

[root@localhost ~]# rpm -qd dhcp

配置文件/etc/dhcp/dhcpd.conf

[root@localhost ~]# cat /etc/dhcp/dhcpd.conf

#

# DHCP Server Configuration file.

# see /usr/share/doc/dhcp*/dhcpd.conf.example

# see dhcpd.conf(5) man page

#

option domain-name "dhcp"; #

option domain-name-servers 192.168.2.60; #


default-lease-time 600;

max-lease-time 7200;


log-facility local7;


subnet 192.168.2.0 netmask 255.255.255.0 { # 192.168.2.0/24

range 192.168.2.150 192.168.2.250; # range pxe client ip address

next-server 192.168.2.60; # tftp server ip address

filename "pxelinux/pxelinux.0"; # /var/lib/tftpboot/pxelinux/pxelinux.0 see details below

}

[root@localhost ~]#

检查配置文件/etc/dhcp/dhcpd.conf语法是否正确

[root@localhost ~]# dhcpd -t

开启dhcpd服务

[root@localhost ~]# systemctl start dhcpd

查看dhcpd服务的状态

[root@localhost ~]# systemctl status dhcpd

查看dhcpd服务是否开机启动

[root@localhost ~]# systemctl is-enabled dhcpd

设置dhcpd服务开机启动

[root@localhost ~]# systemctl enable dhcpd

查看dhcpd服务是否开机启动

[root@localhost ~]# systemctl is-enabled dhcpd

配置XINETD服务

查看xinetd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep xinetd

搜索xinetd软件包

[root@localhost ~]# yum search xinetd

安装xinetd软件包

[root@localhost ~]# yum install xinetd –y

查看xinetd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep xinetd

查看xinetd服务状态

[root@localhost ~]# systemctl status xinetd

开启xinetd服务

[root@localhost ~]# systemctl start xinetd

查看xinetd服务状态

[root@localhost ~]# systemctl status xinetd

查看xinetd服务是否开机启动

[root@localhost ~]# systemctl is-enabled xinetd


配置TFTP服务

查看tftp服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep tftp

搜索tftp-server软件包

[root@localhost ~]# yum search tftp-server

安装tftp-server软件包

[root@localhost ~]# yum install tftp-server –y

查看tftp服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep tftp

查看tftp服务状态

[root@localhost ~]# systemctl status tftp.socket

[root@localhost ~]# systemctl status tftp.service

配置文件/etc/xinetd/tftp

[root@localhost ~]# sed -i ‘/disable/s/yes/no/‘ /etc/xinetd.d/tftp

[root@localhost ~]# cat /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

per_source = 11

cps = 100 2

flags = IPv4

}

[root@localhost ~]#

开启tftp服务

[root@localhost ~]# systemctl start tftp.socket

[root@localhost ~]# systemctl start tftp.service

查看tftp服务状态

[root@localhost ~]# systemctl status tftp.socket

[root@localhost ~]# systemctl status tftp.service

查看tftp服务是否开机启动

[root@localhost ~]# systemctl is-enabled tftp.socket

[root@localhost ~]# systemctl is-enabled tftp.service

设置tftp服务开机启动

[root@localhost ~]# systemctl enable tftp.socket

配置FTP服务

查看vsftpd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep vsftpd

搜索vsftpd软件包

[root@localhost ~]# yum search vsftpd

安装vsftpd软件包

[root@localhost ~]# yum install vsftpd –y

查看vsftpd服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep vsftpd

查看vsftpd服务状态

[root@localhost ~]# systemctl status vsftpd

配置文件/etc/vsftpd/vsftpd.conf

使用默认配置

[root@localhost ~]# cat /etc/vsftpd/vsftpd.conf


[root@localhost ~]#

开启vsftpd服务

[root@localhost ~]# systemctl start vsftpd

查看vsftpd服务状态

[root@localhost ~]# systemctl status vsftpd

查看vsftpd服务是否开机启动

[root@localhost ~]# systemctl is-enabled vsftpd

设置vsftpd服务开机启动

[root@localhost ~]# systemctl enable vsftpd

查看vsftpd服务是否开机启动

[root@localhost ~]# systemctl is-enabled vsftpd


RHELS7.1x86_64镜像文件

RHELS7.1x86_64光盘镜像rhel-server-7.1-x86_64-dvd.iso

挂载镜像

[root@localhost ~]# mount -o loop rhel-server-7.1-x86_64-dvd.iso /media/source/

目录文件/var/lib/tftpboot/pxelinux/

创建目录文件/var/lib/tftpboot/pxelinux/

[root@localhost ~]# mkdir -p /var/lib/tftpboot/pxelinux

查找syslinux软件包

[root@localhost ~]# find /media/source/ -name ‘syslinux*‘ | grep -v extlinux

解压syslinux软件包

[root@localhost ~]# find /media/source/ -name ‘syslinux*‘ | grep -v extlinux | xargs -I {} rpm2cpio {} | cpio –dimv

复制文件pxelinux.0到目录文件/var/lib/tftpboot/pxelinux/

[root@localhost ~]# find . -name ‘pxelinux.0‘ | xargs -I {} cp {} /var/lib/tftpboot/pxelinux/

复制文件initrd.img和vmlinuz到目录文件/var/lib/tftpboot/pxelinux/

[root@localhost ~]# cp /media/source/images/pxeboot/{initrd.img,vmlinuz} /var/lib/tftpboot/pxelinux/

复制文件vesamenu.c32和boot.msg到目录文件/var/lib/tftp/pxelinux/

[root@localhost ~]# cp /media/source/isolinux/{vesamenu.c32,boot.msg} /var/lib/tftpboot/pxelinux/

目录文件/var/lib/tftpboot/pxelinux/pxelinux.cfg/

创建目录文件/var/lib/tftpboot/pxelinux/pxelinux.cfg/

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

复制文件isolinux.cfg到目录文件/var/lib/tftpboot/pxelinux.cfg/将其改名为default

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

配置文件/var/lib/tftpboot/pxelinux/pxelinux.cfg/default

[root@localhost ~]# sed -i ‘/hd:/c \ append initrd=initrd.img ip=dhcp inst.repo=ftp://192.168.2.60/pub/‘ /var/lib/tftpboot/pxelinux/pxelinux.cfg/default

[root@localhost ~]# sed -i ‘/menu\ default/d‘ /var/lib/tftpboot/pxelinux/pxelinux.cfg/default

[root@localhost ~]# sed -i ‘/Install\ Red\ Hat\ Enterprise\ Linux\ 7\.1$/a \ menu\ default‘ /var/lib/tftpboot/pxelinux/pxelinux.cfg/default

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

default vesamenu.c32

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 Red Hat Enterprise Linux 7.1

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 Red Hat Enterprise Linux 7.1

menu default

kernel vmlinuz

append initrd=initrd.img ip=dhcp inst.repo=ftp://192.168.2.60/pub/


label check

menu label Test this ^media & install Red Hat Enterprise Linux 7.1

kernel vmlinuz

append initrd=initrd.img ip=dhcp inst.repo=ftp://192.168.2.60/pub/


menu separator # insert an empty line


# utilities submenu

menu begin ^Troubleshooting

menu title Troubleshooting


label vesa

menu indent count 5

menu label Install Red Hat Enterprise Linux 7.1 in ^basic graphics mode

text help

Try this option out if you‘re having trouble installing

Red Hat Enterprise Linux 7.1.

endtext

kernel vmlinuz

append initrd=initrd.img ip=dhcp inst.repo=ftp://192.168.2.60/pub/


label rescue

menu indent count 5

menu label ^Rescue a Red Hat Enterprise Linux system

text help

If the system will not boot, this lets you access files

and edit config files to try to get it booting again.

endtext

kernel vmlinuz

append initrd=initrd.img ip=dhcp inst.repo=ftp://192.168.2.60/pub/


label memtest

menu label Run a ^memory test

text help

If your system is having issues, a problem with your

system‘s memory may be the cause. Use this utility to

see if the memory is working correctly.

endtext

kernel memtest


menu separator # insert an empty line


label local

menu label Boot from ^local drive

localboot 0xffff


menu separator # insert an empty line

menu separator # insert an empty line


label returntomain

menu label Return to ^main menu

menu exit


menu end

[root@localhost ~]#

目录文件/var/ftp/pub/

复制光盘镜像中的所有内容到目录文件/var/ftp/pub/

[root@localhost ~]# cp -r /media/source/. /var/ftp/pub/

[root@localhost ~]# chmod -R 777 /var/ftp/pub/

配置FIREWALLD防火墙

查看firewalld服务是否存在

[root@localhost ~]# systemctl list-unit-files | grep firewalld

查看firewalld服务状态

[root@localhost ~]# firewall-cmd --state

[root@localhost ~]# systemctl status firewalld

查看firewalld服务是否开机启动

[root@localhost ~]# systemctl is-enabled firewalld

列出所有

[root@localhost ~]# firewall-cmd --list-all

添加服务

[root@localhost ~]# firewall-cmd --permanent --add-service=dhcp

[root@localhost ~]# firewall-cmd --permanent --add-service=tftp

[root@localhost ~]# firewall-cmd --permanent --add-service=ftp

重启firewalld服务

[root@localhost ~]# systemctl restart firewalld

列出所有

[root@localhost ~]# firewall-cmd --list-all

配置SELINUX

查看SELINUX状态

[root@localhost ~]# sestatus

[root@localhost ~]# getenforce

PXE网络安装RHELS 7.1 x86_64

标签:

原文地址:http://www.cnblogs.com/macleemosaic/p/4978197.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!