TH C Hành Bu I 5:install NFS & SAMBA
TH C Hành Bu I 5:install NFS & SAMBA
NFS
Install NFS server:
[root@dlp ~]# yum -y install nfs-utils
[root@dlp ~]# vi /etc/idmapd.conf
# line 5: uncomment and change to your domain name
Domain = vanhoa.org
[root@dlp ~]# vi /etc/exports
# write like below
/home 192.168.11.0/24(rw,sync,no_root_squash,no_all_squash)
#/home shared directory
#192.168.11.0/24 range of networks NFS permits accesses
#rw writable
#sync synchronize
#no_root_squash enable root privilege
#no_all_squash enable users' authority
[root@dlp ~]# systemctl start rpcbind.service
[root@dlp ~]# systemctl start nfs-server.service
[root@dlp ~]# systemctl start nfs-lock.service
[root@dlp ~]# systemctl start nfs-idmap.service
Configure Iptables Firewall for NFS
First edit the /etc/sysconfig/nfs file and uncomment these directives. You can
customize the ports if you wish but I will stick with the defaults:
# vi /etc/sysconfig/nfs
RQUOTAD_PORT=875
LOCKD_TCPPORT=32803
LOCKD_UDPPORT=32769
MOUNTD_PORT=892
STATD_PORT=662
STATD_OUTGOING_PORT=2020
We now need to modify the iptables firewall configuration to allow access to the NFS
ports. I will use the iptables command and insert the appropriate rules:
# iptables -I INPUT -m multiport -p tcp --dport 111,662,875,892,2049,32803 -j ACCEPT
# iptables -I INPUT -m multiport -p udp --dport 111,662,875,892,2049,32769 -j
ACCEPT
Now save the iptables configuration to the config file so it will apply when the system is
restarted:
# service iptables save
Configure SELinux for NFS Export
Rather than disable SELinux it is a good idea to configure it to allow remote clients to
access files that are exported via NFS share. This is fairly simple and involves setting the
SELinux boolean value using the setsebool utility. In this example well use the
read/write boolean but we can also use nfs_export_all_ro to allow NFS exports readonly and use_nfs_home_dirs to allow home directories to be exported.
# setsebool -P nfs_export_all_rw 1
service
service
rpcbind
nfs
start
start
SAMBA
Install Server:
[root@localhost ~]# systemctl stop firewalld.service
[ 708.149082] Ebtables v2.0 unregistered
[root@localhost ~]# systemctl disable firewalld.service
rm '/etc/systemd/system/basic.target.wants/firewalld.service'
rm '/etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service'
[root@localhost ~]# vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# change
path = /home/security
writable = yes
create mode = 0770
directory mode = 0770
share modes = yes
guest ok = no
# set password
# confirm
[1]
Install Client:
Configure on Windows client. This example is on Windows 7. Select [My Computer] - [Map
Network Drive] like following example.
Specify shared folder's place in Folder section like example and Click 'Finish' button to enter.