1、方法一:用户级环境变量设置
1、打开操作终端,执行 ls ~/.bash_profile 目的是查看~/.bash_profile文件存不存在,如果不存在,则执行命令: touch ~/.bash_profile
2、执行命令:vim ~/.bash_profile ,输入以下内容
if [ -f /etc/bash_profile ]; then
./etc/bash_profile
fi
export PATH=$PATH:你要配置的环境变量路径
export PS1 ="\[\e[32;1m\]\u@\w:>\[\e[0m\]"
3、vim退出并保存后,执行 source ~/.bash_profile
2、方法二:系统级环境变量设置
1、打开命令端,执行: vim /etc/profile
2、在profile文件末尾添加: export PATH=$PATH:你要配置的环境变量路径
参考网址:
http://www.cnblogs.com/jiaxiaoai/archive/2011/05/22/2053738.html
http://blog.youkuaiyun.com/zhouyong0/article/details/8005520
http://www.cnblogs.com/undead/p/3741764.html