1、备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

2、下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

CentOS 6

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

或者

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo

CentOS 7

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

3、之后运行yum makecache生成缓存

4、查看 linux 系统版本

[root@ca8a2d15ee41 yum.repos.d]# cat /etc/redhat-release 

CentOS Linux release 7.4. (Core) 

5、yum 相关的命令

1)、安装命令

yum install -y package-name (-y 表示安装过程中的选项都选择 y,就是yes)

2)、查找提供安装包的名字

yum provides packagename

[root@ca8a2d15ee41 yum.repos.d]# yum provides ifconfig
Loaded plugins: fastestmirror, ovl
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools
Repo : base
Matched from:
Filename : /sbin/ifconfig net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /sbin/ifconfig net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools
Repo : @base
Matched from:
Filename : /usr/sbin/ifconfig

然后选择一个安装即可,比如 yum install -y net-tools-2.0-0.22.20131004git.el7.x86_64

Centos yum 修改为阿里源以及常用的命令的更多相关文章

  1. yum 找不到程序,yum更换国内阿里源

    使用百度云服务器,发现百度yum源非常不稳定,果断采用阿里源,操作步骤如下: 一.备份 $ cd /etc/yum.repos.d/ $ mv baidu-bcm.repo baidu-bcm.rep ...

  2. ubuntu/centos/mac/windows 使用阿里源加速docker镜像下载

    官方下载docker比较慢,阿里提供云容器hub, 1.打开阿里容器hub https://dev.aliyun.com/search.html 该页面右上方有一个管理中心,点击进去 2.选择镜像加速 ...

  3. centos下修改文件后如何保存退出

    centos下修改文件后如何保存退出 保存命令 按ESC键 跳到命令模式,然后: :w 保存文件但不退出vi :w file 将修改另外保存到file中,不退出vi :w! 强制保存,不推出vi :w ...

  4. Centos 7 修改yum源为阿里源

    因为官方的yum源在国内访问效果不佳, 需要改为国内比较好的阿里云或者网易的yum源, 具体修改步骤如下: cd /etc/yum.repos.d # 备份旧的配置文件 mv CentOS-Base. ...

  5. 将centos的yum源修改为阿里云的yum源

    CentOS系统更换软件安装源 第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentO ...

  6. 在centos中修改yum源为阿里源

    cd /etc/yum.repos.d 备份旧的配置文件:mv CentOS-Base.repo CentOS-Base.repo.bak 下载阿里源的文件: wget -O CentOS-Base. ...

  7. centos yum换阿里云源

    阿里云Linux安装软件镜像源 阿里云是最近新出的一个镜像源.得益与阿里云的高速发展,这么大的需求,肯定会推出自己的镜像源. 阿里云Linux安装镜像源地址:http://mirrors.aliyun ...

  8. [转]centos7 修改yum源为阿里源

    centos7 修改yum源为阿里源,某下网络下速度比较快 首先是到yum源设置文件夹里 cd /etc/yum.repos.d 接着备份旧的配置文件 sudo mv CentOS-Base.repo ...

  9. centos7 修改yum源为阿里源

    centos7 修改yum源为阿里源,某下网络下速度比较快 首先是到yum源设置文件夹里 安装base reop源 cd /etc/yum.repos.d 接着备份旧的配置文件 sudo mv Cen ...

随机推荐

  1. node和npm的安装和镜像源的修改

    在node官网下载https://nodejs.org/en/ 直接下载msi的文件,需要配置环境变量 我的电脑-->属性-->高级系统配置-->环境变量-->用户变量,在用户 ...

  2. centOS7安装kafka和zookeeper

    wget http://mirrors.hust.edu.cn/apache/kafka/2.0.0/kafka_2.11-2.0.0.tgz tar zxvf kafka_2.-.tgz cd ka ...

  3. Redis-Sentinel 数据源配置

    1.redis配置文件 : redis.properties # Redis settings #sentinel_node_1 redis.sentinel1.host=192.168.0.1 re ...

  4. 浏览器局部打印实现,iframe打印

    const handleOk = () =>{ let ele = document.getElementById('printInfor'); let iframe=window.frames ...

  5. git 提交丢失Warning, you are leaving 2 commits behind,

    早上在自己的一个版本代码上编辑,提交commint,但是checkout到其他分支再checkout回来发现该的东西不见了, 幸好terminal还没有关掉,回看日志: Warning: you ar ...

  6. Linux Oracle安装

    lsnrctl status  // 查看linux系统oracle的监听状态lsnrctl start   // 启动linux系统oracle的监听状态 sqlplus /nolog  // 连接 ...

  7. Collection中的方法

    以ArrayList为例 package com.mydemo; import java.util.ArrayList; public class CollectionDemo { public st ...

  8. eosjs

    [eosjs] Javascript API,用于帮助访问与 EOSIO RPC API. 1.安装 npm install eosjs@beta 2.Signature Provider The S ...

  9. Pandas.Series.dt.dayofweek相关命令

  10. Python+Selenium学习--案例介绍

    1. 前言 前面讲解了那么多selenium的基础知识,下面用一个简单案例来介绍,此案例主要实现,运行测试,自动生成html报告,并发生邮件. 2. 测试案例 2.1 目录结构介绍 conf:配置信息 ...