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

在Ubunut12.04上搭建TFTP和NFS服务器

2016-10-06 14:25 351 查看
安装tftp-server:sudo apt-get install tftpd-hpa

安装tftp-client(根据需要安装):sudo apt-get install tftp-hpa

配置TFTP服务器:sudo vim /etc/default/tftpd-hpa,修改为如下内容:
TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/home/yuntaohe/work/tftp"

TFTP_ADDRESS="0.0.0.0:69"

TFTP_OPTIONS="-l -c -s"

重新启动TFTP服务:sudo service tftpd-hpa restart

测试TFTP服务器:在u-boot命令行下将内核下载到内存中,ftp 30000000 uImage
dm9000 i/o: 0x20000000, id: 0x90000a46

DM9000: running in 16 bit mode

MAC: 00:0c:29:2a:5c:a5

operating at 100M full duplex mode

Using dm9000 device

TFTP from server 192.168.1.17; our IP address is 192.168.1.6

Filename 'uImage'.

Load address: 0x30000000

Loading: T #################################################################

     #################################################################

     ###########

     347.7 KiB/s

done

Bytes transferred = 2058416 (1f68b0 hex)

安装NFS服务器:sudo apt-get install nfs-kernel-server

指定NFS目录:sudo vim /etc/exports
/home/yuntaohe/work/nfs/rootfs    *(rw,sync,no_subtree_check,no_root_squash)

启动NFS服务:sudo /etc/init.d/nfs-kernel-server start

设置u-boot启动参数:set bootargs root=/dev/nfs init=/linuxrc nfsroot=192.168.1.17:/home/yuntaohe/work/nfs/rootfs ip=192.168.1.6  console=ttySAC0,115200

启动内核,查看NFS文件系统是否挂载成功:bootm
eth0: link down

IP-Config: Guessing netmask 255.255.255.0

IP-Config: Complete:

     device=eth0, addr=192.168.1.6, mask=255.255.255.0, gw=255.255.255.255,

     host=192.168.1.6, domain=, nis-domain=(none),

     bootserver=255.255.255.255, rootserver=192.168.1.17, rootpath=

Looking up port of RPC 100003/2 on 192.168.1.17

eth0: link up, 100Mbps, full-duplex, lpa 0x4DE1

Looking up port of RPC 100005/1 on 192.168.1.17

VFS: Mounted root (nfs filesystem) on device 0:12.

Freeing init memory: 156K

[root@hyt /]#

[root@hyt /]#ls

bin      etc      lib      mnt      sbin     temp

dev      home     linuxrc  proc     sys      usr
挂载成功,挂载NFS文件系统:mount -o nolock 192.168.1.17:/home/yuntaohe/work/nfs/rootfs /mnt/nfs
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: