软件集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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@Node3 ~] # 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)
 
 
[root@Node3 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[root@Python ~] # 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)
 
 
[root@Python 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中的应用,你还需要安装下列包:

1
[root@Python ~] # yum install scl-utils scl-utils-build


2、SCL的设置及启用

SCL设置步骤非常简单

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[root@Python ~] # 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命令执行该命令)

1
$ scl  enable  <scl-package-name> < command >

如果想在启用的包时执行多条命令,你可以像下面那样创建一个启用SCL的bash会话

1
$ scl  enable  <scl-package-name>  bash



三、SCL使用实例:CentOS下安装高版本GCC

    有时编译需要用到4.8以上版本的GCC,由于CentOS源没有提供高版本的GCC rpm包,这时就不能通过yum方式安装。通常的解决方案就是通过编译安装高版本的GCC(需要很长时间)。

这里介绍一个更好用、更简单的方法来升级系统GCC。


查看旧版本的GCC相关包:

1
2
3
4
5
[root@Python ~] # 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:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@Python ~] # 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的版本不会。

1
[root@Python ~] # yum install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-gcc-gfortran


安装后:

1
2
3
4
5
6
7
8
[root@Python ~] # 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:

1
2
3
4
5
6
7
8
[root@Python ~] # 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.
 
[root@Python ~] # scl -l
devtoolset-4


启用SCL的方法:

1) scl enable 软件包名 bash    

     启用一个新的shell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[root@Python ~] # scl enable devtoolset-4 bash  # 进入一个新shell
 
[root@Python ~] # 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.
 
[root@Python ~] # 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.
 
[root@Python ~] # 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中生效

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
[root@Python ~] # source /opt/rh/devtoolset-4/enable 
[root@Python ~] # 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.
 
[root@Python ~] # 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.
 
[root@Python ~] # 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:

1
[root@Python ~] # 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 的问题

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[root@Python ~] # 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
 
[root@Python ~] # rpm -ql devtoolset-4-libstdc++-devel|grep libstdc++.so
[root@Python ~] # rpm -ql libstdc++-devel|grep libstdc++.so
[root@Python ~] # rpm -ql libstdc++|grep libstdc++.so
/usr/lib64/libstdc ++.so.6
/usr/lib64/libstdc ++.so.6.0.13
[root@Python ~] # 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
 
[root@Python ~] # 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++动态库
 
[root@Python ~] # vim /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/libstdc++.so
[root@Python ~] # vim /opt/rh/devtoolset-4/root/usr/lib/gcc/x86_64-redhat-linux/5.3.1/32/libstdc++.so
[root@Python ~] # 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 )
[root@Python ~] # 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



















本文转自xiexiaojun51CTO博客,原文链接:http://blog.51cto.com/xiexiaojun/1934716 ,如需转载请自行联系原作者

相关实践学习
阿里云图数据库GDB入门与应用
图数据库(Graph Database,简称GDB)是一种支持Property Graph图模型、用于处理高度连接数据查询与存储的实时、可靠的在线数据库服务。它支持Apache TinkerPop Gremlin查询语言,可以帮您快速构建基于高度连接的数据集的应用程序。GDB非常适合社交网络、欺诈检测、推荐引擎、实时图谱、网络/IT运营这类高度互连数据集的场景。 GDB由阿里云自主研发,具备如下优势: 标准图查询语言:支持属性图,高度兼容Gremlin图查询语言。 高度优化的自研引擎:高度优化的自研图计算层和存储层,云盘多副本保障数据超高可靠,支持ACID事务。 服务高可用:支持高可用实例,节点故障迅速转移,保障业务连续性。 易运维:提供备份恢复、自动升级、监控告警、故障切换等丰富的运维功能,大幅降低运维成本。 产品主页:https://www.aliyun.com/product/gdb
相关文章
|
Linux 程序员 Windows
生成项目目录结构(based on windows system)
描述:         作为程序员,在工作中,我们经常会有需求,需要罗列出项目的结构图;如果手工来整理的话,太过浪费时间,其实我们可以借助tree命令来快速生成目录结构。         本文主要介绍一下,基于windows系统,如何快速生成目录结构的方法。
2894 0
|
安全 网络协议 JavaScript