Инструменты пользователя

Инструменты сайта


сервис_nfs

Сервис NFS

!!! Рекомендуется наличие PTR записей или записей в hosts !!!

Установка, настройка и запуск сервиса

Dеbian/Ubuntu

root@server:~# apt install nfs-kernel-server
root@server:~# cat /etc/exports
#/var/cache/apt/archives 192.168.X.0/24(ro,sync,no_subtree_check)
#/home 192.168.X.0/24(rw,sync,no_subtree_check)
#/var/www/html/sarg 192.168.X.1(rw,sync,no_subtree_check,no_root_squash)
root@server:~# service nfs-kernel-server restart

FreeBSD

[server:~] # cat /etc/exports
#/usr/ports -ro -network 192.168.X.0/24
#/var/cache/pkg -ro -network 192.168.X.0/24
#/usr/home -network 192.168.X.0/24
#/usr/local/www/apache24/data/sarg -maproot=root:wheel 192.168.X.1
[server:~] # cat /etc/rc.conf
...
rpcbind_enable="YES"
rpc_statd_enable="YES"
rpc_lockd_enable="YES"
mountd_enable="YES"
nfs_server_enable="YES"
[server:~] # /etc/rc.d/rpcbind start
Starting rpcbind.

[server:~] # service lockd start
Starting statd.
Starting lockd.

[server:~] # /etc/rc.d/mountd start
Starting mountd.

[server:~] # /etc/rc.d/nfsd start
Starting nfsd.

CentOS/SL

[root@server ~]# yum install nfs-utils

[root@server ~]# cat /etc/exports
/home 192.168.X.0/24(rw,no_acl,sync,no_subtree_check)
[root@server ~]# find /home -exec setfacl -b {} \;

[root@server ~]# find /home -type d -exec chmod 755 {} \;

Windows Server

Windows 2003

Windows 2008

Start->Administrative Tools->Server Manager->Roles->Add Role->File Server->Service for Network File System

В свойствах папки включить NFS Sharing, и настроить Permissions (ALL_MACHINES ReadWrite, AllowRootAccess)

# mount server:/home /home

# chmod 777 /home

Windows 2016

Перезапуск сервиса

(при изменении файла exports)

FreeBSD

[server:~] # service mountd reload

Ubuntu/Debian

root@server:~# service nfs-kernel-server force-reload

Установка nfs клиента

Debian/Ubuntu

root@client1:~# apt install nfs-common

FreeBSD

root@client1:~# cat /etc/rc.conf
...
rpcbind_enable="YES"
rpc_lockd_enable="YES"
rpc_statd_enable="YES"
...
root@client1:~# service lockd start

Использование сервиса

Просмотр ресурсов

# showmount -e server

Монтирование домашних каталогов

# mkdir /home

# mount server:/home /home

# umount /home

# cat /etc/fstab
...
server:/home            /home           nfs     rw,soft       0       0
# mount /home

Установка ПО

FreeBSD

[server:~] # portsnap fetch

[server:~] # portsnap update

[server:~] # cd /usr/ports/mail/fetchmail/

[server:ports/mail/fetchmail] # make fetch-recursive

[gate:~] # mount nfs:/usr/ports /usr/ports

[gate:~] # setenv WRKDIRPREFIX /var/tmp

[gate:~] # setenv BATCH yes

[gate:~] # cd /usr/ports/mail/fetchmail/

[gate:ports/mail/fetchmail] # make install clean

[gate:~] # umount /usr/ports

Ubuntu

root@gate:~# mount nfs:/var/cache/apt/archives /mnt

root@gate:~# dpkg -i /mnt/fetchmail*

root@gate:~# umount /mnt
сервис_nfs.txt · Последние изменения: 2019/07/03 13:21 — val