Permanently enable a SCL
32,971
Solution 1
using scl enable
actually opens a new shell inside your current one, which is quite unclean, especially if done from a login script.
You should place, instead, in your ~/.bash_profile
:
source /opt/rh/rh-nginx18/enable
or:
source scl_source enable rh-nginx18
The latter is more "elegant" as it is independent from the actual installation path.
This has the effect of loading the environment in your current shell.
Solution 2
Redhat proposes placing a file in /etc/profile.d
, i.e. for python:
$ cat /etc/profile.d/enablepython33.sh
#!/bin/bash
source scl_source enable python33
As this works for the devtools under centos for me you could try this.
Related videos on Youtube
![Odyss3us](https://i.stack.imgur.com/fixLI.jpg?s=256&g=1)
Author by
Odyss3us
Updated on September 18, 2022Comments
-
Odyss3us almost 2 years
Is there a way that I can permanently enable a SCL?
I've installed
rh-php56
, and I would like to make sure that it is loaded every time I ssh into my machine.I am currently running CentOS 7.
-
Michael Hampton over 6 yearsOne problem with this is that your resulting bash is no longer a login shell. And you can't make it a login shell. If you try, you'll fork bomb your system. This may work in some circumstances, but it's not the recommended method.
-
Jarrett Meyer almost 6 yearsThis is what I do. I've created an
/etc/profile.d/scl_enable.sh
file with all of my scl files in that one file. -
Lance Kind almost 5 yearsCAREFUL! Adding an scl command like the above just got me a "frozen" login because the script got stuck for some reason. Have this page for a handy reference for when you get locked out: serverfault.com/questions/94503/…
-
Dan Vatca over 4 yearsThe accepted response is DANGEROUS, and should be somehow demoted or removed. Adding this so maybe people will notice it before forkbombing themselves :)
-
Michael Chourdakis over 3 yearsThis fork bombed me and should be instantly removed.
-
retgoat over 2 yearsthis also works on amazon linux Linux ip-10-1-129-214 4.14.238-125.422.amzn1.x86_64 #1 SMP Tue Jul 20 20:51:46 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux