GitLab 11.1.4 修改默认仓库目录

12,068次阅读
2 条评论

共计 2528 个字符,预计需要花费 7 分钟才能阅读完成。

[root@izuf6fy69k7l7e20jogcj7z ~]# ll /var/opt/gitlab/git-data/
total 4
drwxrws--- 2 git root 4096 Aug 20 09:28 repositories

1、首先创建自定义存放目录git-data:mkdir /git-data

[root@izuf6fy69k7l7e20jogcj7z ~]# mkdir /git-data
[root@izuf6fy69k7l7e20jogcj7z ~]# ll /
total 68
lrwxrwxrwx    1 root root     7 Aug 17 14:17 bin -> usr/bin
dr-xr-xr-x.   5 root root  4096 Aug 20 00:48 boot
drwxr-xr-x    2 root root  4096 Aug 20 00:38 data
drwxr-xr-x   19 root root  2980 Aug 20 01:03 dev
drwxr-xr-x.  82 root root  4096 Aug 20 01:02 etc
drwxr-xr-x    2 root root  4096 Aug 20 21:59 git-data
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 home
lrwxrwxrwx    1 root root     7 Aug 17 14:17 lib -> usr/lib
lrwxrwxrwx    1 root root     9 Aug 17 14:17 lib64 -> usr/lib64
drwx------.   2 root root 16384 Oct 15  2017 lost+found
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 media
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 mnt
drwxr-xr-x.   3 root root  4096 Aug 19 22:32 opt
dr-xr-xr-x  153 root root     0 Aug 20 01:03 proc
dr-xr-x---.   6 root root  4096 Aug 20 17:45 root
drwxr-xr-x   24 root root   640 Aug 20 13:32 run
lrwxrwxrwx    1 root root     8 Aug 17 14:17 sbin -> usr/sbin
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 srv
dr-xr-xr-x   13 root root     0 Aug 20 09:03 sys
drwxrwxrwt.  10 root root  4096 Aug 20 17:46 tmp
drwxr-xr-x.  13 root root  4096 Aug 17 14:17 usr
drwxr-xr-x.  19 root root  4096 Aug 17 14:17 var

2、配置git-data目录属主和属组为git:chown git.git /git-data/

[root@izuf6fy69k7l7e20jogcj7z ~]# chown git.git /git-data/
[root@izuf6fy69k7l7e20jogcj7z ~]# ll /
total 68
lrwxrwxrwx    1 root root     7 Aug 17 14:17 bin -> usr/bin
dr-xr-xr-x.   5 root root  4096 Aug 20 00:48 boot
drwxr-xr-x    2 root root  4096 Aug 20 00:38 data
drwxr-xr-x   19 root root  2980 Aug 20 01:03 dev
drwxr-xr-x.  82 root root  4096 Aug 20 01:02 etc
drwxr-xr-x    2 git  git   4096 Aug 20 21:59 git-data
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 home
lrwxrwxrwx    1 root root     7 Aug 17 14:17 lib -> usr/lib
lrwxrwxrwx    1 root root     9 Aug 17 14:17 lib64 -> usr/lib64
drwx------.   2 root root 16384 Oct 15  2017 lost+found
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 media
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 mnt
drwxr-xr-x.   3 root root  4096 Aug 19 22:32 opt
dr-xr-xr-x  153 root root     0 Aug 20 01:03 proc
dr-xr-x---.   6 root root  4096 Aug 20 17:45 root
drwxr-xr-x   24 root root   640 Aug 20 13:32 run
lrwxrwxrwx    1 root root     8 Aug 17 14:17 sbin -> usr/sbin
drwxr-xr-x.   2 root root  4096 Apr 11 12:59 srv
dr-xr-xr-x   13 root root     0 Aug 20 09:03 sys
drwxrwxrwt.  10 root root  4096 Aug 20 17:46 tmp
drwxr-xr-x.  13 root root  4096 Aug 17 14:17 usr
drwxr-xr-x.  19 root root  4096 Aug 17 14:17 var

3、编辑修改配置文件/etc/gitlab/gitlab.rb中的git_data_dirs参数来自定义仓库路径

###!   path that doesn't contain symlinks.**
git_data_dirs({
  "default" => { "path" => "/git-data" }
})

[v_blue]配置后需执行命令gitlab-ctl reconfigure重载配置文件[/v_blue]
4、重新配置后GitLab会在自定义仓库目录中自动创建一个repositories目录,表示配置成功。

[root@izuf6fy69k7l7e20jogcj7z ~]# ll /git-data/
total 4
drwxrws--- 2 git root 4096 Aug 20 22:26 repositories

正文完
 0
Yvan
版权声明:本站原创文章,由 Yvan 于2018-08-06发表,共计2528字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
评论(2 条评论)
Andy_wang 评论达人 LV.1
2018-09-10 14:10:50 回复

请问是否有修改gitlab 11.1.4 的默认安装目录方法?默认是在根目录,我想修改安装到/data 下面,请各位大神给与帮助

 Windows  Chrome  中国广东省深圳市电信
    yvan 博主
    2018-09-10 19:14:15 回复

    @Andy_wang 从官方资料上显示官方是推荐YUM自动安装和基于软件包手动安装这两种方式的,这两种方式都没法自定义安装目录的。你的需求只能用源码安装方式来实现,官方参考地址:https://docs.gitlab.com/ce/install/installation.html

     Windows  Chrome  中国江苏省苏州市联通