centos初始化配置工作

centos 配置网卡

  1. 进入网卡文件夹
    cd /etc/sysconfig/network-scripts
    我的网卡信息
  2. 查看网卡名称,我这里网卡名称是 ifcfg-ens33
  3. vim ifcfg-ens33 编辑该网卡
  4. BOOTPROTO=DHCP改为BOOTPROTO=static
  5. ONBOOT=no改为ONBOOT=yes
  6. 增加IP地址IPADDR=192.168.1.80
  7. 增加子网掩码NETMASK=255.255.255.0
  8. 增加网关GATEWAY=192.168.1.1
  9. 增加DNSDNS1=114.114.114.114
  10. 也可再增加一个DNSDNS2=8.8.8.8
  11. 配置如图我的网卡配置

centos 配置yum源

一条命令完成yum源配置
  • cp -r /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup && wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.163.com/.help/CentOS7-Base-163.repo && yum clean all && yum makecache
也可使用以下方式逐步配置yum源
  1. 访问163域名配置yum源
    http://mirrors.163.com/.help/centos.html
  2. 首先备份 /etc/yum.repos.d/CentOS-Base.repo
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
  3. 下载对应版本repo文件, 放入/etc/yum.repos.d/(操作前请做好相应备份)
  4. 运行以下命令生成缓存
    yum clean all
    yum makecache
流程如图:

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_39309714/article/details/85014814