You know how to set the variable in a shell, but for the record you can write:
and all programs you start from this shell session after that will have the variable set.
If you want it to be set for every shell you start afterwards, add that line to
~/.profile as well. In that case it will apply to all future shells you start, but not any that are currently running.
.profile will generally work for the GUI as well, but that can be broken by system configuration and how you start things up. This is per-user configuration only.
If you want it set for every user all the time, you can add an assignment to
/etc/environment. The format is a little different there: just
KEY=VAL on separate lines, with no required quoting and none of anything else.
This is parsed by the
pam_env module. There is a per-user
~/.pam_environment file as well, which has the same effect for just the one user. These both require logging out and back in for the change to take effect. The variables will be set for every future login session, both at the console and in X.
Similarly, you can make a file in
/etc/profile.d with an
export statement in it and it will be loaded into every future session by any user. There will likely be some pre-existing files there to model it on, but just the
export line above will be fine.
Alternatively, you can add the
export statement in
~/.xinitrc (if you use
~/.xprofile. KDE also supports a directory
~/.kde/env that can contain as many shell files as you want, which contain
export statements as above. I would probably prefer one of the other approaches.