Linux Classroom Series – 21/Jul/2020

Setting Environmental Variable Path

  • Lets try to install software terraform which is used by user ironman
  • Lets try to install software packer which is used by user thor
  • Lets try to install software java 8 which should be used by both the user
  • After downloading terraform, unable to run command Preview
  • So lets add the folder of terraform to the path using export command Preview
  • Now i will logout of ironman, login & recheck & this fails
  • So let create a file
echo 'export PATH=$PATH:/home/ironman/bin' > ~/.bash_profile
  • Now logout & relogin & execute
printenv PATH
terraform --version


  • Now lets do the samething for packer for thor
echo 'export PATH=$PATH:/home/thor/bin' > ~/.bash_profile
# relogin
packer --version
  • Packer can be downloaded from here & Terraform from here
  • Now lets install Java 8
sudo apt-get install openjdk-8-jdk -y
  • Java can be used by all the users as java executable is added to folder which is in path for all the linux users.
  • Now lets assume on the same machine ironman wants java 11 & all other users want java 8
sudo apt-get install openjdk-11-jdk -y


  • All the users got JAVA 11, now how to solve this problem. If use ENVIRONMENTAL variable called as JAVA_HOME, the problem can be solved
    • Add the following lines to /etc/profile
    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    export PATH=$JAVA_HOME/bin:$PATH
    • Add the following lines to /home/ironman/.bash_profile
    export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
    export PATH=$JAVA_HOME/bin:$PATH

Preview Preview Preview Preview

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin