zoukankan      html  css  js  c++  java
  • Centos yum 修改为阿里源以及常用的命令

    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.1708 (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

  • 相关阅读:
    JDBC
    「题解」:串串香
    「题解」:树
    「题解」:最近公共祖先
    「题解」:集合论
    「题解」:位运算
    「题解」:序列
    「总结」浅谈主席树
    $My$ $template$(持续更新)
    「题解」:毛三琛
  • 原文地址:https://www.cnblogs.com/zhuzi91/p/8245897.html
Copyright © 2011-2022 走看看