永久启用 SCL

Ody*_*3us 21 centos centos7 php56 scl

有什么方法可以永久启用 SCL?

我已经安装了rh-php56,我想确保每次 ssh 到我的机器时都加载了它。

我目前正在运行 CentOS 7。

小智 43

usingscl enable实际上在当前的 shell 中打开了一个新的 shell,这是非常不干净的,特别是如果从登录脚本完成。

你应该把,而不是,在你的~/.bash_profile

source /opt/rh/rh-nginx18/enable
Run Code Online (Sandbox Code Playgroud)

或者:

source scl_source enable rh-nginx18
Run Code Online (Sandbox Code Playgroud)

后者更“优雅”,因为它独立于实际安装路径。

这具有在当前shell中加载环境的效果。


ted*_*ted 18

Redhat 建议在 中放置一个文件/etc/profile.d,即对于 python:

$ cat /etc/profile.d/enablepython33.sh
#!/bin/bash
source scl_source enable python33
Run Code Online (Sandbox Code Playgroud)

因为这对我来说适用于 centos 下的 devtools,所以你可以试试这个。

  • 这就是我所做的。我已经创建了一个 `/etc/profile.d/scl_enable.sh` 文件,其中包含我所有的 scl 文件。 (3认同)