Ubuntuで環境変数を設定する方法

Ubuntuで環境変数を設定する方法

LD_LIBRARY_LIBパスをUbuntu環境変数に設定する必要がありますが、Ubuntuで〜/ .bash_profileを見つけることができませんか? 次のコマンドを発行して、ファイルシステム全体を検索します。

sudo find / -name .bash_profile

それは私に何も返しません、うーん…Ubuntuには他のLinuxディストリビューションバージョンのような〜/ .bash_profileがないようです。 / etc / profileに環境変数を設定するしかありませんでした。

ここで、/ etc / profileで環境変数を設定する2つの方法を提供します

1)suをルートに移動し、次のコマンドを発行します

  echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/lib/postgresql/8.3/lib;" >> /etc/profile

2) VI to edit /etc/profile
「exportLD_LIBRARY_PATH = / usr / local / lib:/usr/lib/postgresql/8.3/lib;」を追加します。 / etc / profileコンテンツの終わりまで(xxxのマスクを解除した後)。

/ etc / profileを変更した後、Ctrl + Alt + Backspaceを押してxウィンドウを再起動し、有効にします。

P.S user also can append export into .bashrc to set environment variable in linux

cd ~
vim .bashrc