软件集Software Collections
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了软件集Software Collections相关的知识,希望对你有一定的参考价值。
一、SCL
1、SCL是什么
SCL项目主页:https://www.softwarecollections.org/
SCL(Software Collections)可以让你在同一个操作系统上安装和使用多个版本的软件,而不会影响整个系统的安装包。
SCL为社区的以下需求而设计:
创建和使用软件集合生产系统、概念验证系统、开发测试平台。SCL目前已经支持Fedora和RHEL(衍生版本如CentOS也包含在内)。
SCL的创建就是为了给RHEL/CentOS用户提供一种以方便、安全地安装和使用应用程序和运行时环境的多个(而且可能是更新的)版本的方式,同时避免把系统搞乱。与之相对的是第三方源,它们可能会在已安装的包之间引起冲突。
现有软件选集:
现在有以下软件选集可供CentOS 6.5或以上版本应用
Ruby 1.9.3 (ruby193)
Python 2.7 (python27)
Python 3.3 (python33)
php 5.4 (php54)
Perl 5.16.3 (perl516)
Node.js 0.10 (nodejs010)
MariaDB 5.5 (mariadb55)
mysql 5.5 (mysql55)
PostgreSQL 9.2 (postgresql92)
更多的软件集可参看这里:https://www.softwarecollections.org/en/scls/
2、安装SCL
在CentOS下使用 SCL,需要安装CentOS Software Collections。它是CentOS Extras软件库的一部份,并可通过以下指命进行安装
Centos 7:
[[email protected] ~]# yum install centos-release-scl Dependencies Resolved =================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================== Installing: centos-release-scl noarch 10:7-3.el6.centos extras 12 k Installing for dependencies: centos-release-scl-rh noarch 2-3.el6.centos extras 12 k Transaction Summary =================================================================================================================================== Install 2 Package(s) [[email protected] yum.repos.d]# rpm -ql centos-release-scl /etc/pki/rpm-gpg /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo /etc/yum.repos.d/CentOS-SCLo-scl.repo /usr/share/doc/centos-release-scl/GPL
Centos 6:
[[email protected] ~]# yum install centos-release-SCL Dependencies Resolved ============================================================================================================================================================================================ Package Arch Version Repository Size ============================================================================================================================================================================================ Installing: centos-release-scl-rh noarch 2-3.el6.centos extras 12 k Transaction Summary ============================================================================================================================================================================================ Install 1 Package(s) [[email protected] yum.repos.d]# rpm -ql centos-release-scl-rh /etc/pki/rpm-gpg /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo /usr/share/doc/centos-release-scl-rh/GPL
注意:Centos6和Centos7的包名是区分大小写的!
二、SCL的设置及启用
1、要启用和运行SCL中的应用,你还需要安装下列包:
[[email protected] ~]# yum install scl-utils scl-utils-build
2、SCL的设置及启用
SCL设置步骤非常简单
[[email protected] ~]# scl --help usage: scl <action> [<collection>...] <command> or: scl -l|--list [<collection>...] or: scl register <path> or: scl deregister <collection> [--force] Options: -l, --list list installed Software Collections or packages that belong to them -h, --help display this help and exit Actions: enable calls enable script from Software Collection (enables a Software Collection) <SCL script name> calls arbitrary script from a Software Collection Use ‘-‘ as <command> to read the command from standard input.
启用一个已经安装的SCL包
需要在每个命令中使用scl命令显式启用它(即想在哪条命令中使用SCL中的包,就得通过scl命令执行该命令)
$ scl enable <scl-package-name> <command>
如果想在启用的包时执行多条命令,你可以像下面那样创建一个启用SCL的bash会话
$ scl enable <scl-package-name> bash
三、SCL使用实例:CentOS下安装高版本GCC
有时编译需要用到4.8以上版本的GCC,由于CentOS源没有提供高版本的GCC rpm包,这时就不能通过yum方式安装。通常的解决方案就是通过编译安装高版本的GCC(需要很长时间)。
这里介绍一个更好用、更简单的方法来升级系统GCC。
查看旧版本的GCC相关包:
[[email protected] ~]# rpm -qa|grep gcc libgcc-4.4.7-18.el6.x86_64 gcc-4.4.7-18.el6.x86_64 gcc-c++-4.4.7-18.el6.x86_64 gcc-gfortran-4.4.7-18.el6.x86_64
安装GCC 5:
[[email protected] ~]# yum list|grep devtoolset|grep gcc Repository epel is listed more than once in the configuration Repository epel-debuginfo is listed more than once in the configuration Repository epel-source is listed more than once in the configuration devtoolset-3-gcc.x86_64 4.9.2-6.2.el6 centos-sclo-rh devtoolset-3-gcc-c++.x86_64 4.9.2-6.2.el6 centos-sclo-rh devtoolset-3-gcc-gfortran.x86_64 4.9.2-6.2.el6 centos-sclo-rh devtoolset-3-gcc-plugin-devel.x86_64 4.9.2-6.2.el6 centos-sclo-rh devtoolset-4-gcc.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-gcc-c++.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-gcc-gdb-plugin.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-gcc-gfortran.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-gcc-plugin-devel.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-libgccjit.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-libgccjit-devel.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-4-libgccjit-docs.x86_64 5.3.1-6.1.el6 centos-sclo-rh devtoolset-6-gcc.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-gcc-c++.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-gcc-gdb-plugin.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-gcc-gfortran.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-gcc-plugin-devel.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-libgccjit.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-libgccjit-devel.x86_64 6.2.1-3.1.el6 centos-sclo-rh devtoolset-6-libgccjit-docs.x86_64 6.2.1-3.1.el6 centos-sclo-rh
在centos6.5上安装devtoolset-3会报错,4和6的版本不会。
[[email protected] ~]# yum install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-gcc-gfortran
安装后:
[[email protected] ~]# rpm -qa|grep gcc devtoolset-4-gcc-5.3.1-6.1.el6.x86_64 libgcc-4.4.7-18.el6.x86_64 gcc-4.4.7-18.el6.x86_64 gcc-c++-4.4.7-18.el6.x86_64 devtoolset-4-gcc-c++-5.3.1-6.1.el6.x86_64 gcc-gfortran-4.4.7-18.el6.x86_64 devtoolset-4-gcc-gfortran-5.3.1-6.1.el6.x86_64
启用高版本的GCC:
[[email protected] ~]# gcc --version gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18) Copyright (C) 2010 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [[email protected] ~]# scl -l devtoolset-4
启用SCL的方法:
1) scl enable 软件包名 bash
启用一个新的shell
[[email protected] ~]# scl enable devtoolset-4 bash # 进入一个新shell [[email protected] ~]# gcc --version gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [[email protected] ~]# c++ --version c++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [[email protected] ~]# g++ --version g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2 )source /opt/rh/devtoolset-4/enable
在当前shell中生效
[[email protected] ~]# source /opt/rh/devtoolset-4/enable [[email protected] ~]# gcc --version gcc (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [[email protected] ~]# c++ --version c++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. [[email protected] ~]# g++ --version g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6) Copyright (C) 2015 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
如果我们需要开机设置GCC 5:
[[email protected] ~]# echo "source /opt/rh/devtoolset-4/enable" > /etc/profile.d/RK.sh
注意:
通过devtoolset安装的gcc因为没有libstdc++包,没有生成libstdc++库文件,编译或运行程序时可能会遇到
类似 /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21‘ not found 的问题
[[email protected] ~]# rpm -qa|grep libstdc++ # 没有devtoolset-4-libstdc包 libstdc++-4.4.7-18.el6.x86_64 libstdc++-devel-4.4.7-18.el6.x86_64 devtoolset-4-libstdc++-devel-5.3.1-6.1.el6.x86_64 [[email protected] ~]# rpm -ql devtoolset-4-libstdc++-devel|grep libstdc++.so [[email protected] ~]# rpm -ql libstdc++-devel|grep libstdc++.so [[email protected] ~]# rpm -ql libstdc++|grep libstdc++.so /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.0.13 [[email protected] ~]# ls -l `rpm -ql libstdc++|grep libstdc++.so` lrwxrwxrwx 1 root root 19 Jun 7 06:46 /usr/lib64/libstdc++.so.6 -> libstdc++.so.6.0.13 -rwxr-xr-x 1 root root 987096 Mar 21 12:04 /usr/lib64/libstdc++.so.6.0.13 [[email protected] ~]# find / -name "libstdc++*" /root/libstdc++-5.3.1-6.fc22.x86_64.rpm /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++_nonshared.a /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++.so /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++_nonshared.a /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++.so /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++fs.a /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++.a /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++fs.a /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++.a /usr/lib64/libstdc++.so.6 /usr/lib64/libstdc++.so.6.0.13 /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.13-gdb.py /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.13-gdb.pyo /usr/share/gdb/auto-load/usr/lib64/libstdc++.so.6.0.13-gdb.pyc /usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.13-gdb.py /usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.13-gdb.pyo /usr/share/gdb/auto-load/usr/lib/libstdc++.so.6.0.13-gdb.pyc /usr/share/doc/libstdc++-devel-4.4.7 /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libstdc++.so /usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libstdc++.so /usr/lib/gcc/x86_64-redhat-linux/4.4.4/32/libstdc++.a /usr/lib/gcc/x86_64-redhat-linux/4.4.4/libstdc++.a /usr/lib/vmware-tools/lib64/libstdc++.so.6 /usr/lib/vmware-tools/lib64/libstdc++.so.6/libstdc++.so.6 /usr/lib/vmware-tools/lib32/libstdc++.so.6 /usr/lib/vmware-tools/lib32/libstdc++.so.6/libstdc++.so.6 # devtoolset安装的gcc还是调用老的libstdc++动态库 [[email protected] ~]# vim /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++.so [[email protected] ~]# vim /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++.so [[email protected] ~]# strings /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf32-i386) INPUT ( /usr/lib/libstdc++.so.6 -lstdc++_nonshared ) [[email protected] ~]# strings /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++.so /* GNU ld script Use the shared library, but some functions are only in the static library, so try that secondarily. */ OUTPUT_FORMAT(elf64-x86-64) INPUT ( /usr/lib64/libstdc++.so.6 -lstdc++_nonshared )
详见:http://xiexiaojun.blog.51cto.com/2305291/1934746
以上是关于软件集Software Collections的主要内容,如果未能解决你的问题,请参考以下文章
Software Testing (软件测试作业三) HW3 prin
敏捷软件工程(agile software development) VS传统软件工程(traditional software development)