Page 2 of 2 FirstFirst 12
Results 11 to 17 of 17

Thread: Set Permanent Environmental Variables 12.04LTS

  1. #11
    Join Date
    Jul 2009
    Location
    Netherlands
    Beans
    136
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set Permanent Environmental Variables 12.04LTS

    Quote Originally Posted by Vaphell View Post
    default config adds ~/bin (if it exists) to $PATH automatically either way (~/.profile)
    Hey i didn't know that since which Ubuntu version because i have done this since 8.04?

  2. #12
    Join Date
    Dec 2007
    Location
    Idaho
    Beans
    4,976
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Set Permanent Environmental Variables 12.04LTS

    My understanding is system wide environment variables are actually "supposed" to go in /etc/environment in Ubuntu. User only enviroment variables should go in ~/.pam_environment

    see this documentation https://help.ubuntu.com/community/EnvironmentVariables

    It's a long story but some variables get reset if they are in the places others have mentioned, I ran into this specifically with a variable related to getting minecraft to work on a 64 bit machine.
    "You can't expect to hold supreme executive power just because some watery tart lobbed a sword at you"

    "Don't let your mind wander -- it's too little to be let out alone."

  3. #13
    Join Date
    Jul 2009
    Location
    Netherlands
    Beans
    136
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set Permanent Environmental Variables 12.04LTS

    Quote Originally Posted by jerome1232 View Post
    My understanding is system wide environment variables are actually "supposed" to go in /etc/environment in Ubuntu. User only enviroment variables should go in ~/.pam_environment
    He said to have tried that and didn't work.

  4. #14
    Join Date
    Dec 2007
    Location
    Idaho
    Beans
    4,976
    Distro
    Ubuntu 20.04 Focal Fossa

    Re: Set Permanent Environmental Variables 12.04LTS

    That's what I get for skimming, my bad.
    "You can't expect to hold supreme executive power just because some watery tart lobbed a sword at you"

    "Don't let your mind wander -- it's too little to be let out alone."

  5. #15
    Join Date
    Oct 2012
    Beans
    2

    Re: Set Permanent Environmental Variables 12.04LTS

    1. Create a file custom.sh in the folder /etc/profiled.d with the required commands .

    sudo vi /etc/profile.d/custom.sh

    In place of vi you can use gedit / nedit or the like

    In your case custom.sh will have the following lines:
    export NETKIT_HOME=~/netkit
    export PATH=$PATH:$NETKIT_HOME/bin
    export MANPATH=:$NETKIT_HOME/man

    2.Make the file executable
    command : chmod +x custom.sh

    3.Now these variables are permanently available. To remove them either eit the file or remove the file itself.

    4.I use this approach in RHEL and it works flawlessly
    Last edited by asaleemsajid; October 28th, 2012 at 02:57 PM.

  6. #16
    Join Date
    Apr 2011
    Location
    Maryland
    Beans
    1,461
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Set Permanent Environmental Variables 12.04LTS

    Quote Originally Posted by madinc View Post
    Hey i didn't know that since which Ubuntu version because i have done this since 8.04?
    Not sure since when exactly, but it's outlined in your ~/.profile file by default:

    Code:
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
    fi
    As mcduck says, you're best off putting the extra paths in .profile if you want them system wide, while just putting them in .bashrc would suffice if you only need them in bash shells.

    EDIT: Also should point out that if you create ~/bin and want it to become part of your path, all you need to do is to logout and log back on, or simply reload your shell:

    Code:
    source ~/.bashrc

  7. #17
    Join Date
    Jul 2009
    Location
    Netherlands
    Beans
    136
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Set Permanent Environmental Variables 12.04LTS

    Quote Originally Posted by drmrgd View Post
    Not sure since when exactly, but it's outlined in your ~/.profile file by default:

    EDIT: Also should point out that if you create ~/bin and want it to become part of your path, all you need to do is to logout and log back on, or simply reload your shell:
    Thank's it's always good to know.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •