歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> RHEL6無人值守安裝(NFS安裝)

RHEL6無人值守安裝(NFS安裝)

日期:2017/2/28 16:08:34   编辑:Linux教程

在網絡上有很多關於無人值守安裝方法,但是大部分都是用 FTP,用HTTP 和 FTP 基本上差不多,所以今天我們沒事干就用 NFS 也安裝了一個,發現 NFS 和那兩個有些區別,所以就和大家一起來分享一下我的實驗成果 ,希望能給大家帶來一些幫助。

方法:NFS+TFTP+DHCP+Kickstart+PXE
准備兩台虛擬機,一台作為測試環境(RHEL6,IP 為 192.168.0.254),另一台作為RHEL6被安裝端,設置網絡引導安裝。
安裝所需要的服務及修改相應配置文件 :

1.用 yum 來安裝所需要的軟件包,先來搭建 yum 光盤源:
[[email protected] ~]# mount /dev/cdrom /mnt
在/etc/yum.repos.d 目錄下創建一個以.repo 結尾的文件:
[[email protected] ~]# vi /etc/yum.repos.d/server.repo
配置內容如下:
[server]
name=this is my yum server
baseurl=file:///mnt /Server
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-RedHat-release
然後執行 rpm –import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
gpgkey
2.安裝 TFTP,修改 tftp 配置文件及開啟服務
[[email protected] ~]# yum install tftp-server
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
aaa
| 3.7 kB 00:00 ...
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:0.49-5.1.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================
===========================================
Package
Arch
Version
Repository
Size
==============================================================
===========================================
Installing:
tftp-server
x86_64
0.49-5.1.el6
aaa
39 k
Transaction Summary
==============================================================
===========================================
Install
1 Package(s)
Upgrade
0 Package(s)
Total download size: 39 k
Installed size: 57 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tftp-server-0.49-5.1.el6.x86_64
1/1
Installed:
tftp-server.x86_64 0:0.49-5.1.el6
Complete!
[[email protected] ~]#
[[email protected] ~]# 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 = 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
}
[[email protected] ~]# /etc/init.d/xinetd restart
Stopping xinetd:
[ OK ]
Starting xinetd:
[ OK ]
[[email protected] ~]#
~
3.在/下面創建一個 NFS 目錄,並且共享出去如下:
[[email protected] ~]# mkdir /NFS
[[email protected] ~]# vim /etc/exports
/NFS
192.168.0.0/24(rw,sync)
[[email protected] ~]# /etc/init.d/nfs restart
Shutting 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,修改配置文件及開啟服務:
[[email protected] ~]# yum install dhcp -y
Loaded plugins: refresh-packagekit, rhnplugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package dhcp.x86_64 12:4.1.1-12.P1.el6 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================
===========================================
Package
Arch
Version
Repository
Size
==============================================================
===========================================
Installing:
dhcp
x86_64
12:4.1.1-12.P1.el6
aaa
820 k
Transaction Summary
==============================================================
===========================================
Install
1 Package(s)
Upgrade
0 Package(s)
Total download size: 820 k
Installed size: 2.0 M
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : 12:dhcp-4.1.1-12.P1.el6.x86_64
1/1
Installed:
dhcp.x86_64 12:4.1.1-12.P1.el6
Complete!
[[email protected] ~]#
[[email protected] ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample
/etc/dhcp/dhcpd.conf
[[email protected] ~]# 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 gateway
option routers
option subnet-mask
192.168.0.254;
255.255.255.0;
option nis-domain
"domain.org";
option domain-name
"domain.org";
option domain-name-servers
192.168.0.254;
option time-offset
-18000; # Eastern Standard Time
#
option ntp-servers
192.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 address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
}
}
[[email protected] ~]# /etc/init.d/dhcpd configtest
Syntax: OK
[[email protected] ~]# /etc/init.d/dhcpd restart
Starting dhcpd:
[ OK ]
[[email protected] ~]#

Copyright © Linux教程網 All Rights Reserved