Error in installing gitlab 10.6.2 on ubuntu & debian systems

Summary

Tried to install gitlab 10.6.2 via omnibus but it failed on postgres. Though install via docker works perfectly fine

Steps to reproduce

Follow the official guide on how to install on ubuntu & debian

Example Project

NA

What is the current bug behavior?

Gitlab fails to install

What is the expected correct behavior?

Gitlab should be installed fine

Relevant logs and/or screenshots

[2018-03-31T22:21:23+00:00] ERROR: Exception handlers complete
[2018-03-31T22:21:23+00:00] FATAL: Stacktrace dumped to /opt/gitlab/embedded/cookbooks/cache/chef-stacktrace.out
[2018-03-31T22:21:23+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2018-03-31T22:21:23+00:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[/opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8] (gitlab::postgresql line 80) had an error: M$
---- Begin output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
STDOUT: The files belonging to this database system will be owned by user "gitlab-psql".
This user must also own the server process.
STDERR: initdb: invalid locale settings; check LANG and LC_* environment variables
---- End output of /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 ----
Ran /opt/gitlab/embedded/bin/initdb -D /var/opt/gitlab/postgresql/data -E UTF8 returned 1

Possible fixes

Issue is because of LANG and LC_* variables which are sometimes unset in the linux system, in omnibus installation we can set these variables

LC_ALL="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"

After setting these variables installation works just fine. (If you can, link to the line of code that might be responsible for the problem)