To add the path /usr/local/lib
to the dynamic (shared) link library path list on a Debian 12 x64 system, you can do it either temporarily for the current session or permanently for all sessions. Here are the steps for both methods:
Temporary Method (for the current session)
- Open a terminal.
- Run the following command to temporarily add
/usr/local/lib
to theLD_LIBRARY_PATH
environment variable:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
This change will last only for the current session. Once you log out or close the terminal, it will be reset.
Permanent Method (system-wide)
To make the change permanent for all users, you need to add the path to the dynamic linker configuration. Here’s how:
- Create a new configuration file:
- Open a terminal and create a file in
/etc/ld.so.conf.d/
to add the custom library path:
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/local-lib.conf
- Update the linker cache:
- After adding the new path, update the dynamic linker run-time bindings by running:
sudo ldconfig
This will make the system aware of the new library path for shared libraries, and the change will persist across reboots and for all users.
Verifying the Change
You can verify the change by checking if /usr/local/lib
is part of the system’s library paths:
ldconfig -v | grep /usr/local/lib
If the path appears in the output, the configuration has been applied correctly.