Is there a way to Install gitlab to different directory


Does gitlab support a way to specify the directory where it should be installed ?
or maybe is there a workaround for that ?

Thanks in advance

1 Like


If using the omnibus packages, then this will default to /opt/gitlab for the binaries, and /var/opt/gitlab for the data. In /etc/gitlab/gitlab.rb there are a load of entries for “/var/opt/gitlab” which you could potentially change to a different location. Whether you should or not is another thing.

The better way would be to mount /var/opt to the partition that you allocate a load of disk space to, and then install Gitlab at this point. That is what I would do.

I have experienced problems mounting a partition to /var/opt/gitlab, because then problems will occur when you attempt to delete Gitlab, since it cannot remove /var/opt/gitlab then as it will be a utilised mount point. I have had this with a test server, and thus this is why I recommend mounting to /var/opt instead. That way, when deleting in the future for example, /var/opt/gitlab will be deleted, but /var/opt as a mount point will remain.

I’ve never tried editing /etc/gitlab/gitlab.rb to change the directories to something else other than /var/opt/gitlab, but I expect it would be highly problematic, if installing packages would by default be relying on this location. This is why I recommend using a mount point to /var/opt as the solution.

Technically you could compile from source, and I would expect you would have more flexibility then to choose where you want things to be built and installed.


changing the default paths will make support more complicated, as it is not expected. I don’t recommend changing the layout, as it has proven to be reliable on upgrades and further maintenance. This runs through QA and ensures the packages & charts can be installed and trusted by many users.

What’s the reason to change the target directory?


I agree that it’s probably a bad idea.

But as source installs use different paths from omnibus install, I guess most features just work if you succeed. I’ve never tried doing a source install, but I imagine that would make changing paths easier. But it is a pretty bad reason to choose doing a source install.

I don’t know how other package managers do it, but with Debian packages (and I suspect it’s the same with others, but as said I don’t know them) you can’t change the paths the package uses on installation (those paths were chosen when the package was build).

But in almost all cases it’s a bad idea, and there are better ways (mounting a partition is a good example) of solving your real issue.