How to Set Environment Variable in Ubuntu
I need to set LD_LIBRARY_LIB path into Ubuntu Environment Variable, but i cant find ~/.bash_profile in Ubuntu? I issue following command to search through whole file system
sudo find / -name .bash_profile
It return me nothing, hmm… it seem Ubuntu do not have ~/.bash_profile like other Linux distribution version. It left me no choice but set environment variable in /etc/profile.
Here i provide two ways to set environment variable in /etc/profile
1) su to root and Issue following command
echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/postgresql/8.3/lib;" >> /etc/profile
2) VI to edit /etc/profile
Append “export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/postgresql/8.3/lib;” to end of the /etc/profile content (after what unmask xxx).
After modified /etc/profile, hit CTRL+ALT+Backspace to restart x windows to take effect.
P.S user also can append export into .bashrc to set environment variable in linux
cd ~ vim .bashrc