What are the steps for configuring environment variables in CentOS 7?

The steps to configure environment variables in CentOS 7 are as follows:

  1. Open the terminal and log in to the CentOS 7 system.
  2. Open the ~/.bashrc file using a text editor, such as vi or nano. You can open the file using the following command:
vi ~/.bashrc
  1. Add the desired environment variables at the end of the file, for example:
export PATH=$PATH:/usr/local/bin
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.191.b12-1.el7_6.x86_64
export MAVEN_HOME=/usr/share/maven

Make sure to set the PATH variable to the original value plus the new path.

  1. Save and close the file. Press the Esc key in the vi editor, type :wq, and then press Enter to save and close the file.
  2. To activate the new environment variable, use the following command:
source ~/.bashrc
  1. Check if the environment variables have been set successfully. You can view the values of the environment variables using the following command:
echo $JAVA_HOME
echo $MAVEN_HOME

If the output matches the value you have set, it indicates that the environment variable has been successfully configured.

  1. You can now use the new environment variable in the system.

More tutorials

Comprehending Java’s Data Types(Opens in a new browser tab)

Reading and Writing data using Python(Opens in a new browser tab)

How can I check the data storage location of Redis?(Opens in a new browser tab)

How to set up a C++ environment in Visual Studio Code?(Opens in a new browser tab)

How to set up a C++ environment in Visual Studio Code?(Opens in a new browser tab)

How to create a cpp file in vscode?(Opens in a new browser tab)

Leave a Reply 0

Your email address will not be published. Required fields are marked *