1、获取系统环境路径
[root@centos ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
2、修改 ~/.bash_profile,在最后添加环境变量
[root@centos ~]# cd ~
[root@centos ~]# vim ~/.bash_profile
### 在底部加上上面获取的路径
export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
:wq #保存退出
3、执行source ~/.bash_profile
[root@centos ~]# source ~/.bash_profile
### 成功解决报错 -bash:***: command not found