Centos7新系统优化

Centos7新系统优化

补全命令优化

yum install bash-completion -y

修改IP地址

vi /etc/sysconfig/network-scripts/ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
UUID=b3ace20d-1dba-4a77-bf30-443746533fd3
DEVICE=eth0
ONBOOT=yes
IPADDR=192.168.43.250
NETMASK=255.255.255.0
GATEWAY=192.168.43.1
DNS1=223.5.5.5
DNS2=114.114.114.114
#PROXY_METHOD=none
#BROWSER_ONLY=no
#PREFIX=24
#IPV6INIT=no

修改yum源

安装wget
[root@localhost yum.repos.d]# yum install wget
Loaded plugins: fastestmirror
Existing lock /var/run/yum.pid: another copy is running as pid 8316.
Another app is currently holding the yum lock; waiting for it to exit…
The other application is: yum
Memory : 24 M RSS (419 MB VSZ)
Started: Sun Jan 9 22:32:59 2022 - 10:37 ago
State : Traced/Stopped, pid: 8316
有以上告警提示解决办法
在这里插入图片描述

首先将CentOS-Base.repo文件备份

yum源文件路径 /etc/yum.repos.d/CentOS-Base.repo
#执行下面命令下载阿里yum源文件更新
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
#执行下面命令下载阿里yum拓展库
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
关闭selinux
#Selinux安全服务进行优化
永久关闭:vim / etc/selinux/config
#     enforcing - SELinux security policy is enforced.(安全策略出于开启状态) 
#     permissive - SELinux prints warnings instead of enforcing.(安全策略处于临时关闭,会有警告)
#     disabled - No SELinux policy is loaded.(安全策略彻底关闭)
SELINUX=disabled(关闭selinux)
#配置文件生效方式(重启设备)
#临时关闭: 
setenforce 0
#查看selinux状态:
getenforce



关闭firewalld防火墙
#firewalld   防火墙(centos6 iptables)
Systemctl stop firewrlld.service  关闭防火墙命令
Systemctl is-active firewalld.service查看状态(inactive 关闭意思   active 开启状态)
#永久关闭防火墙
Systemctl disable  firewalld.service
#开启防火墙
Systemctl enable firewalld.service
#临时关闭防火墙
Systemctl stop firewalld.service
#临时开启防火墙
Systemctl start firewalld.service
#检查防火墙状态
Systemctl status firewalld.serice
Systemctl is-enable firewalld.serivce

#Centos6 关闭
/etc/init.d/iptables stop  关闭防火墙
/etc/init.d/iptables status 检查防火墙号状态
#永久关闭防火墙
Chkconfig iptables off
Chkconfig --list

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值