-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
88 lines (64 loc) · 2.31 KB
/
install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Parent direct for NFS shares and subdirectories
/exports
cd /exports
mkdir backup
mkdir documents
# Now install Packages
sudo apt install nfs-kernel-server
systemctl status nfs-kernel-server
# Create a fresh one exports configuration
cat /etc/exports
mv /etc/exports /etc/exports.orig
nano /etc/exports
#Put this in the exports file for nfs Server
/exports/backup IP_SERVER_CLIENTS/Subnet_IP (rw,no_subtree_check)
/exports/documents IP_SERVER_CLIENTS/Subnet_IP (rw,no_subtree_check)
# Restar the services
systemctl restart nfs-kernel-server
# Test Files and server service
cd /exports
nano /backup/text1.txt
nano /documents/text2.txt
# Connect other Client server
apt install nfs-common
showmount
# Get IP of IP_OF_SERVER_NFS
ip addr show
# Back to client
showmount --exports IP_OF_SERVER_NFS
# Create Share directories in Client
mkdir /mnt/nfs
mkdir /mnt/nfs/backup
mkdir /mnt/nfs/documents
# Mount client NFS EXPORT
sudo mount IP_OF_SERVER_NFS:/exports/backup /mnt/nfs/backup
sudo mount IP_OF_SERVER_NFS:/exports/documents /mnt/nfs/documents
cat /mnt/nfs/backup/text1.txt
# Umount client NFS EXPORT
sudo umount /mnt/nfs/backup
sudo umount /mnt/nfs/backup
# Mount NFS in on demand Works better and only with autofs
# Unmount directories and Remove Directories that not have any thing mounted with are mounnted first unmount
sudo rm -r backup documents
# Install autofs
apt install autofs
systemctl status autofs
# Configure
nano /etc/auto.master
# Use this configuration bellow in the final of file ( --ghost make sure the files exist in mount location)
/mnt/nfs/ /etc/auto.nfs --ghost --timeout=60
# Edit next file this is Configuration (rw = read and Writte) serverIP:/loaction_of_server
nano /etc/auto.nfs
backup -fstype=nfs4, rw IP_OF_SERVER_NFS:/exports/backup
documents -fstype=nfs4, rw IP_OF_SERVER_NFS:/exports/documents
# This is First files read by nfs Auto
tail -n 1 /etc/auto.master ( here give where read and conf of consistance)
cat /etc/auto.nfs ( This file configuration where will be mounted)
systemct restart autonfs
ls -l /mnt/nfs/documents ( If liest sub_directories just that will be mounted)
df -h
ls -l /mnt/nfs ( just list base directories and atomaticly mount the server) after 60 seconds
df -h
# Verify what happen
watch "mount | grep nfs"
# Video https://www.youtube.com/watch?v=zmDIfJtCKCk