关于我们

质量为本、客户为根、勇于拼搏、务实创新

< 返回

CenterOS 7配置手册

发布时间:2021-09-19 19:15:57

     DNS配置

vi /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4



vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0  #指出设备名称  
NM_CONTROLLED=yes  #network mamager的参数,实时生效,不需要重启  
ONBOOT=yes  #设置为yes,开机自动启用网络连接  
IPADDR=192.168.21.129  #IP地址  
BOOTPROTO=none  #设置为none禁止DHCP,设置为static启用静态IP地址,设置为dhcp开启DHCP服务  
NETMASK=255.255.255.0  #子网掩码  
DNS1=8.8.8.8  #第一个dns服务器  
TYPE=Ethernet  #网络类型为:Ethernet  
GATEWAY=192.168.21.2  #设置网关  
DNS2=8.8.4.4  #第二个dns服务器  
IPV6INIT=no  #禁止IPV6  
USERCTL=no  #是否允许非root用户控制该设备,设置为no,只能用root用户更改  
HWADDR=00:0C:29:2C:E1:0F  #网卡的Mac地址  
PREFIX=24  
DEFROUTE=yes  
IPV4_FAILURE_FATAL=yes  
NAME="System eth0"  #定义设备名称



配置阿里yun源


备份:将 CentOS-Base.repo 备份为 CentOS-Base.repo.backup
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载阿里云新的http://mirrors.aliyun.com/repo/Centos-7.repo,并命名为CentOS-Base.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
或者
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

清除缓存
yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存
yum update        #升级系统
epel源 安装和配置


查看可用的epel源
[root@localhost yum.repos.d]$ yum list | grep epel-release
epel-release.noarch     7-11    extras   
[root@localhost yum.repos.d]$
安装 epel
[root@localhost yum.repos.d]$ yum install -y epel-release
......省略.....
配置阿里镜像提供的epel源
wget -O /etc/yum.repos.d/epel-7.repo  http://mirrors.aliyun.com/repo/epel-7.repo
清除缓存
yum clean all     # 清除系统所有的yum缓存
yum makecache     # 生成yum缓存
yum update        # 升级系统


查看yum源


查看所有的yum源:
yum repolist all

查看可用的yum源:
yum repolist enabled


来源:萌卜兔's Blog  作者:兔子


/template/Home/DawnSP0723/PC/Static

立即注册优维数据账号,免费体验多款产品

立即注册