Documente Academic
Documente Profesional
Documente Cultură
NFS (Network File System) is another way of sharing files across a network. It is used primarily in Linux and UNIX
systems, although there are NFS clients for Windows.
Installing NFS
Configuring NFS
Configuration of NFS is pretty simple. You add the directories you wish to export to the file /etc/exports.
mkdir /public
vi /etc/exports
/public *(ro,sync)
*--The clients allowed to access the share. You can restrict it by IP address. For example, you could, instead of the
asterisk, put
sync--Reply to requests only after any changes have been committed to stable storage. This is a slower, but more stable
option than alternatives.
In the following screen capture, you can see how I configured /etc/exports to share /public:
6. NFS requires the rpcbind service to be running. Start it with the following command:
9. Enable the export immediately with the command exportfs -v. You can view the export with the command
showmount -e.
If you are using a firewall, you must explicitly allow traffic from your local subnet to access the server.
You must install the nfs package on the client with this command:
Once the package is installed, you can use the showmount command to view exports on an NFS
server:
You can also create a new directory on your client and mount the NFS export to the directory, thus giving you access to
the files in the directory:
Figure 9: Creating and viewing a mount point for the NFS share.
In the above example, I mounted the export from LinuxServer01 (/public) to a directory on my local client machine,
called ubuntuServer02. As you can see, after it was mounted, I was able to view the contents of the exported directory
locally.
Installing rsync
Use yum to install rsync with the command: yum install -y rsync. The rsync utility must be installed on both computers
participating in the mirroring.
Basic rsync syntax
-a--archive mode, which allows copying files recursively, plus it preservers symbolic links, user and group ownership, file
permissions, and timestamps
-e--specifies the remote shell to use. This option allows you to use SSH for the transfer
-u--updates only files that have changed since the last rsync
-v--verbose
-z--compress data
By itself, rsync transfers data in the clear. You can enable rsync over ssh with the e option, as you'll see in the upcoming
exercise.