Linux学习-防火墙-Selinux-配置本地YUM源

关闭防火墙并设置开机不启动

systemctl status firewalld.service #查看firewalld状态
systemctl stop firewalld #关闭
systemctl start firewalld #开启
systemctl disable firewalld #开机自动关闭 //RHLE7
chkconfig --list|grep network #查看开机是否启动 //RHLE6
systemctl enable firewalld #开机自动启动

临时和永久关闭Selinux

安全增强型 Linux(Security-Enhanced Linux)简称 SELinux,它是一个 Linux 内核模块,也是 Linux 的一个安全子系统。

SELinux 主要由美国国家安全局开发。2.6 及以上版本的 Linux 内核都已经集成了 SELinux 模块。

SELinux 的结构及配置非常复杂,而且有大量概念性的东西,要学精难度较大。很多 Linux 系统管理员嫌麻烦都把 SELinux 关闭了。

如果可以熟练掌握 SELinux 并正确运用,我觉得整个系统基本上可以到达"坚不可摧"的地步了(请永远记住没有绝对的安全)。

掌握 SELinux 的基本概念以及简单的配置方法是每个 Linux 系统管理员的必修课。

https://blog.csdn.net/yanjun821126/article/details/80828908

SELinux 有三种工作模式,分别是:

1. enforcing:强制模式。违反 SELinux 规则的行为将被阻止并记录到日志中。

2. permissive:宽容模式。违反 SELinux 规则的行为只会记录到日志中。一般为调试用。

3. disabled:关闭 SELinux。

临时关闭

命令:getenforce    查看状态

命令:setenforce  0  临时关闭

永久关闭

vim /etc/selinux/config

改:7 SELINUX=enforcing     #前面的7,表示文档中第7行。方便你查找

为:7 SELINUX=disabled

需要重启   reboot 生效

配置本地YUM源

http://blog.sina.com.cn/s/blog_626142db0102yzj7.html

https://www.mainblog.cn/167.html

1、配置网络源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache

2、或者配置一个镜像源

必须设置设置系统光盘开机自动挂载

[root@xuegod63 ~]# vim  /etc/fstab  #在文档最后,添加以一下红色内容:
/dev/cdrom                   /mnt              iso9660 defaults        0 0
[root@xuegod63 ~]# mount -a
mount: /dev/sr0 写保护,将以只读方式挂载
[root@xuegod63 ~]# ls /mnt/   #可以查看到此目录下有内容,说明挂载成功
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
yum的一切配置信息都储存在一个叫yum.repos.d的配置文件中,通常位于/etc/yum.repos.d目录下
删除原有的文件
[root@xuegod63 yum.repos.d]#rm -rf  /etc/yum.repos.d/*
创建一个新的yum源配置文件,yum源配置文件的结尾必须是.repo
[root@xuegod63 yum.repos.d]# vim  CentOS7.repo  #写入以下红色内容
[CentOS7]   
name=CentOS-server     
baseurl=file:///mnt  
enabled=1  
gpgcheck=0
参数说明:
[CentOS7]        --->yum的ID,必须唯一 
name=CentOS-server     ----->描述信息
baseurl=file:///mnt    -------> /mnt表示的是光盘的挂载点  . file:后面有3个///
enabled=1   ------>启用
gpgcheck=0   ---->取消验证

清空并生成缓存列表
[root@localhost ~]# yum clean all                #清空yum缓存
[root@localhost ~]# yum list                        #生成缓存列表
验证一下
[root@xuegod63 yum.repos.d]# yum -y install httpd
原文地址:https://www.cnblogs.com/wudequn/p/11371282.html