RedHat Enterprise Linu…

来源:互联网 发布:新初一数学网络课程 编辑:程序博客网 时间:2024/05/22 17:47

Abstract

   在嵌入式开发中有宿主机和目标机之分:宿主机是执行编译、链接嵌入式软件的计算机;目标机是运行嵌入式软件的硬件平台。

  TFTP服务器作为工作于宿主机的软件,主要提供对目标机的主要映像文件的下载工作。

Solution

一.TFTP服务器的安装

  利用以下命令就可以看到TFTP服务器已启动,则不用安装

[root@localhost Server]# netstat -a |grep tftp
udp           0*:tftp                     *:*     

  若没有安装,在Redhat Enterprise Linux5的安装光盘中有RPM安装包,挂在光盘后进入到文件夹,找到相应的安装包。

[root@localhost user]# cd /media/
[root@localhost media]# ls
RHEL_5.1 i386 DVD
[root@localhost media]# cd RHEL_5.1\ i386\ DVD/
[root@localhost RHEL_5.1 i386 DVD]# ls 
[root@localhost RHEL_5.1 i386 DVD]# cd Server/

[root@localhost Server]# ls tftp*
tftp-0.42-3.1.i386.rpm tftp-server-0.42-3.1.i386.rpm

执行安装命令
[root@localhost Server]# rpm -ivh tftp-server-0.42-3.1.i386.rpm 
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature:NOKEY, key ID 37017186
error: Failed dependencies:
       xinetd is needed by tftp-server-0.42-3.1.i386

提示需要安装xinetd,找到安装包并安装

[root@localhost Server]# ls xinet*
xinetd-2.3.14-10.el5.i386.rpm

[root@localhost Server]# rpm -ivh xinetd-2.3.14-10.el5.i386.rpm 
warning: xinetd-2.3.14-10.el5.i386.rpm: Header V3 DSA signature:NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
  1:xinetd                ###########################################[100%]

 再执行安装TFTP命令
[root@localhost Server]# rpm -ivh tftp-server-0.42-3.1.i386.rpm 
warning: tftp-server-0.42-3.1.i386.rpm: Header V3 DSA signature:NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
  1:tftp-server           ###########################################[100%]

建立tftp的主工作目录
[root@localhost Server]# mkdir/tftpboot

 修改配置文件

[root@localhost Server]# vi/etc/xinetd.d/tftp

 主要注意修改的两个地方:

# default: off
# description: The tftp server serves files using the trivial filetransfer \
     protocol.  The tftp protocol is often used to bootdiskless \
     workstations, download configuration files to network-awareprinters, \
     and to start the installation process for some operatingsystems.
service tftp
{
       socket_type            = dgram
       protocol               = udp
       wait                   = yes
       user                   = root
       server                 = /usr/sbin/in.tftpd
       server_args            = -s /tftpboot
       disable                = no
       per_source             = 11
       cps                    = 100 2
       flags                  = IPv4
}

重启服务

[root@localhost Server]# /etc/init.d/xinetdrestart
Stoppingxinetd:                                          [FAILED]
Startingxinetd:                                           OK  ]

查看是否启动
[root@localhost Server]# netstat -a |grep tftp
udp           0*:tftp                     *:*    
二.NFS的安装

  NFS(Network FileSystem,网络文件系统)是一种将远程主机上的分区(目录)经网络挂在到本地的一种机制,通过对网络文件系统的支持,用户可以在本地系统上像操作本地分区一样来对远程主机的共享分区(目录)进行操作,类似于windows的共享目录。

查看安装版本
[root@localhost Server]# rpm -qnfs-utils-1.0.9-24.el5.i386.rpm 
package nfs-utils-1.0.9-24.el5.i386.rpm is notinstalled

没有安装,从光盘中找到相应的RPM安装包并安装
[root@localhost Server]# rpm -ivh nfs-utils-1.0.9-24.el5.i386.rpm 
warning: nfs-utils-1.0.9-24.el5.i386.rpm: Header V3 DSA signature:NOKEY, key ID 37017186
Preparing...               ########################################### [100%]
       package nfs-utils-1.0.9-24.el5 is alreadyinstalled

NFS配置,加入允许其他计算机访问的目录和访问权限
[root@localhost Server]# vi/etc/exports


  /home    192.168.1.*   (rw,sync,no_boot_squash)

1、home:允许其它计算机访问的目录

2、192.168.1.*:被允许访问该目录的客户端IP地址

3、Rw:可读可写

4、no_boot_squash:表示客户端root用户对该目录具备写权限

启动NFS服务器

[root@localhost Server]# /etc/init.d/nfs start
Starting NFS services:  exportfs: /etc/exports:1:unknown keyword "no_boot_squash"
                                                          [FAILED]
Starting NFSquotas:                                       OK  ]
Starting NFSdaemon:                                       OK  ]
Starting NFSmountd:                                      [  OK  ]

重启NFS服务器
[root@localhost Server]# /etc/init.d/nfs restart
Shutting down NFSmountd:                                  OK  ]
Shutting down NFSdaemon:                                  OK  ]
Shutting down NFSquotas:                                  OK  ]
Shutting down NFSservices:                               [FAILED]
Starting NFS services:  exportfs: /etc/exports:1:unknown keyword "no_boot_squash"
                                                          [FAILED]
Starting NFSquotas:                                       OK  ]
Starting NFSdaemon:                                       OK  ]
Starting NFSmountd:                                       OK  ]

最后,使用mount命令来挂载NFS服务器上的共享目录

#mount -t  nfs servername :/shared_dir/localdir
例如:

#mount -t nfs 10.168.1.100 :/home /mnt/nfs