RedHat Enterprise Linux 5 安装TFTP服务器和NFS服务器
时间:2011-01-11 来源:风尘孤客
在嵌入式开发中有宿主机和目标机之分:宿主机是执行编译、链接嵌入式软件的计算机;目标机是运行嵌入式软件的硬件平台。
TFTP服务器作为工作于宿主机的软件,主要提供对目标机的主要映像文件的下载工作。
Solution
一.TFTP服务器的安装
利用以下命令就可以看到TFTP服务器已启动,则不用安装
[root@localhost Server]# netstat -a |grep tftp
udp 0 0 *:tftp *:*
若没有安装,在Redhat Enterprise Linux 5的安装光盘中有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 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 /tftpboot
disable = yes
per_source = 11
cps = 100 2
flags = IPv4
}
重启服务
[root@localhost Server]# /etc/init.d/xinetd restart
Stopping xinetd: [FAILED]
Starting xinetd: [ OK ]
查看是否启动
[root@localhost Server]# netstat -a |grep tftp
udp 0 0 *:tftp *:*
二.NFS的安装
NFS(Network File System,网络文件系统)是一种将远程主机上的分区(目录)经网络挂在到本地的一种机制,通过对网络文件系统的支持,用户可以在本地系统上像操作本地分区一样来对远程主机的共享分区(目录)进行操作,类似于windows的共享目录。
查看安装版本
[root@localhost Server]# rpm -q nfs-utils-1.0.9-24.el5.i386.rpm
package nfs-utils-1.0.9-24.el5.i386.rpm is not installed
没有安装,从光盘中找到相应的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 already installed
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 NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
重启NFS服务器
[root@localhost Server]# /etc/init.d/nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [FAILED]
Starting NFS services: exportfs: /etc/exports:1: unknown keyword "no_boot_squash"
[FAILED]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
最后,使用mount命令来挂载NFS服务器上的共享目录
#mount -t nfs servername :/shared_dir /localdir
例如:
#mount -t nfs 10.168.1.100 :/home /mnt/nfs