Senin, 23 September 2019

How to install NFS Server on Linux Centos 7

  Tidak ada komentar
Install nfs-utils
[root@localhost ~]# yum install nfs-utils
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.axarva.id
 * extras: mirror.axarva.id
 * updates: mirror.axarva.id
base                                                                                                           | 3.6 kB  00:00:00
extras                                                                                                         | 2.9 kB  00:00:00
updates                                                                                                        | 2.9 kB  00:00:00
Resolving Dependencies
--> Running transaction check
---> Package nfs-utils.x86_64 1:1.3.0-0.65.el7 will be installed
--> Processing Dependency: libtirpc >= 0.2.4-0.7 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: gssproxy >= 0.7.0-3 for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: rpcbind for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: quota for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libnfsidmap for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libevent for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: keyutils for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libtirpc.so.1()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libnfsidmap.so.0()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Processing Dependency: libevent-2.0.so.5()(64bit) for package: 1:nfs-utils-1.3.0-0.65.el7.x86_64
--> Running transaction check
---> Package gssproxy.x86_64 0:0.7.0-26.el7 will be installed
--> Processing Dependency: libini_config >= 1.3.1-31 for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libverto-module-base for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libref_array.so.1(REF_ARRAY_0.1.1)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.2.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3(INI_CONFIG_1.1.0)(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libref_array.so.1()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libini_config.so.3()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libcollection.so.2()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
--> Processing Dependency: libbasicobjects.so.0()(64bit) for package: gssproxy-0.7.0-26.el7.x86_64
---> Package keyutils.x86_64 0:1.5.8-3.el7 will be installed
---> Package libevent.x86_64 0:2.0.21-4.el7 will be installed
---> Package libnfsidmap.x86_64 0:0.25-19.el7 will be installed
---> Package libtirpc.x86_64 0:0.2.4-0.16.el7 will be installed
---> Package quota.x86_64 1:4.01-19.el7 will be installed
--> Processing Dependency: quota-nls = 1:4.01-19.el7 for package: 1:quota-4.01-19.el7.x86_64
--> Processing Dependency: tcp_wrappers for package: 1:quota-4.01-19.el7.x86_64
---> Package rpcbind.x86_64 0:0.2.0-48.el7 will be installed
--> Running transaction check
---> Package libbasicobjects.x86_64 0:0.1.1-32.el7 will be installed
---> Package libcollection.x86_64 0:0.7.0-32.el7 will be installed
---> Package libini_config.x86_64 0:1.3.1-32.el7 will be installed
--> Processing Dependency: libpath_utils.so.1(PATH_UTILS_0.2.1)(64bit) for package: libini_config-1.3.1-32.el7.x86_64
--> Processing Dependency: libpath_utils.so.1()(64bit) for package: libini_config-1.3.1-32.el7.x86_64
---> Package libref_array.x86_64 0:0.1.5-32.el7 will be installed
---> Package libverto-libevent.x86_64 0:0.2.5-4.el7 will be installed
---> Package quota-nls.noarch 1:4.01-19.el7 will be installed
---> Package tcp_wrappers.x86_64 0:7.6-77.el7 will be installed
--> Running transaction check
---> Package libpath_utils.x86_64 0:0.2.1-32.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

======================================================================================================================================
 Package                               Arch                       Version                              Repository                Size
======================================================================================================================================
Installing:
 nfs-utils                             x86_64                     1:1.3.0-0.65.el7                     base                     412 k
Installing for dependencies:
 gssproxy                              x86_64                     0.7.0-26.el7                         base                     110 k
 keyutils                              x86_64                     1.5.8-3.el7                          base                      54 k
 libbasicobjects                       x86_64                     0.1.1-32.el7                         base                      26 k
 libcollection                         x86_64                     0.7.0-32.el7                         base                      42 k
 libevent                              x86_64                     2.0.21-4.el7                         base                     214 k
 libini_config                         x86_64                     1.3.1-32.el7                         base                      64 k
 libnfsidmap                           x86_64                     0.25-19.el7                          base                      50 k
 libpath_utils                         x86_64                     0.2.1-32.el7                         base                      28 k
 libref_array                          x86_64                     0.1.5-32.el7                         base                      27 k
 libtirpc                              x86_64                     0.2.4-0.16.el7                       base                      89 k
 libverto-libevent                     x86_64                     0.2.5-4.el7                          base                     8.9 k
 quota                                 x86_64                     1:4.01-19.el7                        base                     179 k
 quota-nls                             noarch                     1:4.01-19.el7                        base                      90 k
 rpcbind                               x86_64                     0.2.0-48.el7                         base                      60 k
 tcp_wrappers                          x86_64                     7.6-77.el7                           base                      78 k

Transaction Summary
======================================================================================================================================
Install  1 Package (+15 Dependent packages)

Total download size: 1.5 M
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/16): gssproxy-0.7.0-26.el7.x86_64.rpm                                                                       | 110 kB  00:00:00
(2/16): libbasicobjects-0.1.1-32.el7.x86_64.rpm                                                                |  26 kB  00:00:00
(3/16): libcollection-0.7.0-32.el7.x86_64.rpm                                                                  |  42 kB  00:00:00
(4/16): keyutils-1.5.8-3.el7.x86_64.rpm                                                                        |  54 kB  00:00:00
(5/16): libini_config-1.3.1-32.el7.x86_64.rpm                                                                  |  64 kB  00:00:00
(6/16): libevent-2.0.21-4.el7.x86_64.rpm                                                                       | 214 kB  00:00:00
(7/16): libpath_utils-0.2.1-32.el7.x86_64.rpm                                                                  |  28 kB  00:00:00
(8/16): libnfsidmap-0.25-19.el7.x86_64.rpm                                                                     |  50 kB  00:00:00
(9/16): libverto-libevent-0.2.5-4.el7.x86_64.rpm                                                               | 8.9 kB  00:00:00
(10/16): libref_array-0.1.5-32.el7.x86_64.rpm                                                                  |  27 kB  00:00:00
(11/16): libtirpc-0.2.4-0.16.el7.x86_64.rpm                                                                    |  89 kB  00:00:00
(12/16): quota-4.01-19.el7.x86_64.rpm                                                                          | 179 kB  00:00:00
(13/16): nfs-utils-1.3.0-0.65.el7.x86_64.rpm                                                                   | 412 kB  00:00:00
(14/16): rpcbind-0.2.0-48.el7.x86_64.rpm                                                                       |  60 kB  00:00:00
(15/16): tcp_wrappers-7.6-77.el7.x86_64.rpm                                                                    |  78 kB  00:00:00
(16/16): quota-nls-4.01-19.el7.noarch.rpm                                                                      |  90 kB  00:00:00
--------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                 2.2 MB/s | 1.5 MB  00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libbasicobjects-0.1.1-32.el7.x86_64                                                                               1/16
  Installing : libref_array-0.1.5-32.el7.x86_64                                                                                  2/16
  Installing : libcollection-0.7.0-32.el7.x86_64                                                                                 3/16
  Installing : libevent-2.0.21-4.el7.x86_64                                                                                      4/16
  Installing : libtirpc-0.2.4-0.16.el7.x86_64                                                                                    5/16
  Installing : rpcbind-0.2.0-48.el7.x86_64                                                                                       6/16
  Installing : libverto-libevent-0.2.5-4.el7.x86_64                                                                              7/16
  Installing : 1:quota-nls-4.01-19.el7.noarch                                                                                    8/16
  Installing : tcp_wrappers-7.6-77.el7.x86_64                                                                                    9/16
  Installing : 1:quota-4.01-19.el7.x86_64                                                                                       10/16
  Installing : keyutils-1.5.8-3.el7.x86_64                                                                                      11/16
  Installing : libnfsidmap-0.25-19.el7.x86_64                                                                                   12/16
  Installing : libpath_utils-0.2.1-32.el7.x86_64                                                                                13/16
  Installing : libini_config-1.3.1-32.el7.x86_64                                                                                14/16
  Installing : gssproxy-0.7.0-26.el7.x86_64                                                                                     15/16
  Installing : 1:nfs-utils-1.3.0-0.65.el7.x86_64                                                                                16/16
  Verifying  : libtirpc-0.2.4-0.16.el7.x86_64                                                                                    1/16
  Verifying  : libverto-libevent-0.2.5-4.el7.x86_64                                                                              2/16
  Verifying  : 1:quota-4.01-19.el7.x86_64                                                                                        3/16
  Verifying  : gssproxy-0.7.0-26.el7.x86_64                                                                                      4/16
  Verifying  : libpath_utils-0.2.1-32.el7.x86_64                                                                                 5/16
  Verifying  : libnfsidmap-0.25-19.el7.x86_64                                                                                    6/16
  Verifying  : libevent-2.0.21-4.el7.x86_64                                                                                      7/16
  Verifying  : keyutils-1.5.8-3.el7.x86_64                                                                                       8/16
  Verifying  : 1:nfs-utils-1.3.0-0.65.el7.x86_64                                                                                 9/16
  Verifying  : tcp_wrappers-7.6-77.el7.x86_64                                                                                   10/16
  Verifying  : libcollection-0.7.0-32.el7.x86_64                                                                                11/16
  Verifying  : libref_array-0.1.5-32.el7.x86_64                                                                                 12/16
  Verifying  : libbasicobjects-0.1.1-32.el7.x86_64                                                                              13/16
  Verifying  : rpcbind-0.2.0-48.el7.x86_64                                                                                      14/16
  Verifying  : libini_config-1.3.1-32.el7.x86_64                                                                                15/16
  Verifying  : 1:quota-nls-4.01-19.el7.noarch                                                                                   16/16

