[CentOS] how to set/add environment variables and make file search priority on centos

Tue Jul 5 05:32:43 UTC 2016
ken <gebser at mousecar.com>

On 07/04/2016 10:01 AM, qw wrote:
> Hi,
> I'm using centos 6.8. In order to build gstreamer 1.8.2, I install some new packages, such as python 2.7 and yasm. And cerbero is the build system for gstreamer, and downloads some new packages from network and build them, such libtool, glib.
> All new packages are downloaded, built and installed in my custom directory.
> I want cerbero use the new packages in my custom directory. It mean that, linux will search my custom directory first, and will search others if target program or lib is not found.
> How to make search priority for programs, static libs, shared libs, and pkgconfig files?
> Thanks!
> Regards
> Andrew

Put the line

export PATH=/path/to/packages;${PATH}

into ~/.bashrc to change the path just for that user and/or into 
/etc/bashrc for everyone on the system.  The user would then need to 
relogin to kick off ~/.bashrc or rebooting will get it for the 
/etc/bashrc file.

Alternatively, run the same command in a shell for the new path to be 
effective in that shell immediately but just for that session.