linux---RHEL7更换yum源

redhat系统安装好尽管默认带有yum,但是redhat的更新包只对注册用户有效(收费)。所以需要更换yum源。

1、查看自带的yum软件包。

#rpm -qa | grep yum

列出来的软件包,要记住一下,后面要根据其来搜索rpm包来安装新版本。

2、卸载列出来的所有软件包。

#rpm -e yum-3.4.3-118.el7.noarch --nodeps

# rpm -e yum-utils-1.1.31-24.el7.noarch --nodeps

# rpm -e yum-rhn-plugin-2.0.1-4.el7.noarch --nodeps

# rpm -e yum-metadata-parser-1.1.4-10.el7.x86_64 --nodeps

# rpm -e yum-langpacks-0.4.2-3.el7.noarch --nodeps

# rpm -e PackageKit-yum-0.8.9-11.el7.x86_64 --nodeps

3、使用ping命令检查一下,保证此时能正常上网。

4、进入以下网站下载对应的rpm包
阿里云网络源地址:https://mirrors.aliyun.com/centos/7/os/x86_64/Packages/
网易163网络源地址:http://mirrors.163.com/
CentOS网络源地址:http://centos.ustc.edu.cn/centos/
使用CTRL+F输入关键字查找对应的安装包即可。

5、解决yum软件包安装时的依赖问题。
解决办法是把相互依赖的软件包使用命令一起安装。

#rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm yum-fastestmirror-1.1.26-11.el6.centos.noarch.rpm

6、下载阿里镜像到/etc/yum.repos.d/目录下

#wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

7、修改Centos-7.repo文件将所有¥releasever替换为7
进入该文件:#vim /etc/yum.repos.d/CentOS-Base.repo
在末行模式下执行替换命令::%s/$releasever/7/g

8、运行以下命令,完成yum最终配置。

#yum clean all 
#yum makecache
#yum update
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为什么会这样[user_mongo@nosql01 replicaset]$ cd /opt [user_mongo@nosql01 opt]$ ll total 0 drwxr-xr-x. 3 root root 25 Mar 16 17:08 servers drwxr-xr-x. 2 root root 51 Mar 16 17:10 software [user_mongo@nosql01 opt]$ tar -zxvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/LICENSE-Community.txt: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/MPL-2 tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/MPL-2: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/README tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/README: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/THIRD-PARTY-NOTICES: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/install_compass: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongo: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongod: Cannot open: No such file or directory mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos tar: mongodb-linux-x86_64-rhel70-4.4.12: Cannot mkdir: Permission denied tar: mongodb-linux-x86_64-rhel70-4.4.12/bin/mongos: Cannot open: No such file or directory tar: Exiting with failure status due to previous errors [user_mongo@nosql01 opt]$ tar -zcvf /opt/software/mongodb-linux-x86_64-rhel70-4.4.12.tgz -C /opt/servers/mongodb_demo/replicaset/ tar: Cowardly refusing to create an empty archive Try `tar --help' or `tar --usage' for more information.
06-01

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值