您的位置:首页 > 理论基础 > 计算机网络

网络安装Centos 6.6 基本NFS

2015-05-19 23:46 183 查看
原系统无法启动的就想借这个机会,放弃伟大windows os完全的投入linux的怀抱中。U盘安装的方法一下没有安装成的,这个以后还是要测试的。
正常今天的linux运维之道的书到了,开始就讲了系统的基本安装与无人值守安装的,我只测试了前一段的安装方法。无人值守安装还没有进行实验的。
主体流程:PXE网络启动--DHCP分配IP--TFTP网络引导--NFS安装
1.安装TFTPSERVER
tftp服务是在xinetd.d 下的一个TFTP程序的。安装方法:
[xjlsky@xxr Desktop]# yum install -y tftp-server
安装完成,验证一下安装的文件
[root@xxr Desktop]# rpm -qa | grep tftp-server
tftp-server-0.49-7.el6.x86_64 #查看RPM包已安装
[root@xxr Desktop]# yum info tftp-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.yun-idc.com
* extras: mirrors.opencas.cn
* updates: mirrors.opencas.cn
Installed Packages
Name : tftp-server
Arch : x86_64
Version : 0.49
Release : 7.el6
Size : 57 k
Repo : installed #安装成功
From repo : base
Summary : The server for the Trivial File Transfer Protocol (TFTP)
URL : http://www.kernel.org/pub/software/network/tftp/ License : BSD
Description : The Trivial File Transfer Protocol (TFTP) is normally used only
: for booting diskless workstations. The tftp-server package
: provides the server for TFTP, which allows users to transfer files
: to and from a remote machine. TFTP provides very little security,
: and should not be enabled unless it is expressly needed. The TFTP
: server is run from /etc/xinetd.d/tftp, and is disabled by default.
配置TFTP 配置文件位置:/etc/xinetd.d/tftp
[root@xxr Desktop]# 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 # yes 需要修改 no 启动TFTP服务
per_source = 11
cps = 100 2
flags = IPv4
}
配置文件完成,启动服务
[root@xxr Desktop]# service xinetd start
Starting xinetd: [ OK ]
查看一下端口

[root@xxr Desktop]# netstat -naudp | grep :69
udp 0 0 0.0.0.0:69 0.0.0.0:* 5748/xinetd
[root@xxr Desktop]#
已经成功启动服务
2.安装配置DHCP服务
DHCP安装 [root@xxr Desktop]# yum install -y dhcp
这里就验证的,需要验证的同学可以参加步骤1的验证方法 使用rpm & yum info命令。
编辑配置文件,文件路径:/etc/dhcp/dhcpd.conf 简单写了一下配置的满足基本需求就好了。
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.20;
option routers 192.168.1.1;
default-lease-time 600;
max-lease-time 7200;
next-server 192.168.1.1; # TFTP服务器的地址,我这里本机,DHCP与TFTP不在一台机可更换
filename "pxelinux.0"; #设置在TFTP下载的启动文件
}
验证一下配置文件是否正确
[root@xxr dhcp]# service dhcpd configtest
Syntax: OK

启动DHCP服务
[root@xxr dhcp]# service dhcpd start
Starting dhcpd: [FAILED]
启动失败查看了LOG文件
错误提示如下:May 19 22:59:18 xxr dhcpd: Not configured to listen on any interfaces!
错误的原因:机器上是双NIC,需要指定一个监听的NIC
修改配置文件:
[root@xxr Desktop]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS="wlan0"

有时候还可能是权限的问题的修改配置文件:[root@xxr dhcp]# vim /etc/rc.d/init.d/dhcpd
修改USER与GROUP 用户为ROOT
[root@xxr dhcp]# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
现在已经配置完成DHCP服务。
3.开始准备安装文件与引导启动文件的
将客户端所需的启动文件复制到TFTP服务器上
[root@xxr Desktop]# yum install -y syslinux #最小化安装linux的时候可能找不到pxelinux.0这个引导文件,所以需要安装一下支持文件:syslinux
复制pxelinux.0到TFTP共享目录中

[root@xxr Desktop]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

然后挂载光盘或ISO文件到系统中,复制启动镜像文件与启动配置文件
[root@xxr Desktop]# monut /dev/cdrom /mnt
[root@xxr ~]#cd /mnt
[root@xxr ~]#cp -rf * /var/www/html # 复制光盘文件到目录中

[root@xxr ~]# cp /var/www/html/isolinux/{vmlinuz,initrd.img} /var/lib/tftpboot/
[root@xxr ~]# cd /var/lib/tftpboot/
[root@xxr ~]# mkdir pxelinux.cfg #一定要在TFTP的共享目录下创建这个文件
[root@xxr ~]# cp /var/www/html/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
[root@xxr ~]#chmod 644 default
[root@xxr ~]# vim default
#default vesamenu.c32 #原文件
default linux #修改
#prompt 1
timeout 600

display boot.msg

menu background splash.jpg
menu title Welcome to CentOS 6.6!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label linux
menu label ^Install or upgrade an existing system
menu default
kernel vmlinuz
append initrd=initrd.img #如需要无人值守时需要配置一个KS 不配置就是网络安装
#label vesa
# menu label Install system with ^basic video driver
# kernel vmlinuz
# append initrd=initrd.img xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
#label local
# menu label Boot from ^local drive
# localboot 0xffff
#label memtest86
# menu label ^Memory test
# kernel memtest
# append -
4.配置NFS
创建共享文件:
[root@xxr ~]# vim /etc/exports
/var/www/html 192.168.8.0/24
验证共享文件
[root@xxr pxelinux.cfg]# exportfs
/var/www/html 192.168.1.0/24
启动NFS服务
[root@xxr pxelinux.cfg]# service nfs start

5.关闭防火墙
[root@xxr pxelinux.cfg]# service iptables stop

按上配置方法,网络安装OS一定可以成功的。如果过程有问题的可以详细查看一下自己的配置是否有错误或者遗漏。
明天有时间把KICKSTART无人值守的配置实验一下。请后续关注。谢谢。有错误的地方欢迎大家给指出。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  DHCP PXE centos TFTP