centos7.4 nfs-2.3.2

http://www.linuxfromscratch.org/blfs/view/svn/basicnet/libtirpc.html

注释:安装环境centos7.4;   安装完软件成后会升级系统版本,内核版本不变

#安装软件
yum -y install libwrap libwrap-devel libtirpc libtirpc-devel libevent libevent-devel device-mapper-event-libs device-mapper-libs libdevmapper libdevmapper-devel device-mapper-devel libblkid libblkid-devel dh-autoreconf rpcbind redhat-lsb initscripts libnfs-utils
yum -y install autoconf automake libtool

#解压包
tar xf nfs-utils-2.3.2.tar.gz
cd nfs-utils-2.3.2
sed -i '/strict-prototypes/d' configure.ac
autoreconf -fiv

#编译
./configure --prefix=/usr
--sysconfdir=/etc
--sbindir=/usr/sbin
--without-tcp-wrappers
--disable-nfsv4
--disable-gss

make && make install

#授权
chmod u+w,go+r /sbin/mount.nfs
mkdir /opt/data
chown -R nobody.nobody /opt/data

#配置挂载信息
cat /etc/exports
/opt/data 10.111.6.218/24(rw,subtree_check,anonuid=99,anongid=99)
exportfs -rv

#启动进程
systemctl start rpcbind

cat > /etc/sysconfig/nfs-server << "EOF"
PORT="2049"
PROCESSES="8"
KILLDELAY="10"
EOF
此时在上传另一个启动脚本
tar xf blfs-bootscripts-20180105.tar.xz
cd blfs-bootscripts-2018010
make install-nfs-server
/etc/init.d/nfs-server start

systemctl daemon-reload

#检测
netstat -luntp|grep 2049
netstat -luntp|grep 111

#检测本地挂载
showmount -e localhost

***********Clicent************
#查看可挂载的文件
showmount -e 10.111.6.218

mount -t nfs 10.111.6.218:/opt/data /mnt

#需开放端口

原文地址:https://www.cnblogs.com/huangyanqi/p/9604608.html