• RedHat 更新CentOS Yum源


    一、随笔引言

    1.1随笔内容:

    1、RedHat 配置Centos yum源

    2、yum配置系统本地源(光盘)

    1.2原因:

    1、RedHat yum源是收费的,没有成功注册RH的机器是不能正常使用yum的;

    2、CentOs yum源是免费的,可以使用国内网易的yum源,比较稳定;

    3、知道挂载本地源,也是很方便的;

    1.3系统环境:

    系统版本:Red Hat Enterprise Linux Server release 6.2

    软件环境:系统默认是自带了yum程序的,不过我卸了它,装centos版的

    所需文件:见下文2.2

    说明:我个人环境,仅做参考,Redhat 6及相关版本大致通用

    二、RedHat 配置Centos yum源

    2.1 卸载本地yum

    rpm -qa|grep yum  #查看本地yum

    rpm -qa|grep yum|xargs rpm -e --nodeps  #卸载本地yum,不检查依赖性,卸载yum程序

    2.2 下载centos yum 程序

    wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-69.el6.centos.noarch.rpm

    wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

    wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

    #命令wget 下载,也可以使用浏览器下载到你个人目录

    2.3 安装centos yum程序

    rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

    #3个文件一起安装,以免它们相互依赖

     

    2.4 配置centos

    cd /etc/yum.repos.d/  #进入到yum配置文件目录

    wget http://mirrors.163.com/.help/CentOS6-Base-163.repo  #下载CentOS配置文件

     

    vi CentOS6-Base-163.repo  #编辑配置文件

    如果你系统没有配置环境变量$releasever 和 $basearch,(可以命令echo查看有没有)
    那么配置文件就把$releasever 都 改成6或者i386(如下会贴出几大步骤的截图)

    yum clean all  #清除yum缓存

    yum makecache  #更新yum缓存

     

    2.5 验证

    (下回安装软件后在贴)

    三、RedHat 配置本地源

    3.1 挂载本地光盘到系统

    mkdir /media/rhel #新建挂载目录

    mount /dev/cdrom /media/rhel #挂载光盘到/media/rhel目录下

    cd /media/rhel #进入挂载目录

    ls #查看挂载目录,光盘挂载成功

    3.2 配置本地yum源

    cd /etc/yum.repos.d/ #进入yum配置目录

    touch rhel-media.repo #建立yum配置文件

    vi rhel-media.repo #编辑配置文件,添加以下内容

    [rhel-media]

    name=Red Hat Enterprise Linux 6.2 #自定义名称

    baseurl=file:///media/rhel #本地光盘挂载路径

    enabled=1 #启用yum源,0为不启用,1为启用

    gpgcheck=1 #检查GPG-KEY,0为不检查,1为检查

    gpgkey=file:///media/rhel/RPM-GPG-KEY-redhat-release #GPG-KEY路径

    yum clean all #清除yum缓存(还是别乱清理了,待会163的yum源也被清理了)

    第四、验证

    (待验证)

    yum install php #安装php,也可以你光盘中的其他程序

  • 相关阅读:
    CentOS中怎样卸载旧版本Git并安装高版本Git
    下载抖音无水印视频工具 python webdriver 2020.09.02
    axel-2.17.9 aria2c-1.35.0 wget-1.20.3 curl-7.72.0 最新CLI下载工具在win10环境测试下载速度
    wget-1.20.3 static for win32
    undefined reference to `inet_pton' under MSYS
    undefined reference to `gnutls_protocol_set_priority'
    wget2 for windows 2020.08.28
    Unicode转义(uXXXX)的编码和解码 go-nascii 类似于 native2ascii
    正则表达式零宽断言 grep sift ripgrep(rg)
    编译 jq git版本
  • 原文地址:https://www.cnblogs.com/tangsen/p/5151994.html
Copyright © 2020-2023  润新知