Installed:
  nfs-utils.x86_64 1:1.3.0-0.65.el7

Dependency Installed:
  gssproxy.x86_64 0:0.7.0-26.el7            keyutils.x86_64 0:1.5.8-3.el7                libbasicobjects.x86_64 0:0.1.1-32.el7
  libcollection.x86_64 0:0.7.0-32.el7       libevent.x86_64 0:2.0.21-4.el7               libini_config.x86_64 0:1.3.1-32.el7
  libnfsidmap.x86_64 0:0.25-19.el7          libpath_utils.x86_64 0:0.2.1-32.el7          libref_array.x86_64 0:0.1.5-32.el7
  libtirpc.x86_64 0:0.2.4-0.16.el7          libverto-libevent.x86_64 0:0.2.5-4.el7       quota.x86_64 1:4.01-19.el7
  quota-nls.noarch 1:4.01-19.el7            rpcbind.x86_64 0:0.2.0-48.el7                tcp_wrappers.x86_64 0:7.6-77.el7

Complete!
[root@localhost ~]#

Make directory and mount the nfs server
[root@localhost var]$ sudo mkdir nfsserver
[root@localhost var]$
[root@localhost var]$ ls
adm    crash  empty  gopher    lib    lock  mail       nis  preserve  spool  yp
cache  db     games  kerberos  local  log   nfsserver  opt  run       tmp
[root@localhost var]$
Change own and mod of directory
[root@localhost ~]# chown nfsnobody:nfsnobody /var/nfsserver
[root@localhost ~]# chmod 755 /var/nfsserver
[root@localhost ~]#
Enable some nfs-server and dependency
[root@localhost ~]# systemctl enable rpcbind
[root@localhost ~]# systemctl enable rpcbind
[root@localhost ~]# systemctl enable nfs-server
Created symlink from /etc/systemd/system/multi-user.target.wants/nfs-server.service to /usr/lib/systemd/system/nfs-server.service.
[root@localhost ~]# systemctl enable nfs-lock
[root@localhost ~]# systemctl enable nfs-idmap
[root@localhost ~]# systemctl start nfs-lock
[root@localhost ~]# systemctl start nfs-idmap

