Disable SELinux
Let's see the current status of SELinux.
[root@web ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 31
For disabling SELinux, you can do either way of the followings.
Method 1: Disable SELinux Temporarily
Just set current mode as Permissive.
[root@web ~]# setenforce 0
[root@web ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: permissive
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 31
Method 2: Disable SELinux Permanently
Disable SELinux by editing /etc/selinux/config.
[root@web ~]# vi /etc/selinux/config
...
#SELINUX=enforcing
SELINUX=disabled
...
Then reboot the system.
[root@web ~]# init 6
Then we check the status of SELinux.
[root@web ~]# sestatus
SELinux status: disabled
We did it.