Add environment variables to centos 7 and environment variables to centos

Source: Internet
Author: User
Tags tty mode

Add environment variables to centos 7 and environment variables to centos

To configure environment variables in centos 7, you do not need to run the command source after each boot:

The environment variables configured previously Add a path after/etc/profile, but after each startup, the source/etc/profile command can be used. You can use the following methods directly:

 

Edit the/etc/environment file and change the PATH environment variable.
For example, add/soft/jdk/bin to the environment variable.

JAVA_HOME =/soft/jdk

PATH =/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/soft/jdk/bin

 

Save and remember source/etc/environment. You do not need source after restarting.


Note: The/etc/environment file has not been used before. It may be empty. Make sure to write the existing environment variables in the preceding format, then add the path to be added to the backend.
Otherwise, the system may fail to log on to the operating system. If logon fails, you can log in to the system in tty mode to modify the etc/environment file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.