ubuntu上的tftp和nfs环境搭建

NFS环境搭建

1:

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

2:

1 sudo mkdir /exports

3:

 1 sudo gedit /etc/exports
 2 
 3 
 4 # /etc/exports: the access control list for filesystems which may be exported
 5 #        to NFS clients.  See exports(5).
 6 #
 7 # Example for NFSv2 and NFSv3:
 8 # /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
 9 #
10 # Example for NFSv4:
11 # /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
12 # /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
13 #
14 
15 /exports 192.168.0.0/255.255.255.0(rw,no_root_squash)

4:确认NFS是否安装成功

sudo exportfs -a

5:成功结果确认

1 $ sudo exportfs –v
2   /exports 192.168.0.0/255.255.255.0(rw,wdelay,no_root_squash,no_subtree_check)

 

TFTP环境搭建

1:

1 sudo apt-get install tftp tftpd

2

 1 sudo vi /etc/xinetd.d/tftp
 2 
 3 service tftp
 4 {
 5     protocol    = udp
 6     port    = 69
 7     socket_type     = dgram
 8     wait    = yes
 9     user    = nobody
10     server    = /usr/sbin/in.tftpd
11     server_args    = /tftpboot
12     disable    = no
13 }

3:

1 $ sudo mkdir /tftpboot
2   $ sudo chmod -R 777 /tftpboot
3   $ sudo chown -R nobody /tftpboot/
4   $ sudo service xinetd restart

 

 如果出现

启动或者重启xinetd服务:
ky@ubuntu:~$ sudo /etc/init.d/xinetd start或者restart

############################按照网上教程一直出错Transfer timed out

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

1:卸载之前安装的 tftp-hpa tftpd-hpa xinetd软件

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

2:重新安装 tftp-hpa tftpd-hpa xinetd软件

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

3;配置/etc/default/tftpd-hpa 内容如下

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftpboot"   //修改成自己要使用的tftpboot目录
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure -c"   //-c 表示可以创建文件 -c  create

4:创建tftp目录

mkdir /tftpboot

chmod 777 /tftpboot

5:重新启动服务

service tftpd-hpa restart
tftpd-hpa stop/waiting
tftpd-hpa start/running, process 6287

6:测试tftp

root@Linux:/# tftp localhost
tftp> get zImage
tftp> q

posted @ 2020-04-26 17:27  蒲城小农  阅读(155)  评论(0)    收藏  举报