1、添加脚本到etc/profile.d
在/etc/profile.d
目录中存放的是一些应用程序所需的启动脚本,/etc/profile.d
下的脚本之所以能自动执行,是因为在/etc/profile
中有一个for
循环语句来调用这些脚本
# vi /etc/profile.d/my_env.sh
以gitlab
的路径环境变量设置为例
#/etc/profile.d/my_env.sh
#GITLAB_HOME
export GITLAB_HOME=/data/docker-gitlab
2、直接到/etc/profile
文件里面添加
export GITLAB_HOME=/data/docker-gitlab
想要知道更详细的,自行查询 etc/profile
VS /etc/profile.d