centos7下载速度提升 补全Tab 安装扩展yum源(手动指定阿里源)& epel安装

最大化 最小化切换 每行行首 会 “ 掉脑袋 ” 刷新一下即可
或者最小化查看

阿里云官方镜像站

查看默认yum源

  [root@oldboy-lnb ~]# yum repolist
  Loaded plugins: fastestmirror
  Loading mirror speeds from cached hostfile
   * base: mirrors.aliyun.com     ----------------------> 下载时会随机镜像源网站,之前已安装这里做演示
   * extras: mirrors.aliyun.com
   * updates: mirrors.huaweicloud.com
  repo id                                        repo name                                        status
  !base/7/x86_64                                 CentOS-7 - Base                                  10,070
  !extras/7/x86_64                               CentOS-7 - Extras                                   413
  !updates/7/x86_64                              CentOS-7 - Updates                                1,134
  repolist: 11,617

安装阿里云

镜像选centos,点击进入

centos

按照提示要求操作就可

  1.备份,直接复制即可

1

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

2

  2.下载新的 CentOS-Base.repo 到 /etc/yum.repos.d/
    选择与自己相同的版本,这里选用centos7

  ps:查看当前版本[root@oldboy-lnb ~]# cat /etc/redhat-release
                 CentOS Linux release 7.7.1908 (Core)

3

  这里有两种安装方法,wget和curl,两种都可以但这里选择curl,因为此时我们的centos中还没有wget指令

4

  复制curl指令
  curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

5

  3.查看
  [root@oldboy-lnb ~]# yum repolist
  Loaded plugins: fastestmirror
  Loading mirror speeds from cached hostfile
   * base: mirrors.aliyun.com     ----------------------> 安装完成,阿里云
    ......
  之前下载安装软件的速度慢的话,现在会明显提升

安装epel拓展

但不是所有的软件都在阿里云里面

  [root@oldboy-lnb ~]# yum -y install cowsay sl
  Loaded plugins: fastestmirror
  Loading mirror speeds from cached hostfile
   * base: mirrors.aliyun.com
   * extras: mirrors.aliyun.com
   * updates: mirrors.aliyun.com
  No package coesay available.
  No package sl available.
  Error: Nothing to do
  提示没有安装包,啥也没干

还是在镜像下,选择epel

epel

  点击去,因为没有mv直接下载epel配置包

  版本选择epel(RHEL 7),但是wget安装,所以先安装wget
  [root@oldboy-lnb ~]# yum -y install wget

安装完成后直接复制

6

  复制:
  wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

  这时查看仓库信息
  [root@oldboy-lnb ~]# yum repolist

7

完成

  安装[root@oldboy-lnb ~]# yum -y install cowsay sl

  sl 跑火车

sl 跑火车

  cowsay "填入你想说的说"  动物说话
  [root@oldboy-lnb ~]# rpm -ql cowsay  # 可以查看安装的内容

animalsay

安装扩展命令的tab补全插件

  前提安装了扩展的yum仓库
  [root@oldboyedu ~]# yum -y install bash-completion-extras.noarch
  ...
    
  [root@oldboyedu ~]# exit
  然后重连即可

总结

  默认的YUM源

  1.备份默认的YUM源
  mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  2.下载阿里云YUM源
  curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo

  3.使用yum repolist 查看当前的源

  4.安装扩展的仓库
    安装wget命令
    yum -y install wget
    安装扩展的仓库 
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

    yum -y install cowsay sl
  
  5.安装扩展命令的tab补全插件  前提安装了扩展的yum仓库
    [root@oldboyedu ~]# yum -y install bash-completion-extras.noarch
    需要重新登录下操作系统 可自动补全
[root@oldboyedu ~]# hostname
hostname     hostnamectl  
[root@oldboyedu ~]# hostnamectl set-
set-chassis     set-deployment  set-hostname    set-icon-name   
[root@oldboyedu ~]# hostnamectl set-
set-chassis     set-deployment  set-hostname    set-icon-name   
[root@oldboyedu ~]# hostnamectl set-hostname oldboyedu
原文地址:https://www.cnblogs.com/hsqKTm/p/13921138.html