Yum,防火墙,SElinux简单设置

1、当centos最小化安装时,需要自己安装所需要的安装包、需要配置yum源;

1、挂载光盘;
# mount  /dev/sr0  /mnt
# df ----查看光盘是否挂载;
2、创建yum源;
#cd /etc/yum.repos.d/
#rm -rf * ----删除当前目录下的原有的文件,自己重新创建并编写配置文件;
#vim  /etc/yum.repo.d/base.repo
[base]
name=base
baseurl=file:///mnt
gpgcheck=0----不用输入公钥
#yum repolist
#yum makecache----创建元数据缓存;
3、安装autofs包,以后启动光盘将自动挂载到/misc/cd 目录下;
centos7
#yum install autofs 
#systemctl enable autofs----下次开机启动;
#systemctl is-enabled autofs----查看是否生效;
#systemctl start autofs----启动服务;
#cd /misc/cd----查看是否能进入神奇的目录;
centos6
#yum install autofs
#chkconfig autofs on----下次开机启动;
#chkconfig --list----查看是否生效;
#service  autofs  start----开启服务;
#service  autofs status----查看是否生效;
4、将yum源重新配置,更改为/misc/cd目录下;
#cat>/etc/yum.repos.d/ <

2、运行一些服务时需要关闭防火墙,防火墙设置;

1、查看防火墙状态;
centos7
#iptables -nvL----查看防火墙状态;
#systemctl disable firewalld----下次开机关闭防火墙;
#systemctl is-enabled firewalld----查看是否生效;
#systemctl stop firewalld----停止防火墙服务;
#systemctl status firewalld----查看防火墙状态;
centos6
#iptables -nvL----查看防火墙状态;
#chkconfig iptables off----下次开机关闭防火墙;
#chkconfig --list----查看防火墙状态;
#service iptables stop----停止防火墙服务;
#service iptables status----查看防火墙状态;

3、运行一些服务时需更改SElinux配置文件;

1、查看SElinux当前状态;
#getenforce----查看当前状态;
[root@centos6 ~]# cat /etc/selinux/config
# 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=enforcing
# SELINUXTYPE= can take one of these two values:
#     targeted - Targeted processes are protected,
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
2、将SELINUX=enforcing更改为SELINUX=permissive;
#vim /etc/selinux/config
# 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=permissive
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected.
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted
3、# setenforce 0
4、查看当前状态;
# getenforce
#systemctl (enable ,disable)  option
#systemctl is-enabled   option
#chkconfig option (on,off)
#chkconfig  --list

#systemctl (start ,status,restart,stop ) option
#service option  (start,status,restart,stop)

你可能感兴趣的:(Yum,防火墙,SElinux简单设置)