给centos重新安装yum的base-repo源
来源:互联网 发布:网页写入js 编辑:程序博客网 时间:2024/05/22 00:37
如果自己的centos的系统yum源出现问题了,如何才能修复?
方式一:使用国内的阿里云镜像
(1)把/etc/yum.repos.d/下面所有的源给删除掉了
(2)下载镜像
# CentOS 5wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo# CentOS 6wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo# CentOS 7wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
注意如果没有安装wget,可以从下面的网址中先手动下载,然后上传到linux上安装:http://www.rpmfind.net/linux/rpm2html/search.php?query=wget
(3)执行命令,重新生成cache
yum clean allyum makecache
方式二:使用官网的镜像
(1)把/etc/yum.repos.d/下面所有的源给删除掉了
(2)执行下面的命令,重新生成镜像
//执行这个命令之后rpm -Uvh --force http://mirror.centos.org/centos-7/7/os/x86_64/Packages/centos-release-7-4.1708.el7.centos.x86_64.rpm
(3)查看/etc/yum.repos.d/下面目录,就会发现镜像已经安装完毕:
-rw-r--r--. 1 root root 1664 8月 30 23:53 CentOS-Base.repo-rw-r--r--. 1 root root 1309 8月 30 23:53 CentOS-CR.repo-rw-r--r--. 1 root root 649 8月 30 23:53 CentOS-Debuginfo.repo-rw-r--r--. 1 root root 314 8月 30 23:53 CentOS-fasttrack.repo-rw-r--r--. 1 root root 630 8月 30 23:53 CentOS-Media.repo-rw-r--r--. 1 root root 1331 8月 30 23:53 CentOS-Sources.repo-rw-r--r--. 1 root root 3830 8月 30 23:53 CentOS-Vault.repo
(4)生成缓存
yum clean allyum makecache
必要时可以执行yum update更新当前系统的安装包为新的
手动下载命令,例子:
#安装vim组件yum install -y vim#卸载vim组件yum remove vim
注意第二种例子,如果不能访问国外的官网,或者访问比较慢超时了,就会导致安装失败,这时候可以使用第一种方式进行安装。
阅读全文
0 0
- 给centos重新安装yum的base-repo源
- CenOS中yum可用的一个配置CentOS-Base.repo
- /etc/yum.repos.d/CentOS-Base.repo
- CentOS-Base.repo
- CentOS-Base.repo
- CentOS-Base.repo
- CentOS-Base.repo
- CentOS下重新安装yum的方法分享
- CentOS下重新安装yum的方法
- centos yum的配置文件 repo文件详解
- centos yum的配置文件 repo文件详解
- CentOS 5 yum国内镜像服务器 配置文件[CentOS-Base.repo]
- 腾讯云 CentOS-Base.repo
- YUM源的.repo文件
- CentOs :yum apt-get cannot find a valid baseurl for repo: base curl:unknown host
- centos重新安装,卸载python yum
- rpmforge yum repo for CentOS
- yum的卸载与重新安装
- MarkDown语法
- java中判断数组中元素出现的次数
- Salesforce中Public Group/Queue的比较
- 【观察】金山云全面降价释放新信号,中国公有云头部格局已确立
- 蓝桥杯-十六进制转十进制
- 给centos重新安装yum的base-repo源
- DrawerLayout 的使用 (侧拉框demo)
- Oracle 导入数据库dmp文件的几种方式
- Redis常用命令
- 绘制引力波
- VS2015 QT工程中无法打开包括文件: “QDialog”: No such file or directory问题
- Windows Hook Api
- python 基础(一)基本语法
- leetcode 514. Freedom Trail 自由之路 + 动态规划DP解决