Centos7安装SCL源

安装SCL源

SCL是Software Collections的缩写,由CentOS 特别兴趣小组所维护。其收录了许多程序的新版本,例如gcc, PHP, git, python等。安装的软件可与旧版共存,包名多以rh-为前缀。

参考: https://www.cnblogs.com/wswind/p/10729610.html
配置SCL https://chowdera.com/2021/10/20211015120730214l.html

# 安装SCL源
yum install -y centos-release-scl centos-release-scl-rh

# 安装scl-utils工具
yum install -y scl-utils scl-utils-build

安装完成后在/etc/yum.repos.d目录下会出现CentOS-SCLo-scl.repoCentOS-SCLo-scl-rh.repo两个文件。安装后源默认启用。


配置scl国内源

参考: https://zhuanlan.zhihu.com/p/424953404

# 备份
cp CentOS-SCLo-scl.repo{
    
    ,.bak}
cp CentOS-SCLo-scl-rh.repo{
    
    ,.bak}

配置CentOS-SCLo-scl.repo

[centos-sclo-sclo]
name=CentOS-7 - SCLo sclo
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/sclo/$basearch/sclo/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

配置CentOS-SCLo-scl-rh.repo

[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos/7/sclo/$basearch/rh/
gpgcheck=0
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo

刷新缓存

# 刷新缓存
yum repolist && yum clean all && yum makecache

使用scl源安装新版的包

# 安装新版的git
yum install rh-git29

# 激活新版的git
scl enable rh-git29 bash ##激活git的打开bash

# 查看git版本
git --version

对特定用户生效scl版本

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

# 添加
source scl_source enable rh-git29

对全局用户启用scl版本

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

# 添加内容
source scl_source enable rh-git29

或者

# 全局启用scl版本

# 启用scl版本的git
scl enable rh-git29 bash

# 查看git所在位置
which git
## 回显
/opt/rh/rh-git29/root/usr/bin/git

# 将srl版本的git软链接到/usr/bin/git 
ln -s /opt/rh/rh-git29/root/usr/bin/git  /usr/bin/git 

scl常用


从scl源中搜索软件

# 从scl源中搜索软件
yum --disablerepo="*" --enablerepo="scl" search 包名

查看从 SCL 中安装的包

# 查看从 SCL 中安装的包
scl --list

猜你喜欢

转载自blog.csdn.net/omaidb/article/details/126462159