These instructions are a basic guide for a super-user to install and configure NFS on LinuxCentOS 7.
Installation
The basic installation commands are as follows.
For CentOS-RHEL:
Install NFS server
Code Block | ||||
---|---|---|---|---|
| ||||
yum -y install nfs-utils nfs-utils-lib |
For Ubuntu:Create export directory
Code Block |
---|
sudo apt-get install nfs-kernel-server
|
Configuration
Edit /etc/exports and add the following line:
Code Block |
---|
/opt/vm_repository *(rw,no_root_squash,subtree_check,insecure)
|
Edit /etc/samba/smb.conf, empty the file, and add this configuration:
Code Block |
---|
[global]
workgroup = WORKGROUP
server string = %h server
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
security = share
guest account = root
encrypt passwords = true
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
[vm_repository]
path = /opt/vm_repository
guest ok = yes
read only = false
locking = yes
|
The NFS shared directory must have an empty file named .abiquo_repository (the dot prefix is required).
To create the file, run the following command:
Code Block | ||
---|---|---|
| ||
touch /<path-to-shared-dir>/.abiquo_repositorymkdir /opt/nfs_share touch /opt/nfs_share/.abiquo_repository chmod -R 755 /opt/nfs_share chown nfsnobody:nfsnobody /opt/nfs_share |
Enable and start NFS services
Code Block |
---|
systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap |
Edit /etc/exports to share the NFS directory
Code Block |
---|
/opt/nfs_share *(rw,sync,no_root_squash,no_all_squash) |
Restart NFS service
Code Block |
---|
systemctl restart nfs-server |