Files
nfs-util/ReadMe.md
2023-10-16 18:51:47 +08:00

153 lines
5.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

https://linuxfromscratch.org/blfs//view/8.3/basicnet/nfs-utils.html
## libtirpc
- libtirpc Dependencies
Optional
MIT Kerberos V5-1.19.1 for the GSSAPI
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/libtirpc
- Installation of libtirpc
[Note] Note
If updating this package, you will also need to update any existing version of rpcbind-1.2.5
```shell
./configure --prefix=/usr \
--sysconfdir=/etc \
--disable-static \
--disable-gssapi &&
make
```
This package does not come with a test suite.
Now, as the root user:
```shell
make install &&
mv -v /usr/lib/libtirpc.so.* /lib &&
ln -sfv ../../lib/libtirpc.so.3.0.0 /usr/lib/libtirpc.so
```
Command Explanations
--disable-static: This switch prevents installation of static versions of the libraries.
--disable-gssapi: This switch is needed if no GSSAPI is installed. Remove this switch if you have one installed (for example MIT Kerberos V5-1.19.1) and you wish to use it.
mv -v /usr/lib/libtirpc.so.* ...: Move shared libraries into /lib so they are available before /usr is mounted.
```shell
# 配置
./configure --prefix=${PWD}/../_install --disable-static --disable-gssapi
# 编译
make && make install
```
## rpcsvc-proto
Installation of rpcsvc-proto
Install rpcsvc-proto by running the following commands:
```shell
./configure --sysconfdir=/etc &&
make
```
This package does not come with a test suite.
Now, as the root user:
```shell
make install
```
```shell
# 配置
./configure --prefix=${PWD}/../_install
# 编译
make && make install
```
## NFS-Utils
NFS Utilities Dependencies
Required
libtirpc-1.3.1 and rpcsvc-proto-1.4.2
Optional
Cyrus SASL-2.1.27 (for SASL authentication), LVM2-2.03.11 (libdevmapper for NFSv4 support), libnsl-1.3.0 (for NIS client support), OpenLDAP-2.4.58 (for LDAP authentication), SQLite-3.35.4, MIT Kerberos V5-1.19.1 or libgssapi , and librpcsecgss (for GSS and RPC security support), and libcap-2.49 with PAM
Required (runtime)
rpcbind-1.2.5
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/nfs-utils
Kernel Configuration
Enable the following options in the kernel configuration (choose client and/or server support as appropriate) and recompile the kernel if necessary:
File systems --->
[*] Network File Systems ---> [CONFIG_NETWORK_FILESYSTEMS]
<*/M> NFS client support [CONFIG_NFS_FS]
<*/M> NFS server support [CONFIG_NFSD]
Select the appropriate sub-options that appear when the above options are selected.
[Note] Note
In BLFS we assume that nfs v3 will be used. If the server offers nfs v4 (for linux, CONFIG_NFSD_V4) then auto-negotiation for v3 will fail and you will need to add nfsver=3 to the mount options. This also applies if that option is enabled in the client's kernel, for example in a distro trying to mount from a BLFS v3 server.
Even if neither end of the connection supports nfs v4, adding nfsver=3 is still beneficial because it prevents an error message "NFS: bad mount option value specified: minorversion=1" being logged on every mount.
Installation of NFS Utilities
Before you compile the program, ensure that the nobody user and nogroup group have been created as done in the current LFS book. You can add them by running the following commands as the root user:
```shell
groupadd -g 99 nogroup &&
useradd -c "Unprivileged Nobody" -d /dev/null -g nogroup \
-s /bin/false -u 99 nobody
```
[Note] Note
The classic uid and gid values are 65534 which is also -2 when interpreted as a signed 16-bit number. These values impact other files on some filesystems that do not have support for sparse files. The nobody and nogroup values are relatively arbitrary. The impact on a server is nil if the exports file is configured correctly. If it is misconfigured, an ls -l or ps listing will show a uid or gid number of 65534 instead of a name. The client uses nobody only as the user running rpc.statd.
Install NFS Utilities by running the following commands:
```shell
./configure --prefix=/usr \
--sysconfdir=/etc \
--sbindir=/sbin \
--disable-nfsv4 \
--disable-gss &&
make
```
This package does not come with a working test suite.
Now, as the root user:
make install &&
chmod u+w,go+r /sbin/mount.nfs &&
chown nobody.nogroup /var/lib/nfs
```shell
sudo apt-get install automake libtool
./configure --prefix=${PWD}/../_install --disable-nfsv4 --disable-gss --disable-uuid --disable-mount --sbindir=${PWD}/../_install/sbin/ --with-statedir=${PWD}/../_install/var/lig/nfs/
# install-data-hook目标错误修改Makefile屏蔽chown/var/lib/nfs
#
make
```
## 启动
https://blog.csdn.net/qq_26601681/article/details/104940430
http://www.cnitblog.com/gouzhuang/archive/2010/03/23/nfs_utils.html
```shell
sudo mount -t nfsd nfsd /proc/fs/nfsd
./../_install/sbin/rpc.statd
./../_install/sbin/rpc.nfsd
./../_install/sbin/rpc.mountd
```