CentOS7初始化操作

deepls / 2023-08-31 / 原文

1 网络配置

使用 nmtui 图形工具配置IP地址和主机名
 2 关闭防火墙
查看
systemctl status firewalld.service

关闭

systemctl stop firewalld.service

禁用

systemctl disable firewalld.service

 3. 关闭SELINUX

临时关闭

setenforce 0  
永久关闭需要修改SELINUX的配置文件  
vi /etc/selinux/config

 

 
将SELINUX=enforcing 改为 SELINUX=disabled
 
4. 更改YUM源
4.1 备份所有 
mkdir /etc/yum.repos.d/bak
mv /etc/yum.repos.d/* /etc/yum.repos.d/bak
4.2 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
 4.3 配置epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
4.4 运行yum makecache生成缓存
yum clean all
yum makecache
yum repolist

 

5. 基本软件工具安装
 
通过配置好的YUM库安装常用软件和工具
yum install -y vim
yum install -y wget
yum install -y lrzsz
最小化安装没有ifconfig命令解决方法
yum search ifconfig
yum install -y net-tools
yum provides ifconfig