How to setup NFS Server and Client on CentOS 7

How to setup NFS Server and Client on CentOS 7

Server side:

1. Install NFS Utils.
$ yum -y install nfs-utils

2. Enable and start the NFS service
$ systemctl enable nfs-server.service
$ service nfs-server status

3. Create a directory for the share. You may use existing directory for share.
The directory’s permission is important. If users don’t have any permission on the directory, NFS client also don’t have permission there.
Therefore, you may set the correct permission by “chmod”.

For read and executable,
$ chmod 755 <share path>

For read, write and executable,
$ chmod 777 <share path>

You may also change the ownership of the directory by “chown”.

4. Modify “/etc/exports” to export the share. Be careful of the space. This file is sensitive of space therefore be accurate.

I’m sharing “/uge” directory to internal network “”. Therefore, modified /etc/exports as following.
[root@chanel ~]# cat /etc/exports

no_root_squash option allow the share path(/uge) to be accessibile as root.

5. Run following to apply the changes.
$ exportfs -a


Client side:

1. Install NFS Utils.
$ yum -y install nfs-utils

2. Create a directory to mount the share. I created “/uge” in the client which is same as server’s path.

3. Mount the share of the server as following

$ mount <Server’s IPv4 addr>:<share path> <mount path>
ex) $ mount /uge

You may use hostname instead of server’s IP address.
4. Check if the share is successfully mounted.
$ ls -al <mount path>

5. In order to keep the mount permanently although system reboots, modify “/etc/fstab”.
My /etc/fstab is as following.

[root@lv ~]# cat /etc/fstab

# /etc/fstab
# Created by anaconda on Wed Nov 30 09:46:22 2016
# Accessible filesystems, by reference, are maintained under ‘/dev/disk’
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
/dev/mapper/centos-root / xfs defaults 0 0
UUID=9f994ee2-ebe8-4dc5-8ea5-9002bbc5b353 /boot xfs defaults 0 0
/dev/mapper/centos-swap swap swap defaults 0 0 /uge nfs rw,sync


As you see, the pattern is like this.
<Server’s IPv4 addr>:<share path> <mount path> nfs rw,sync


There are lots of option of the mount. Generally try the rw,sync and modify as you wish.

How to enable core dump in CentOS 7

How to enable core dump in CentOS 7?

1. Set the size of core dump to unlimited.
$ ulimit -s unlimited

Confirm it’s configured by
$ ulimit -a

You must see “core file size” is *unlimited*.

[root@hermes ~]# ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0

This setting will be gone as session changes. Add the “ulimit -c unlimited” to the /etc/profile in order to survive from session changes.

2. Plan where to store the core dump. I recommend “/var/crash” path.
Allow *write permission* to the the core dump path.
$ chmod 777 <core dump path>

Lots of programs run by other user, which may use setuid. The user MUST have the write permission to the path for core dump.

3. Configure core dump pattern by the path planned at previous step.
By root user, run following
$ echo /var/crash/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern

In order to keep this for system reboot, add “kernel.core_pattern=/var/crash/core-%e-%s-%u-%g-%p-%t” to the /etc/sysctl.conf

How to set the Time/Date and Timezone

How to set the time in CentOS?

How to change the time in CentOS?

How to modify the date and time in CentOS?


1. Remove current time

$ rm /etc/localtime

2. Set new time zone. As I’m located in Seoul, I set “Asia/Seoul”. You can pick any time zone among the list from zoneinfo. Check the list by “ls -al /usr/share/zoneinfo/”.

$ ln -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime

3. Set the current time. The format is MMDDHHMMYYYY.

The “date 072815002017” means setting current time as 15:00, July 28th, 2017/


4. Sync the hwclock with the current time and date

$ hwclock –systohc

How to modify/Disable SELinux mode

This is regarding to how to modify/disable SELinux in CentOS 7

Running “setenforce 0” in prompt will disable SELinux temporarilly. This doesn’t survive from system-reboot.

In order to make changes permanently, do following.

-Modify “SELINUX” in /etc/selinux/config

Three different modes of SELINUX. Choose anything you wish. To disable SELinux, simply modify it as “disabled”.

forcing: The default mode which will enable and enforce the SELinux security policy on the system, denying access and logging actions

Permissive: In Permissive mode, SELinux is enabled but will not enforce the security policy, only warn and log actions. Permissive mode is useful for troubleshooting SELinux issues

Disabled: SELinux is turned off