Create the NFS/server directory. This script automatically installs and configures the NFS server.
Install. Sh script:
#! /Bin/bash source.../common/tool. shnfs = "nfs-kernel-server" hasdpkg $ nfsr =$? If [$ R-EQ 1] Then ECHO "$ NFS was installed" else echo "$ NFS was not installed" apt-Get install $ nfsfiif [-d "/opt/share"] Then ECHO "/opt/share" exists alreadyelse mkdir-P/opt/share chmod-r 777/opt/sharefi # config/opt/share as NFS foldermv/etc/exports/ ETC/exports_bkmv/etc/hosts. deny/etc/hosts. deny_bkmv/etc/hosts. allow/etc/hosts. allow_bkcp exports/etc/CP hosts. deny/etc/CP hosts. allow/etc/service Portmap restartservice nfs-kernel-server restart
The exports, hosts. deny, and hosts. allow files have been prepared in the current directory.
Refer to the previous blog: http://blog.csdn.net/sheismylife/article/details/7987638
The IP address should be modified according to the specific deployment environment.
The hasdpkg function previously developed is reused here.