RHEL6无人值守安装(NFS安装)

在网络上有很多关于无人值守安装方法,但是大部分都是用 FTP,用HTTP 和 FTP 基本上差不多,所以今天我们没事干就用 NFS 也安装了一个,发现 NFS 和那两个有些区别,所以就和大家一起来分享一下我的实验成果 ,希望能给大家带来一些帮助。

方法:NFS+TFTP+DHCP+Kickstart+PXE准备两台虚拟机,一台作为测试环境(RHEL6,IP 为 192.168.0.254),另一台作为RHEL6被安装端,设置网络引导安装。安装所需要的服务及修改相应配置文件 :

1.用 yum 来安装所需要的软件包,先来搭建 yum 光盘源:[root@ ~]# mount /dev/cdrom /mnt在/etc/yum.repos.d 目录下创建一个以.repo 结尾的文件:[root@ ~]# vi /etc/yum.repos.d/server.repo配置内容如下:[server]name=this is my yum serverbaseurl=file:///mnt /Serverenabled=1gpgcheck=0gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release然后执行 rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-releasegpgkey2.安装 TFTP,修改 tftp 配置文件及开启服务[root@ ~]# yum install tftp-serverLoaded plugins: refresh-packagekit, rhnpluginThis system is not registered with RHN.RHN support will be disabled.aaa| 3.7 kB 00:00 …Setting up Install ProcessResolving Dependencies–> Running transaction check—> Package tftp-server.x86_64 0:0.49-5.1.el6 set to be updated–> Finished Dependency ResolutionDependencies Resolved=========================================================================================================PackageArchVersionRepositorySize=========================================================================================================Installing:tftp-serverx86_640.49-5.1.el6aaa39 kTransaction Summary=========================================================================================================Install1 Package(s)Upgrade0 Package(s)Total download size: 39 kInstalled size: 57 kIs this ok [y/N]: yDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : tftp-server-0.49-5.1.el6.x86_641/1Installed:tftp-server.x86_64 0:0.49-5.1.el6Complete![root@ ~]#[root@ ~]# 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 = dgramprotocol = udpwait = yesuser = rootserver = /usr/sbin/in.tftpdserver_args = -s /var/lib/tftpbootdisable = noper_source = 11cps = 100 2flags = IPv4}[root@ ~]# /etc/init.d/xinetd restartStopping xinetd:[ OK ]Starting xinetd:[ OK ][root@ ~]#~3.在/下面创建一个 NFS 目录,并且共享出去如下:[root@ ~]# mkdir /NFS[root@ ~]# vim /etc/exports/NFS192.168.0.0/24(rw,sync)[root@ ~]# /etc/init.d/nfs restartShutting down NFS mountd:Shutting down NFS daemon:Shutting down NFS quotas:Starting NFS services:Starting NFS quotas:Starting NFS daemon:Starting NFS mountd:[FAILED][FAILED][FAILED][ OK ][ OK ][ OK ][ OK ]4.安装 dhcp,修改配置文件及开启服务:[root@ ~]# yum install dhcp -yLoaded plugins: refresh-packagekit, rhnpluginThis system is not registered with RHN.RHN support will be disabled.Setting up Install ProcessResolving Dependencies–> Running transaction check—> Package dhcp.x86_64 12:4.1.1-12.P1.el6 set to be updated–> Finished Dependency ResolutionDependencies Resolved=========================================================================================================PackageArchVersionRepositorySize=========================================================================================================Installing:dhcpx86_6412:4.1.1-12.P1.el6aaa820 kTransaction Summary=========================================================================================================Install1 Package(s)Upgrade0 Package(s)Total download size: 820 kInstalled size: 2.0 MDownloading Packages:Running rpm_check_debugRunning Transaction TestTransaction Test SucceededRunning TransactionInstalling : 12:dhcp-4.1.1-12.P1.el6.x86_641/1Installed:dhcp.x86_64 12:4.1.1-12.P1.el6Complete![root@ ~]#[root@ ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample/etc/dhcp/dhcpd.conf[root@ ~]# vim /etc/dhcp/dhcpd.conf(RHEL6 原文件内容如下所示,一开始看上去可能觉得很乱)# dhcpd.conf## Sample configuration file for ISC dhcpd## option definitions common to all supported networks…option domain-name “example.org”;option domain-name-servers ns1.example.org, ns2.example.org;default-lease-time 600;max-lease-time 7200;# Use this to enble / disable dynamic dns updates globally.#ddns-update-style none;# If this DHCP server is the official DHCP server for the local# network, the authoritative directive should be uncommented.#authoritative;# Use this to send dhcp log messages to a different log file (you also# have to hack syslog.conf to complete the redirection).log-facility local7;# No service will be given on this subnet, but declaring it helps the# DHCP server to understand the network topology.subnet 10.152.187.0 netmask 255.255.255.0 {}# This is a very basic subnet declaration.subnet 10.254.239.0 netmask 255.255.255.224 {range 10.254.239.10 10.254.239.20;option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;}# This declaration allows BOOTP clients to get dynamic addresses,# which we don’t really recommend.subnet 10.254.239.32 netmask 255.255.255.224 {range dynamic-bootp 10.254.239.40 10.254.239.60;option broadcast-address 10.254.239.31;option routers rtr-239-32-1.example.org;}# A slightly different configuration for an internal subnet.subnet 10.5.5.0 netmask 255.255.255.224 {range 10.5.5.26 10.5.5.30;option domain-name-servers ns1.internal.example.org;option domain-name “internal.example.org”;option routers 10.5.5.1;option broadcast-address 10.5.5.31;default-lease-time 600;max-lease-time 7200;}# Hosts which require special configuration options can be listed in# host statements. If no address is specified, the address will be# allocated dynamically (if possible), but the host-specific information# will still come from the host declaration.host passacaglia {hardware ethernet 0:0:c0:5d:bd:95;filename “vmunix.passacaglia”;server-name “toccata.fugue.com”;}# Fixed IP addresses can also be specified for hosts. These addresses# should not also be listed as being available for dynamic assignment.# Hosts for which fixed IP addresses have been specified can boot using# BOOTP or DHCP. Hosts for which no fixed address is specified can only# be booted with DHCP, unless there is an address range on the subnet# to which a BOOTP client is connected which has the dynamic-bootp flag# set.host fantasia {hardware ethernet 08:00:07:26:c0:a5;fixed-address fantasia.fugue.com;}# You can declare a class of clients and then do address allocation# based on that. The example below shows a case where all clients# in a certain class get addresses on the 10.17.224/24 subnet, and all# other clients get addresses on the 10.0.29/24 subnet.class “foo” {match if substring (option vendor-class-identifier, 0, 4) = “SUNW”;}shared-network 224-29 {subnet 10.17.224.0 netmask 255.255.255.0 {option routers rtr-224.example.org;}subnet 10.0.29.0 netmask 255.255.255.0 {option routers rtr-29.example.org;}pool {allow members of “foo”;range 10.17.224.10 10.17.224.250;}pool {deny members of “foo”;range 10.0.29.10 10.0.29.230;}}所以我把 RHEL5 里的 dhcp 原文件复制过来如下:ddns-update-style interim;ignore client-updates;filename “pxelinux.0″;next-server 192.168.0.254; (这两行是新加的内容)subnet 192.168.0.0 netmask 255.255.255.0 {# — default gatewayoption routersoption subnet-mask192.168.0.254;255.255.255.0;option nis-domain”domain.org”;option domain-name”domain.org”;option domain-name-servers192.168.0.254;option time-offset-18000; # Eastern Standard Time#option ntp-servers192.168.1.1;#option netbios-name-servers 192.168.1.1;# — Selects point-to-point node (default is hybrid). Don’t change this unless# — you understand Netbios very well#option netbios-node-type 2;range dynamic-bootp 192.168.0.100 192.168.0.200;default-lease-time 21600;max-lease-time 43200;# we want the nameserver to appear at a fixed addresshost ns {next-server marvin.redhat.com;hardware ethernet 12:34:56:78:AB:CD;fixed-address 207.175.42.254;}}[root@ ~]# /etc/init.d/dhcpd configtestSyntax: OK[root@ ~]# /etc/init.d/dhcpd restartStarting dhcpd:[ OK ][root@ ~]#

,都会有回报,愿你天天开心。

RHEL6无人值守安装(NFS安装)

相关文章:

你感兴趣的文章:

标签云: