CentOS7 问题及解决办法

本文详细介绍了如何在 CentOS 7 系统中配置网卡、设置静态IP,启用阿里云 yum 源,并创建本地 yum 仓库,包括迁移原有库、清理缓存和启动服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.配置网卡、可联网模式

[root@centos7 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 
TYPE="Ethernet"
BOOTPROTO="none"
NAME="eth0"
UUID="e4a787e2-4ca6-4514-ae61-5fa6dc438812"
DEVICE="eth0"
ONBOOT="yes"
IPADDR=192.168.37.7
PREFIX=24
#DNS
DNS1=114.114.114.114
#网关
GATEWAY=192.168.37.2

#重启网络服务
[root@centos7 ~]# systemctl restart network
#ping 百度通了
[root@centos7 ~]# ping baidu.com -c 2
PING baidu.com (220.181.38.251) 56(84) bytes of data.
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=1 ttl=128 time=7.24 ms
64 bytes from 220.181.38.251 (220.181.38.251): icmp_seq=2 ttl=128 time=7.28 ms

--- baidu.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1009ms
rtt min/avg/max/mdev = 7.247/7.265/7.283/0.018 ms

2.配置网络yum源

1.把原来的库移动到备份文件夹
2.阿里云进行下载:https://developer.aliyun.com/mirror/
#base源
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
#epel源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

在这里插入图片描述

#清理本地缓存
[root@centos7 yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: base epel extras updates
Cleaning up list of fastest mirrors
#显示仓库列表
[root@centos7 yum.repos.d]# yum repolist

3.本地yum源

yum install autofs -y
systemctl start autofs
systemctl enable autofs

vim /etc/yum.repos.d/base.repo
[base]
name=base
baseurl=file:///misc/cd
gpgcheck=0
 

https://blog.youkuaiyun.com/lamp_yang_3533/article/details/62222215

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值