首页 > 系统相关 >Red Hat Linux安装CentOS的yum源

Red Hat Linux安装CentOS的yum源

时间:2023-05-16 16:34:54浏览次数:52  
标签:el6 http CentOS centos Hat yum rpm

RedHat凭借其卓越的稳定性和强大的服务占领着企业linux大部分市场,系统本身免费,但是其服务却是收费的,例如其软件包管理服务yum。不想出钱那就自己配置yum源就好了,因为yum在线更新是收费的,未注册则不能使用,这个是要填序列号激活的,解决办法是更换为CentOS的yum。
设置步骤

Red Hat Linux安装CentOS的yum源Red Hat Linux安装CentOS的yum源

1. 查询原有的yum

[root@orcl ~]# rpm -qa |grep yum 
yum-plugin-fastestmirror-1.1.30-37.el6.noarch 
yum-metadata-parser-1.1.2-16.el6.i686 
yum-utils-1.1.30-37.el6.noarch 
yum-plugin-security-1.1.30-37.el6.noarch 
yum-3.2.29-75.el6.centos.noarch 
yum-rhn-plugin-0.9.1-43.el6.noarch

2. 删除原有的yum

[root@orcl ~]# rpm -aq|grep yum|xargs rpm -e –-nodeps 
[root@orcl ~]# rpm -qa |grep yum 
[root@orcl ~]#

3. 查询原有yum配置

[root@orcl ~]# whereis yum 
yum: /etc/yum 
[root@orcl ~]# rm -fr /etc/yum

4. 下载需要的安装包
http://mirrors.163.com/centos/6.8/os/i386/Packages/
系统为32的,所以我选择i386。64的自行查找x86_64。
可以使用

wget http://mirrors.163.com/centos/6.8/os/i386/Packages/yum-3.2.29-73.el6.centos.noarch.rpm

下载

yum-3.2.29-73.el6.centos.noarch.rpm 
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm 
yum-metadata-parser-1.1.2-16.el6.i686.rpm 
Python-iniparse-0.3.1-2.1.el6.noarch.rpm

5. 安装python

[root@orcl ~]# rpm -ivh python-iniparse-….noarch.rpm 
warning: python-iniparse-0.4-9.el7.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY 
error: Failed dependencies: 
python(abi) = 2.7 is needed by python-iniparse-0.4-9.el7.noarch 

当前安装版本与服务器不兼容,退后一个版本再试。
查看当前发行版本号

cat /etc/issue
遇到的错误

Red Hat Linux安装CentOS的yum源Red Hat Linux安装CentOS的yum源

系统位数与安装程序包位数不一致 file /bin/ls