Start the nfs server and rpc bind

[root@localhost log]# systemctl start rpcbind nfs-server
[root@localhost log]# systemctl status rpcbind nfs-server
● rpcbind.service - RPC bind service
   Loaded: loaded (/usr/lib/systemd/system/rpcbind.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-09-21 01:19:16 WIB; 43min ago
  Process: 19906 ExecStart=/sbin/rpcbind -w $RPCBIND_ARGS (code=exited, status=0/SUCCESS)
 Main PID: 19907 (rpcbind)
   CGroup: /system.slice/rpcbind.service
           └─19907 /sbin/rpcbind -w

Sep 21 01:19:16 localhost.localdomain systemd[1]: Starting RPC bind service...
Sep 21 01:19:16 localhost.localdomain systemd[1]: Started RPC bind service.

● nfs-server.service - NFS server and services
   Loaded: loaded (/usr/lib/systemd/system/nfs-server.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sat 2019-09-21 02:01:30 WIB; 1min 33s ago
  Process: 20228 ExecStopPost=/usr/sbin/exportfs -f (code=exited, status=0/SUCCESS)
  Process: 20224 ExecStopPost=/usr/sbin/exportfs -au (code=exited, status=0/SUCCESS)
  Process: 20222 ExecStop=/usr/sbin/rpc.nfsd 0 (code=exited, status=0/SUCCESS)
  Process: 20258 ExecStartPost=/bin/sh -c if systemctl -q is-active gssproxy; then systemctl reload gssproxy ; fi (code=exited, status=0/SUCCESS)
  Process: 20241 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/SUCCESS)
  Process: 20239 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS)
 Main PID: 20241 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/nfs-server.service

Sep 21 02:01:30 localhost.localdomain systemd[1]: Starting NFS server and services...
Sep 21 02:01:30 localhost.localdomain systemd[1]: Started NFS server and services.
[root@localhost log]#

To make it permanent add the nfs to fstab config
Setting the firewall, allow some apps
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=nfs
success
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=mountd
success
[root@localhost ~]# firewall-cmd --permanent --zone=public --add-service=rpc-bind
success
[root@localhost ~]# firewall-cmd --reload
success
[root@localhost ~]#
Running exportfs command to looking for error
[root@localhost log]# exportfs -r

Tidak ada komentar :

Posting Komentar