centos7配置yum为国内源

问题:

yum install libXm.so.4
报错:Cannot find a valid baseurl for repo: base/7/x86_64

因为yum源不是国内的,切换一下。

步骤:

卸载 yum
    rpm -aq | grep yum |xargs rpm -e --nodeps
        warning: /etc/yum/pluginconf.d/langpacks.conf saved as /etc/yum/pluginconf.d/langpacks.conf.rpmsave

安装 yum
    cd /data/software
    mkdir yum 
    cd yum
    wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm
    wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm
    wget http://mirrors.aliyun.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm
    rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
        warning: python-urlgrabber-3.10-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
        Preparing...                          ################################# [100%]
        package python-urlgrabber-3.10-9.el7.noarch is already installed
    rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
    rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm

更改yum源    

    cd /etc/yum.repos.d
    wget http://mirrors.aliyun.com/repo/Centos-7.repo

清除缓存

    yum clean all
    yum makecache
   -----更新内核一般谨慎操作。  yum update

安装完成,可以安装类库了。

 

你可能感兴趣的:(--------【LINUX】,★服务器)