error: Failed dependencies: 
libc.so.6()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libc.so.6(GLIBC_2.2.5)(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libglib-2.0.so.0()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libpthread.so.0()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libpython2.6.so.1.0()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libsqlite3.so.0()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libxml2.so.2()(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64 
libxml2.so.2(LIBXML2_2.4.30)(64bit) is needed by yum-metadata-parser-1.1.2-16.el6.x86_64
重新下载32位程序包
[root@orcl ~]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
Preparing… ########################################### [100%] 
package python-iniparse-0.3.1-2.1.el6.noarch is already installed 
[root@orcl ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm 
Preparing… ########################################### [100%] 
1:yum-metadata-parser ########################################### [100%] 
[root@orcl ~]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm 
Preparing… ########################################### [100%] 
1:yum-plugin-fastestmirro########################################### [ 50%] 
2:yum ########################################### [100%] 
[root@orcl ~]#

注意最后两个包必需同时安装,否则会相互依赖
更改yum源(使用网易的CentOS镜像源)

[root@localhost yum]# cd /etc/yum.repos.d/ 
[root@localhost yum.repos.d]# rm -rf * 
[root@localhost yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 
[root@localhost yum.repos.d]# vi CentOS6-Base-163.repo 

将所有 $releasever 修改为具体的版本号,我这里写的是6.8,这个自己打开(http://mirrors.163.com/centos)找一下就可以。

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6.8/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.8/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.8/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6.8/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6.8/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

清理yum缓存

yum clean all

显示已安程序包及可安程序包

yum list

可以按要求更新程序包或安装

yum update / yum install 包名

到此结束了,亲们

标签:el6,http,CentOS,centos,Hat,yum,rpm
From: https://www.cnblogs.com/linuxpro/p/17406058.html

相关文章

  • CentOS7中使用Git从github上克隆一个仓库
     1.显示git的版本信息(验证是否安装Git)git--version或者yuminfogit 2.查看git的配置gitconfiguser.namegitconfiguser.email如果没有配置git的用户名和用户的邮箱(名字可以任意指定),可以使用一下命令配置。--global的作用是全局有效,也就是对当前的linu......
  • ChatGPT 可以用来做什么?
    一、讨论成果ChatGPT可以被用来做以下工作1、辅助编程提升自己和团队的编码效率,让开发人员称为全栈工程师,利用ChatGPT弥补前后端知识的不足。2、软件架构基于ChatGPT的快速学习和产出方案,对架构基础框架进行优化,减少冗余和重复性代码。把ChatGPT当成一个小助手,完成一些复......
  • centos7.9部署LNMP
    系统设置创建应用目录mkdir-pv/data/apps系统更新yum-yupdatelimits.confcat>>/etc/security/limits.conf<<EOFrootsoftcoreunlimitedroothardcoreunlimitedrootsoftnproc1000000roothardnproc1000000rootsoftnofile100000roothardnofile......
  • 龙蜥产品生态总监做客 InfoQ:后 CentOS 时代,国产操作系统能否扛起大旗?
    随着CentOS全面停服即将进入尾声,企业选择一款既可保障系统稳定运行,又可提供专业技术支持的操作系统迁移显得尤为重要。那么,现存的CentOS以及衍生版用户或将面临哪些风险?一套完整的迁移方案应该包括哪些步骤?在当下众多的迁移版本中如何选择符合市场发展诉求的操作系统……相信大......
  • ChatGPT Plugin开发setup - Java(Spring Boot) Python(fastapi)
    记录一下快速模板,整体很简单,如果不接auth,只需要以下:提供一个/.well-known/ai-plugin.json接口,返回openAI所需要的格式提供openAPI规范的文档CORS设置其他的和普通的web开发类似.本地开发就直接使用localhost即可,前几天官方localhost无法联通,最近应该修复了.要让GPT......
  • CentOS查看每个目录所占用空间大小的命令
    cd到上级目录,然后输入一条命令即可查询每个子目录所占用的空间大小du-h--max-depth=1可以更改--max-depth参数的值,该参数表示查询子目录的层级,当前为1层......
  • langchain-ChatGLM调研
    https://github.com/imClumsyPanda/langchain-ChatGLM 1.确定显卡规格lspci|grep-invidia00:07.03Dcontroller:NVIDIACorporationGV100GL[TeslaV100SXM232GB](reva1)2.确定显卡运行状况nvidia-smi如果有问题,需要先装显卡的驱动aptsearchnvidia-drive......
  • Centos7下搭建PostgreSQL关系型数据库
     ALTERUSERpostgresENCRYPTEDPASSWORD'postgres123';   10、开放端口firewall-cmd--query-port=5432/tcpfirewall-cmd--add-port=5432/tcpfirewall-cmd--add-port=5432/tcp--zone=public--permanent 11、重新启动systemctlrestartpostgresql-11 ......
  • CentOS7更换阿里yum源
    CentOS7更换阿里yum源CentOS7更换阿里yum源1.备份原有yum源2.下载阿里yum源3.清理yum缓存,重建缓存4.安装epel-release5.查看yum源信息官方镜像下载地址:https://www.centos.org/download/mirrors/阿里云Linux-CentOS镜像仓库地址:http://mirrors.aliyun.com/ce......
  • centos初始化脚本
    #!/bin/bash#vim/etc/resolv.conf#nameserver8.8.8.8#google域名服务器#nameserver8.8.4.4#google域名服务器#修改源cd/etc/yum.repos.d/mvCentOS-Base.repoCentOS-Base.repo.backupwget-O/etc/yum.repos.d/CentOS-Base.repohttp://mirrors.aliyun.com/re......