几种网络文件系统服务的搭建说明(NFS ftpSSHsmb)

1. 搭建NFS服务

1.1 服务器

虚拟机ubuntu上搭建nfs服务器

1、apt-get install nfs-kernel-server nfs-common portmap

2、mkdir -p /home/cql/nfs # NFS的根目录

3、在/etc/exports中增加:

/home/cql/nfs *(rw,sync,no_root_squash) # 这个目录名要与上面新建的对应

4、exportfs -rv

/etc/init.d/rpcbind restart(注意高版本linux要把portmap替换为rpcbind)

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

5、可以在windows中验证服务器是否正常:showmount -e 192.168.199.104

1.2 客户端

1、内核打开NFS相关功能。

2、更新内核后,查看内核是否支持NFScat /proc/filesystem。

3、尝试双方互ping是否能通

4、mount -t nfs -o nolock  192.168.199.104:/root/nfs_rootfs /mnt。

2. 搭建SSH服务

1、本地测试:ssh localhost

1、将文件夹传送到192.168.199.102目标板上:scp -r lxc_bin root@192.168.199.102:/usr/sbin/lxc_bin

3. 搭建tftp服务

3.1 服务器

1、apt-get install xinetd。

2、apt-get install tftp tftpd

3、vi /etc/xinetd.d/tftp,写入:

service tftp

{

  socket_type = dgram

  wait = yes

  disable = no

  user = root

  protocol = udp

  server = /usr/sbin/in.tftpd

  server_args = -s /tftpboot

  #log_on_success += PID HOST DURATION

  #log_on_failure += HOST

  per_source = 11

  cps =100 2

  flags =IPv4

}

4、vi /etc/default/tftpd-hpa。写入

TFTP_USERNAME="tftp"

TFTP_DIRECTORY="/home/cql/tftp"

TFTP_ADDRESS=":69"

TFTP_OPTIONS="-l -c -s"

5、重启服务:

service tftpd-hpa restart

/etc/init.d/xinetd reload

/etc/init.d/xinetd restart

6、mkdir /tftptouch test.txt;并chmod 777 /tftp

7、本地测试

tftp localhost

3.2 客户端

uboot

tftpboot 0x8000000  192.168.199.103:20200813-bb-lxc-dropbear-rootfs.ext2

内核:

#tftp 192.168.199.103

tftp> get test.txt

tftp> q    // 退出后在当前目录可以看到test.txt

4. 搭建samb服务

1、ubuntu下载samb软件包。

2、Ubuntu建立samb服务端(共享文件夹)

3、Windows建立映射盘。

原文地址:https://www.cnblogs.com/mic-chen/p/13507965.html