CentOS 使用 IUS / SCL 第三方软件源
使用centos 经常发现官方提供的软件包版本过低,很多时候大家会选择下载源码自行编译,带来了很多麻烦。
centos安装最新版本软件包,例如git,python等,可以通过红帽官方提供的software collection,或者社区提供的ius实现。
IUS#
IUS是一个社区维护的软件源,全名是Inline with Upstream Stable,官网为https://ius.io/,通过github组织社区https://github.com/iuscommunity
IUS被git帮助文档推荐作为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://www.cnblogs.com/f-ck-need-u/p/8494992.html
update 2022-11-22:
包名去除了最后的字母,安装git: yum install git236
SCL#
scl不是一个简单的包管理工具,而是类似python的venv(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://www.cnblogs.com/mawanglin2008/p/3532247.html
参考:
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
本文采用 知识共享署名 4.0 国际许可协议 进行许可
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 解答了困扰我五年的技术问题
· 为什么说在企业级应用开发中,后端往往是效率杀手?
· 用 C# 插值字符串处理器写一个 sscanf
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· PPT革命!DeepSeek+Kimi=N小时工作5分钟完成?
· What?废柴, 还在本地部署DeepSeek吗?Are you kidding?
· DeepSeek企业级部署实战指南:从服务器选型到Dify私有化落地
· 程序员转型AI:行业分析
· 重磅发布!DeepSeek 微调秘籍揭秘,一键解锁升级版全家桶,AI 玩家必备神器!