您的位置:首页 > 编程语言 > PHP开发

tftp和NFS服务器的建立

2012-02-29 21:02 246 查看
tftp和NFS服务器的建立

在嵌入式linux的开发环境中经常通过tftp服务器在U-boot启动后加载内核,内核启动后通过NFS挂载根文件系统,以下详细介绍两个服务器的建立过程。

1.tftp服务器的建立

 sudo apt-get install tftpd xinetd

 sudo mkdir /tftpboot

 sudo chmod -R 777 /tftpboot

 sudo gedit /etc/xinetd.d/tftp

编辑:

service tftp

{

 disable = NO

 server =/usr/sbin/in.tftp

 server_args = -S /tftpboot

 sock_type = dgram

 protocol = udp

 wait = yes

 user = root

 per_source =11

 cps = 100 2

 flags = ipv4

}

启动:

/etc/init.d/xinetd restart

 

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

对于ubuntu 11.10,以上的设置可能不成功,所以可用如下的方式

sudo apt-get install tftp-hpa tftpd-hpa
xinetd

配置/etc/default/tftpd-hpa,内容如下:

#/etc/default/tftpd-hpa

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/tftpboot"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="--secure -c"

重新启动服务:

$sudo /etc/init.d/tftpd-hpa restart

通过tftp的get和put进行测试:

$tftp localhost

tftp>get xx

tftp>put yy

/////////////////////////////////////////////////////

2.NFS服务器的建立

sudo apt-get install portmap nfs-kernel-server nfs-common

sudo gedit /etc/exports

编辑:

 /nfsroot  *(rw, sync, no_root_squash)

启动:

/etc/init.d/portmap restart

/etc/init.d/nfs-kernel-server restart

查看状态:

/etc/init.d/nfs-kernel-server status

          或者

netsata -a | grep nfs

测试NFS:

sudp mount -t nfs 192.168.1.57:/nfsrootfs /mnt/nfs            将主机nfsrootfs目录挂载在/mnt/nfs下

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息