mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-29 21:41:00 +08:00
Merge pull request #3655 from bianjp/working
【翻译完成】How to enable Software Collections (SCL) on CentOS
This commit is contained in:
commit
a04e25601f
@ -1,107 +0,0 @@
|
||||
Translating by bianjp
|
||||
|
||||
How to enable Software Collections (SCL) on CentOS
|
||||
================================================================================
|
||||
Red Hat Enterprise Linux (RHEL) and its community fork, CentOS, offer 10-year life cycle, meaning that each version of RHEL/CentOS is updated with security patches for up to 10 years. While such long life cycle guarantees much needed system compatibility and reliability for enterprise users, a downside is that core applications and run-time environments grow antiquated as the underlying RHEL/CentOS version becomes close to end-of-life (EOF). For example, CentOS 6.5, whose EOL is dated to November 30th 2020, comes with python 2.6.6 and MySQL 5.1.73, which are already pretty old by today's standard.
|
||||
|
||||
On the other hand, attempting to manually upgrade development toolchains and run-time environments on RHEL/CentOS may potentially break your system unless all dependencies are resolved correctly. Under normal circumstances, manual upgrade is not recommended unless you know what you are doing.
|
||||
|
||||
The [Software Collections][1] (SCL) repository came into being to help with RHEL/CentOS users in this situation. The SCL is created to provide RHEL/CentOS users with a means to easily and safely install and use multiple (and potentially more recent) versions of applications and run-time environments "without" messing up the existing system. This is in contrast to other third party repositories which could cause conflicts among installed packages.
|
||||
|
||||
The latest SCL offers:
|
||||
|
||||
- Python 3.3 and 2.7
|
||||
- PHP 5.4
|
||||
- Node.js 0.10
|
||||
- Ruby 1.9.3
|
||||
- Perl 5.16.3
|
||||
- MariaDB and MySQL 5.5
|
||||
- Apache httpd 2.4.6
|
||||
|
||||
In the rest of the tutorial, let me show you how to set up the SCL repository and how to install and enable the packages from the SCL.
|
||||
|
||||
### Set up the Software Collections (SCL) Repository ###
|
||||
|
||||
The SCL is available on CentOS 6.5 and later. To set up the SCL, simply run:
|
||||
|
||||
$ sudo yum install centos-release-SCL
|
||||
|
||||
To enable and run applications from the SCL, you also need to install the following package.
|
||||
|
||||
$ sudo yum install scl-utils-build
|
||||
|
||||
You can browse a complete list of packages available from the SCL repository by running:
|
||||
|
||||
$ yum --disablerepo="*" --enablerepo="scl" list available
|
||||
|
||||
![](https://c2.staticflickr.com/6/5730/23304424250_f5c8a09584_c.jpg)
|
||||
|
||||
### Install and Enable a Package from the SCL ###
|
||||
|
||||
Now that you have set up the SCL, you can go ahead and install any package from the SCL.
|
||||
|
||||
You can search for SCL packages with:
|
||||
|
||||
$ yum --disablerepo="*" --enablerepo="scl" search <keyword>
|
||||
|
||||
Let's say you want to install python 3.3.
|
||||
|
||||
Go ahead and install it as usual with yum:
|
||||
|
||||
$ sudo yum install python33
|
||||
|
||||
At any time you can check the list of packages you installed from the SCL by running:
|
||||
|
||||
$ scl --list
|
||||
|
||||
----------
|
||||
|
||||
python33
|
||||
|
||||
A nice thing about the SCL is that installing a package from the SCL does NOT overwrite any system files, and is guaranteed to not cause any conflicts with other system libraries and applications.
|
||||
|
||||
For example, if you check the default python version after installing python33, you will see that the default version is still the same:
|
||||
|
||||
$ python --version
|
||||
|
||||
----------
|
||||
|
||||
Python 2.6.6
|
||||
|
||||
If you want to try an installed SCL package, you need to explicitly enable it "on a per-command basis" using scl:
|
||||
|
||||
$ scl enable <scl-package-name> <command>
|
||||
|
||||
For example, to enable python33 package for python command:
|
||||
|
||||
$ scl enable python33 'python --version'
|
||||
|
||||
----------
|
||||
|
||||
Python 3.3.2
|
||||
|
||||
If you want to run multiple commands while enabling python33 package, you can actually create an SCL-enabled bash session as follows.
|
||||
|
||||
$ scl enable python33 bash
|
||||
|
||||
Within this bash session, the default python will be switched to 3.3 until you type exit and kill the session.
|
||||
|
||||
![](https://c2.staticflickr.com/6/5642/23491549632_1d08e163cc_c.jpg)
|
||||
|
||||
In short, the SCL is somewhat similar to the virtualenv of Python, but is more general in that you can enable/disable SCL sessions for a far greater number of applications than just Python.
|
||||
|
||||
For more detailed instructions on the SCL, refer to the official [quick start guide][2].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/enable-software-collections-centos.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/nanni
|
||||
[1]:https://www.softwarecollections.org/
|
||||
[2]:https://www.softwarecollections.org/docs/
|
@ -0,0 +1,106 @@
|
||||
如何在CentOS上启用Software Collections(SCL)
|
||||
================================================================================
|
||||
|
||||
红帽企业版linux(RHEL)和它的社区版分支——CentOS,提供10年的生命周期,这意味着RHEL/CentOS的每个版本会提供长达10年的安全更新。虽然这么长的生命周期为企业用户提供了更需要的系统兼容性和可靠性,但也存在一个缺点:随着底层的RHEL/CentOS版本接近生命周期的结束,核心应用和运行时环境变得陈旧过时。例如CentOS 6.5,它的生命周期结束时间是2020年11月30日,携带Python 2.6.6和MySQL 5.1.73,以今天的标准来看已经非常古老了。
|
||||
|
||||
另一方面,在RHEL/CentOS上试图手动升级开发工具链和运行时环境存在潜在的可能使系统崩溃,除非所有依赖都被正确解决。通常情况下,手动升级都是不推荐的,除非你知道你在干什么。
|
||||
|
||||
[Software Collections][1](SCL)源出现了,以帮助解决RHEL/CentOS下的这种问题。SCL的创建就是为了给RHEL/CentOS用户提供一种方式以方便、安全地安装和使用应用程序和运行时环境的多个(而且可能更新的)版本,同时避免把系统搞乱。与之相对的是第三方源,它们可能会在已安装的包之间引起冲突。
|
||||
|
||||
最新的SCL提供:
|
||||
|
||||
- Python 3.3 和 2.7
|
||||
- PHP 5.4
|
||||
- Node.js 0.10
|
||||
- Ruby 1.9.3
|
||||
- Perl 5.16.3
|
||||
- MariaDB 和 MySQL 5.5
|
||||
- Apache httpd 2.4.6
|
||||
|
||||
在这篇教程的剩余部分,我会展示一下如何配置SCL源,以及如何安装和启用SCL中的包。
|
||||
|
||||
### 配置SCL源
|
||||
|
||||
SCL可用于CentOS 6.5及更新的版本。要配置SCL源,只需执行:
|
||||
|
||||
$ sudo yum install centos-release-SCL
|
||||
|
||||
要启用和运行SCL中的应用,你还需要安装下列包:
|
||||
|
||||
$ sudo yum install scl-utils-build
|
||||
|
||||
执行下面的命令可以查看SCL中可用包的完整列表:
|
||||
|
||||
$ yum --disablerepo="*" --enablerepo="scl" list available
|
||||
|
||||
![](https://c2.staticflickr.com/6/5730/23304424250_f5c8a09584_c.jpg)
|
||||
|
||||
### 从SCL中安装和启用包
|
||||
|
||||
既然你已配置好了SCL,你可以继续并从SCL中安装包了。
|
||||
|
||||
你可以搜索SCL中的包:
|
||||
|
||||
$ yum --disablerepo="*" --enablerepo="scl" search <keyword>
|
||||
|
||||
我们假设你要安装Python 3.3。
|
||||
|
||||
继续,就像通常安装包那样使用yum安装:
|
||||
|
||||
$ sudo yum install python33
|
||||
|
||||
任何时候你都可以查看从SCL中安装的包的列表,只需执行:
|
||||
|
||||
$ scl --list
|
||||
|
||||
----------
|
||||
|
||||
python33
|
||||
|
||||
SCL的优点之一是安装其中的包不会覆盖任何系统文件,并且保证了不会引起系统中其它库和应用的冲突。
|
||||
|
||||
例如,若果在安装python33包后检查默认的python版本,你会发现默认的版本并没有改变:
|
||||
|
||||
$ python --version
|
||||
|
||||
----------
|
||||
|
||||
Python 2.6.6
|
||||
|
||||
如果想使用一个已经安装的SCL包,你需要在每个命令中使用scl命令显式启用它(译注:即想在哪条命令中使用SCL中的包,就得通过scl命令执行该命令)
|
||||
|
||||
$ scl enable <scl-package-name> <command>
|
||||
|
||||
例如,要针对python命令启用python33包:
|
||||
|
||||
$ scl enable python33 'python --version'
|
||||
|
||||
----------
|
||||
|
||||
Python 3.3.2
|
||||
|
||||
如果想在启用python33包时执行多条命令,你可以像下面那样创建一个启用SCL的bash会话:
|
||||
|
||||
$ scl enable python33 bash
|
||||
|
||||
在这个bash会话中,默认的python会被切换为3.3版本,直到你输入exit,退出会话。
|
||||
|
||||
![](https://c2.staticflickr.com/6/5642/23491549632_1d08e163cc_c.jpg)
|
||||
|
||||
简而言之,SCL有几分像Python的虚拟环境,但更通用,因为你可以为远远更多的应用启用/禁用SCL会话,而不仅仅是Python。
|
||||
|
||||
更详细的SCL指南,参考官方的[快速入门指南][2]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://xmodulo.com/enable-software-collections-centos.html
|
||||
|
||||
作者:[Dan Nanni][a]
|
||||
译者:[bianjp](https://github.com/bianjp)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://xmodulo.com/author/nanni
|
||||
[1]:https://www.softwarecollections.org/
|
||||
[2]:https://www.softwarecollections.org/docs/
|
Loading…
Reference in New Issue
Block a user