- NFS服务器运行原理
- 实战配置NFS服务器
- 配置Samba服务器及实现文件共享
(一)NFS器服务端描述
- NFS服务器: Network File System,网络文件系统使FreeBSD支持的一种
- 系统安装,直接用yum方式安装 # yum -y install NFS*
- 启动服务 #/etc/init.d/nfs start
启动显示失败:annot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad ,需要启动rpc服务 -
# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
4. 查看NFS服务启动端口 # netstat -antup | grep 2049
# chkconfig nfs on # chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
5. 设置开机自启动
6. 查看共享目录
# showmount -e 192.168.0.35 Export list for 192.168.0.35:
7. 设置共享目录
编辑 #vim /etc/exports
/mysh * {rwx} ### 允许访问的网段 用户 权限 ,*表示所有用户
### 多网段分开写
8. 重启NFS服务,查看NFS共享,并进行挂载
# showmount -e 192.168.0.35 Export list for 192.168.0.35: /mysh *# mount -t nfs 192.168.0.35:/mysh/ /opt/# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda3 19G 5.1G 13G 29% / tmpfs 427M 72K 427M 1% /dev/shm /dev/sda1 97M 34M 59M 37% /boot 192.168.0.35:/mysh/ 9.5G 1.1G 8.0G 12% /opt
9. 开机自动挂载 编辑 /etc/fstab 文件,添加即可
10.权限问题 1)服务本身权限
2)目录权限 # chmod 777 -R /mysh/
# grep nfs /etc/passwd rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin