How to disable selinux on your Asterisk system
SELinux (Security-Enhanced Linux ) is a Linux kernel security module that allows administrators and users more control over access controls. It allows access based on SELinux policy rules.
SELinux is a great module, but sadly it doesn't work well with Asterisk. SELinux stops certain modules within Asterisk from running. This is why you always need to disable SELinux before you start installing Asterisk.
In today's blog post we are going to show you how you can disable the SELinux module on your centos 7 system.
To view the current SELinux status and the SELinux policy that is being used on your system, use the sestatus command:
output 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 Max kernel policy version: 31
You can see from the output above that SELinux is enabled and set to enforcing mode.
Temporary disabling SELinux
You can temporarily change the SELinux mode from targeted to permissive with the following command
$ sudo setenforce 0
This is however only valid for the current runtime session only.
Permanently disabling SELinux
To permanently disable SELinux on your CentOS 7 system, follow the steps below:
Open the SELinux config file
Make sure that you have installed the vim package on your Centos 7 system (yum install vim)
Set the SELinux mod to disabled
# 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 - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted
Now save the file and reboot the system.
$ sudo shutdown -r now
Once the system has been rebooted you can check the SELinux status again with the following command.
output SELinux status: disabled
SELinux has now been disabled and you can install Asterisk 18 without any problems on your Centos 7 system.