Ubuntu20安装SELinux

移除AppArmor

1.使用systemctl停止Apparmor服务。
sudo systemctl stop apparmor
2.从系统中清除AppArmor
sudo apt purge apparmor

3.更新系统
sudo apt update && sudo apt upgrade -yuf
3.1可能会遇到Hash Sum mismatch问题。

3.2解决方法如下:
sudo su -
mkdir /etc/gcrypt
echo all >> /etc/gcrypt/hwf.deny
apt-get update

4.安装SELinux及相关包
sudo apt install policycoreutils selinux-utils selinux-basics

5.查看SELinux安装情况
sudo selinux-activate

如果出现如上内容,则安装成功。
6.将SELinux置于enforcing状态
sudo selinux-config-enforcing

7.重启系统,SELinux将给系统资源加标签。会花费一定时间。图为Ubuntu20.04重启时配置安全标签过程

参考链接:
1.https://stackoverflow.com/questions/64120030/hash-sum-mismatch-when-apt-get-update-ubuntu-20-04-vm-with-multipass
2.https://www.techrepublic.com/article/how-to-install-selinux-on-ubuntu-server-20-04/
3.https://www.linode.com/docs/guides/how-to-install-selinux-on-ubuntu-18-04/
.https://linuxconfig.org/how-to-disable-enable-selinux-on-ubuntu-20-04-focal-fossa-linux

posted @ 2022-02-13 12:00  大大大大大圣归来  阅读(2821)  评论(0编辑  收藏  举报