运维系列:CentOS 使用 IUS / SCL 第三方软件源

CentOS 使用 IUS / SCL 第三方软件源




CentOS 使用 IUS / SCL 第三方软件源

使用centos 经常发现官方提供的软件包版本过低,很多时候大家会选择下载源码自行编译,带来了很多麻烦。
centos安装最新版本软件包,例如git,python等,可以通过红帽官方提供的software collection,或者社区提供的ius实现。

IUS#

IUS是一个社区维护的软件源,全名是Inline with Upstream Stable,官网为https://ius.io/,通过github组织社区https://github.com/iuscommunity
IUSgit帮助文档推荐作为centos等系统安装新版本git的第三方源:https://git-scm.com/download/linux

安装IUS是直接安装软件包,并不像SCL还带了虚拟环境的概念。所以使用起来相对简单。

安装git命令

yum install epel-release
rpm -U https://centos7.iuscommunity.org/ius-release.rpm
yum remove git
yum install git2u

IUS为了避免与官方源冲突,所以对软件包名进行了修改, 规则为:{name}{major_version}{minor_version}u
IUS支持的软件包,可通过github查询

IUS直接访问速度不是很理想,可以设置国内镜像:

IUS 站点根目录为:https://dl.iuscommunity.org/pub/ius/
对应的阿里云镜像为:https://mirrors.aliyun.com/ius/
镜像列表:https://mirrors.iuscommunity.org/mirrors
清华大学镜像:https://mirrors.tuna.tsinghua.edu.cn/ius/
同济大学镜像:https://mirrors.tongji.edu.cn/ius/

编辑 /etc/yum.repos.d/ius.repo,将官方网址修改为镜像地址

命令替换:

sed -i "s|repo.ius.io|mirrors.tuna.tsinghua.edu.cn/ius|g" /etc/yum.repos.d/ius.repo

repo文件:

[ius]
name = IUS for Enterprise Linux 7 - $basearch
baseurl = https://mirrors.tuna.tsinghua.edu.cn/ius/7/$basearch/
enabled = 1
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7

[ius-debuginfo]
name = IUS for Enterprise Linux 7 - $basearch - Debug
baseurl = https://mirrors.tuna.tsinghua.edu.cn/ius/7/$basearch/debug/
enabled = 0
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7

[ius-source]
name = IUS for Enterprise Linux 7 - Source
baseurl = https://mirrors.tuna.tsinghua.edu.cn/ius/7/src/
enabled = 0
repo_gpgcheck = 0
gpgcheck = 1
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-IUS-7

update:

通过镜像安装

wget https://mirrors.aliyun.com/ius/ius-release-el7.rpm
rpm -i ius-release-el7.rpm

参考:
https://blog.csdn.net/weixin_54626591/article/details/138370025

update 2022-11-22:

包名去除了最后的字母,安装git: yum install git236

SCL#

scl不是一个简单的包管理工具,而是类似pythonvenv(virtualenv) 。它可以支持系统同时安装多个版本的软件,然后通过scl enable命令来激活相应软件环境,而不会对原始的软件环境产生影响。
以git安装和启用为例:

yum install centos-release-scl
yum install rh-git29
scl enable rh-git29 bash ##激活git的打开bash
git --version

但是对于我们而言,如果不需要这么复杂的虚拟环境功能,单纯想要使用其提供的最新版本软件,可以通过 source scl_source enable 命令实现。
如果需要系统重启后,能够自动启动最新版本软件环境,可进行以下配置:

#通过`bash环境`来设定,仅对特定用户启用
vi ~/.bashrc # or ~/.bash_profile

source scl_source enable rh-git29

或者

#对全局用户启用
vi /etc/profile.d/enable_scl.sh

#!/bin/bash
source scl_source enable rh-git29

或者

scl enable rh-git29 bash
which git
/opt/rh/rh-git29/root/usr/bin/git

ln -s /opt/rh/rh-git29/root/usr/bin/git  /usr/bin/git 

其他软件源:

https://blog.csdn.net/weixin_54626591/article/details/138373438

参考:

https://www.softwarecollections.org/en/docs/

http://xmodulo.com/enable-software-collections-centos.html

https://unix.stackexchange.com/questions/175851/how-to-permanently-enable-scl-centos-6-4

https://serverfault.com/questions/751155/permanently-enable-a-scl

https://access.redhat.com/solutions/527703







Dev-blog by WS

CentOS 使用 IUS / SCL 第三方软件源

  • 17
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

坦笑&&life

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值