How to configure environment variables in CentOS 7?

To set up environment variables on CentOS 7, you can follow these steps:

  1. Open the ~/.bashrc file using any text editor.
  2. Open the .bashrc file by using the command vi ~/.bashrc.
  3. Add the necessary environment variables at the end of the file, such as adding /usr/local/bin to the PATH variable.
  4. Add /usr/local/bin to the existing PATH variable.
  5. Save and close the file.
  6. Execute the following command to apply the configuration:
  7. Execute the .bashrc file.
  8. Check if the environment variables have been successfully configured by running the following command to view the value of the PATH variable:
  9. Print out the value of the PATH variable.
  10. If you see the added environment variables, it means the configuration was successful.

Please note that if you want to configure environment variables for all users, you can use the /etc/profile file, but modifying this file requires root permission.

bannerAds