
Introduction
Security-Enhanced Linux (SELinux) is an enhanced security mechanism at the kernel level. Follow this guide to reinstall SELinux and reset the policy to default settings. If SELinux is not already installed, go directly to step 2.
Perform these steps as a sudo-enabled user, or root. This guide has been tested on:
- CentOS 8
- CentOS 7
- CentOS 6
1. Disable and Remove SELinux
# setenforce 0
# yum remove selinux-policy\*
# rm -rf /etc/selinux/targeted /etc/selinux/config
2. Install SELinux
# yum install selinux-policy-targeted
# yum install selinux-policy-devel policycoreutils
# touch /.autorelabel; reboot
SELinux will detect the /.autorelabel file on reboot, and then relabel all files with the correct SELinux contexts. If you have many files, the instance may be unavailable for a long time. You can monitor the instance from the Vultr Web console.
Related Documentation
Related Content
How to Disable SELinux on CentOS
November 21, 2023
Article
How to Disable SELinux on Rocky Linux 9
April 4, 2025
Article
How to Install Paste 2.1 on a CentOS 7 LAMP VPS
November 21, 2023
Article
How to Install CMS Made Simple 2.2 on a CentOS 7 LAMP VPS
November 21, 2023
Article
No comments yet.