How to install Gitlab 5.0 on CentOS 6 or RHEL6

Last modified: 2013-08-20 @ 09:08:13

I’ve been eagerly waiting for Gitlab 5.0 to be released so that Gitolite dependency would go away. Well a few days ago I got my wish. I followed the documentation provided by the Gitlab guys at https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md  and as expected it didn’t quite match up with what needs to be done to deploy on CentOS 6. It is after all written for Ubuntu. These instructions should also work for Redhat Enterprise 6 and are meant for a fresh installation. Not an upgrade.

Using the official document as a guide I managed to get things deployed on my system and now I’m going to share it with you.

I installed Gitlab 5.0 on CentOS 6.4 64-bit and used MySQL as my database back end and configured my existing Apache deployment to proxy connections to Gitlab. I also installed it under a custom user account and not the default ‘git’ account that the Gitlab documentation tells you to use.

I’m going to assume you already have a CentOS server up and running, SELinux is disabled, you aren’t using a firewall (iptables), the default CentOS Python 2.6 packages installed and Sendmail or Postfix up and running.

If you are running a Minimal Install of CentOS 6 see Olav’s comment below.

Unfortunately the version of Ruby that comes with CentOS 6 is to old for Gitlab so we need to compile that from source. The method I use will install the latest version of Ruby. If you have the CentOS Ruby packages installed it shouldn’t matter. These instructions should allow you to run both versions.

  1. Install the development tools necessary to compile applications from source

     
  2. Install missing dependencies  I believe this is all of them. If anything is missing drop me a comment and I’ll update this guide.

     
  3. Start redis and enable it on boot

     
  4. Create a new user account that we’ll run Gitlab under. I’m going to use ‘sa_gitlab’. Gitlab will be deployed in it’s home directory. On my server I want that to be in ‘/data/apps’ instead of ‘/home’

     
  5. Become the ‘sa_gitlab’ user and setup the ‘authorized_keys’ list and generate Gitlabs private key

     
  6. Create a ‘temp’ dir for us to work with and a ‘ruby’ dir for Ruby to be installed into. Then download, configured and install Ruby 1.9.3

     
  7. Download, compile and install the latest version of git

     
  8. Add the new installation of Ruby to the ‘sa_gitlab’ users PATH so you can use our complied version of Ruby. Also my CentOS came with an old version of bundle installed by default which is to old. We’ll create an alias in the sa_gitlab users bash profile to reference our compiled version of ‘bundle’

     
  9. Install bundler

     
  10. Download gitlab-shell

     
  11. Configure gitlab-shell and install it

     
  12. Create yourself a MySQL database on your server and a dedicated user account with full access to it.
  13. Download Gitlab 5.0

     
  14. Edit the Gitlab configuration file

     
  15. Fix up some permissions

     
  16. Create the satellites directory and configure the database

     
  17. Install charlocks_holmes

     
  18. Setup the database structure, setup Gitlab and populate the database with default data. Yes one of the commands below says ‘postgres’ instead of ‘mysql’. Note the ‘–without’ in front of it

     
  19. Setup the Gitlab Init script. THis file requires a little bit of tweaking because I chose not to use the ‘git’ user. We also have to tell the script where to find our new version of bundle otherwise it will try to use the old version that comes with CentOS. The following is done as root

     
  20. Switch back to the Gitlab user and check if anything has gone wrong

     
  21. Finally if everything above worked out for you then Gitlab should be waiting for you at http://git.yourdomain.com:<PORT> where <PORT> is what we set back in step 14. If you’re happy with this then you’re done. Login with the default username and password (admin@local.host / 5iveL!fe) for Gitlab and start using it. If you’re already running a web server and couldn’t run Gitlab on standard web ports add the following to your Apache config to proxy connections from Apache to Gitlab

 

Once you’ve confirmed everything is working for you follow these instructions to run the whole thing over SSL. I’m going to assume you already have SSL certificates and mod_rewrite installed in Apache.

  1. Change the git-shell configuration to use https:// as the sa_gitlab user


  2. Alter your Apache config with these virtual hosts

     

That’s it! I hope I haven’t missed anything but if I have drop me a comment and I’ll update this post.

Update March 31st, 2013 – I’ve written an article on how to update Gitlab once you’ve gotten it installed. You can find it here.

Update April 23rd, 2013 – Gitlab 5.1 is out! If you’ve followed the above instructions you should have a functioning Gitlab 5.0 instance. To upgrade to Gitlab 5.1 head over to this article: How to upgrade Gitlab 5.0 to 5.1 on CentOS 6 or RHEL6

Update April 26th, 2013 – Fixed an error in step 16. I said to run ‘cd ~/’ and it should be ‘cd ~/gitlab’. Thank you Ronald for pointing that out.

Update April 28th, 2013 – There was an error with my curl command to grab the gitlab init script. I was getting it from the master branch instead of the 5.0 branch. In the latest master Gitlab has changed their init script in a way that it will not work with 5.0 deployments because they moved from unicorn to puma. I updated the URL so it grabs the 5.0 init script.

Update May 21st, 2013 – Added steps for downloading, compiling and installing the latest version of git for use with Gitlab. Resolves a bug I came across when using my original deployment instructions and the default version of git that comes with CentOS 6.

Update May 22nd, 2013 – Added step to modify gitlab/config/gitlab.yml to use the new version of git. I had assumed Gitlab got the location of the git binary from the PATH environmental variable.

 

References

 

105 thoughts on “How to install Gitlab 5.0 on CentOS 6 or RHEL6

  1. Thank you so much for this note.
    I follow these steps, and I got:

    Proxy Error
    The proxy server received an invalid response from an upstream server.
    The proxy server could not handle the request GET /users/sign_in.
    Reason: Error reading from remote server
    Apache/2.2.15 (Red Hat) Server at test-git Port 80

    I found that some error in Sidekiq log:

    2013-03-26T08:45:05Z 24896 TID-kkxd4 Sidekiq::Extensions::DelayedMailer JID-4f68ca166ba08dccba1393e9 INFO: start
    sh: /usr/sbin/sendmail: No such file or directory

    so what I did was:

    yum install postfix
    chkconfig postfix on
    service postfix start
    service gitlab restart
    service httpd restart

    Sidekiq seems ok:

    2013-03-26T09:06:04Z 26037 TID-etzs4 Sidekiq::Extensions::DelayedMailer JID-4f68ca166ba08dccba1393e9 INFO: start
    2013-03-26T09:06:06Z 26037 TID-etzs4 Sidekiq::Extensions::DelayedMailer JID-4f68ca166ba08dccba1393e9 INFO: done: 1.3 sec

    FYI :-)

  2. Hi.

    On step 16 i have a problem:

    [sa_gitlab@localhost ~]$  /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres
    Could not locate Gemfile

    Where is my mistake?

    Thanks!

  3. Hey Eric,

    on a minimal install of CentOS you should start with this:

    # rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

    … otherwise the packages for redis and libyaml-devel will not be found

    Also, it is probably a good idea to do a:

    yum -y groupinstall ‘Development Tools’

    … because besides everything you need to compile, glibc and glibc-devel will be installed. glibc is apparently a good replacement for iconv-devel… not?

    Thanks for the post!

    Olav

     

  4. Got a small issue on step 17, trying to start Sidekiq.I got “Could not locate Gemfile” error, because sudo sent me to ~, and not ~/gitlab/.

    I just add this to make it work : “cd $APP_ROOT && mkdir -p $PID_PATH && $START_SIDEKIQ  > /dev/null  2>&1 &”.

    Thank you for the help though, it was driven me crazy !

  5. One other correction: Step 6 line 10 you have a copy-pasta error. At first you edit .bash_profile, then  you meant to say edit .bashrc.

  6. Hi

    when I run command

    bundle exec rake gitlab:check RAILS_ENV=production

    i see error? can you fix this is?

    ——————

    $ bundle exec rake gitlab:check RAILS_ENV=production
    Warning
    You are running as user sa_gitlab, we hope you know what you are doing.
    Things may work/fail for the wrong reasons.
    For correct results you should run this as user git.

    Checking Environment …

    Git configured for git user? … yes
    Has python2? … yes
    python2 is supported version? … yes

    Checking Environment … Finished

    Checking Gitlab Shell …

    GitLab Shell version? … rake aborted!
    user git doesn’t exist
    /data/apps/sa_gitlab/gitlab/lib/tasks/gitlab/check.rake:537:in `expand_path’
    /data/apps/sa_gitlab/gitlab/lib/tasks/gitlab/check.rake:537:in `gitlab_shell_user_home’
    /data/apps/sa_gitlab/gitlab/lib/tasks/gitlab/check.rake:541:in `gitlab_shell_version’
    /data/apps/sa_gitlab/gitlab/lib/tasks/gitlab/check.rake:640:in `check_gitlab_shell’
    /data/apps/sa_gitlab/gitlab/lib/tasks/gitlab/check.rake:351:in `block (3 levels) in <top (required)>’
    Tasks: TOP => gitlab:check => gitlab:gitlab_shell:check
    (See full trace by running task with –trace)

     

     

    • Honestly not sure. It looks like it failed at detecting your GitLab Shell version. Is your path in the config file to GitLab Shell correct (Step 13)? and is your GitLab Shell configured correctly (Steps 9-10)?

  7.  

    hhlp pls step17

    [12:20] [sa_gitlab@gitlab gitlab] $ cd ~/
    [12:20] [sa_gitlab@gitlab ~] $ /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres
    Could not locate Gemfile

  8. after my previus post I am move to: cd gitlab –>and have this error

     

    [12:30] [sa_gitlab@gitlab ~] $ cd gitlab
    [12:32] [sa_gitlab@gitlab gitlab] $ /data/apps/sa_gitlab/ruby/bin/bundle exec rake gitlab:setup RAILS_ENV=production
    rake aborted!
    syntax error on line 25, col 6: ` user: sa_gitlab’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:103:in `initialize’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `new’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `instance’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:37:in `[]’
    /data/apps/sa_gitlab/gitlab/config/initializers/1_settings.rb:38:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing’
    /data/apps/sa_gitlab/gitlab/config/environment.rb:5:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require_with_backports’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks’
    Tasks: TOP => gitlab:setup => environment
    (See full trace by running task with –trace)

    • If you look at this line in the error

      syntax error on line 25, col 6: ` user: sa_gitlab’

      It looks to me like you’ve got a typo in your gitlab or gitshell config file where you specify the username your running the account under. I’d start there.

  9. [sa_gitlab@git gitlab]$ /data/apps/sa_gitlab/ruby/bin/bundle exec rake db:seed_fu RAILS_ENV=production

    == Seed from /data/apps/sa_gitlab/gitlab/db/fixtures/production/001_admin.rb
    rake aborted!
    Validation failed: Email has already been taken, Username has already been taken, Username already exist
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:46:in `eval’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/attribute_methods/dirty.rb:33:in `save!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:264:in `block in save!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:313:in `block in with_transaction_returning_status’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:311:in `with_transaction_returning_status’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:264:in `save!’
    (eval):11:in `block (2 levels) in run_file’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:46:in `eval’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:58:in `block in open’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:57:in `open’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:57:in `open’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:36:in `block in run_file’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/transactions.rb:208:in `transaction’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:35:in `run_file’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:26:in `block in run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:25:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu/runner.rb:25:in `run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/seed-fu.rb:29:in `seed’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/seed-fu-2.2.0/lib/tasks/seed_fu.rake:36:in `block (2 levels) in <top (required)>’
    Tasks: TOP => db:seed_fu
    (See full trace by running task with –trace)

    • That looks to me like your database has already been seeded. You can either clear out all the data in the database tables and re-run the command or skip it and continue with the documentation and see where you get.

  10. This is a great howto – thank you Eric!
    I have successfully set up the newest Gitlab on my brand new machine with CentOS 6.4 and Ruby 2.0.0 (installed previously with RVM).
    And it made me really happy. ;)

    • I’m glad this blog is helping people! I just put it up so I had something to show off if I ever went job hunting. For some odd reason you have to prove your relevant these days.

  11. Thanks a lot.

    But I found that following command cannot be executed. It always hints “Command not found”, but I can run it without sudo. Please tell me why.

    sudo -u $APPUSER -H bash <gem or bundle>

     

    • I would suspect that is because the command is trying to put files outside of the sa_gitlab users home directory. That would mean to me you missed a step somewhere.

  12. Hi Eric,,

    On Step 17, am getting the following error:

    /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres
    Fetching source index from https://rubygems.org/
    Fetching git://github.com/gollum/gollum.git
    github.com[0: 204.232.175.90]: errno=No route to host
    fatal: unable to connect a socket (No route to host)
    Git error: command `git clone ‘git://github.com/gollum/gollum.git’
    “/data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/cache/bundler/git/gollum-d0d1713a5a16a9ff8bde739bb1d48fab22f60878” –bare
    –no-hardlinks` in directory /data/apps/sa_gitlab/gitlab has failed.

    And yes am executing it in the gitlab directory.

    Since am behined a proxy server, i did pass the proxy info in git config and also via http_proxy.

    Thanks in advance and great tutorial

  13. Thanks Eric,

    Now the issue am facing is with even ssh sa_gitlab@localhost, if keeps asking for password and even via git push.

    i also noticed and when git remote add the path does not include repositories as without the “repositories” appended infront of the repo does not work, is there a way to fix that.

    Sorry am asking you as the forum help on gitlabhq is not much help

    THanks
    Vikash

  14. I have a feeling the authentication problem is related to something you might have missed in step 5. You should be able to repeat that step and see if it fixes the problem.

    As for the ‘repositories’ part of your question I don’t really understand what you mean.

  15. For the step 17. #1:
    /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres

    The bundle install just hangs after fetching and never finishes, even after hours:

    Fetching source index from https://rubygems.org/

    From Googling this appears to be a case where there is an unresolved gem dependency or very large search space which takes very long to resolve dependencies. Any advice on how to resolve this would be appreciated.

    Note that I am installing PostgreSQL instead of MySQL, but otherwise following the same installation scheme.

  16. I subsequently retried installation, following the instructions provided here for a mysql database. Still ends up hanging indefinitely on step 17. As shown below, fetches through raphael-rails and then just hangs with no further progress.

    Install is on a vagrant VM:

    Linux gitlab.local 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

    Command 17.1 that hangs:

    [sa_gitlab@gitlab gitlab]$ /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres
    Fetching source index from https://rubygems.org/
    Fetching https://github.com/gitlabhq/grit.git
    remote: Counting objects: 5328, done.
    remote: Compressing objects: 100% (2890/2890), done.
    remote: Total 5328 (delta 2563), reused 5057 (delta 2349)
    Receiving objects: 100% (5328/5328), 5.95 MiB | 635 KiB/s, done.
    Resolving deltas: 100% (2563/2563), done.
    Fetching git://github.com/gollum/gollum.git
    remote: Counting objects: 12877, done.
    remote: Compressing objects: 100% (5590/5590), done.
    Receiving objects: 100% (12877/12877), 5.01 MiB | 1.02 MiB/s, done.
    remote: Total 12877 (delta 7417), reused 12083 (delta 6744)
    Resolving deltas: 100% (7417/7417), done.
    Fetching https://github.com/gitlabhq/raphael-rails.git
    remote: Counting objects: 46, done.
    remote: Compressing objects: 100% (31/31), done.
    remote: Total 46 (delta 7), reused 45 (delta 6)
    Unpacking objects: 100% (46/46), done.

    • Well it turns out that the install using mysql did eventually finish the bundle install command after 45 minutes. I guess I can’t let past behavior be the guide for current when it comes to bundle install for gitlab. In my previous comment where I was trying to bundle install for a PostgreSQL setup, the bundle install had not finished (i.e, was hung) for over 9 hours without ever finishing.

      In spite of successfully finishing the bundle install and following the rest of the directions, I still don’t have gitlab running successfully. I’ll keep trying, but although I do like the features of gitlab, installing something like gitblit or Stash (commercial product from Atlassian) is a whole lot quicker and easier. While I do have Stash ($10) installed at home, it’s much easier to go with free and open source at work since git has not yet won them over there just yet….

      • Glad to hear you got some kind of resolution. I’ve never tried using PostgreSQL with Gitlab. I honestly try to avoid it but that’s just because I have more experience with MySQL.

      • I got to the point where gitlab GUI is working and I can log in. Still not able to clone a repository. Some sort of permission problem. Eventually will get it all working I’m sure.

        • What is the permission problem? Is it with the public/private keys that will let you connect to Gitlab via SSH? or is it a file system level problem? You should be able to safely run chown -R sa_gitlab:sa_gitlab ~/ to resolve any file system permission problems.

  17. I am setting up Gitlab 5 on Centos 6. First, I start the server. Then, I do a status. When doing the status, I get a message saying that “gitlab is not running”

    [root@zazu init.d]# pwd
    /etc/init.d
    [root@zazu init.d]# /etc/init.d/gitlab start
    Gitlab service started
    [root@zazu init.d]# /etc/init.d/gitlab status
    Gitlab service is not running.
    [root@zazu init.d]#

    I then logged in as sa_gitlab to run checks. I got some kind of message that an Init Script had not been installed. I saw more about it here:
    I did not see this in the instructions above. How would one go about adding this to gitlab? They are talking about using the user of gitlab_ci. Is the user sa_gitlab supposed to be used instead?

    Why do I get a message saying: “service started” and then the status later says “Gitlab service not running”?

    [sa_gitlab@zazu gitlab]$ bundle exec rake gitlab:check RAILS_ENV=production

    Checking Environment …

    Git configured for sa_gitlab user? … yes
    Has python2? … yes
    python2 is supported version? … yes

    Checking Environment … Finished

    Checking Gitlab Shell …

    GitLab Shell version? … OK (1.3.0)
    Repo base directory exists? … yes
    Repo base directory is a symlink? … no
    Repo base owned by sa_gitlab:sa_gitlab? … yes
    Repo base access is drwxrws—? … yes
    post-receive hook up-to-date? … yes
    post-receive hooks in repos are links: … can’t check, you have no projects

    Checking Gitlab Shell … Finished

    Checking Sidekiq …

    Running? … yes

    Checking Sidekiq … Finished

    Checking GitLab …

    Database config exists? … yes
    Database is SQLite … no
    All migrations up? … yes
    GitLab config exists? … yes
    GitLab config outdated? … no
    Log directory writable? … yes
    Tmp directory writable? … yes
    Init script exists? … yes
    Init script up-to-date? … no
    Try fixing it:
    Redownload the init script
    For more information see:
    doc/install/installation.md in section “Install Init Script”
    Please fix the error above and rerun the checks.
    Projects have satellites? … can’t check, you have no projects

    Checking GitLab … Finished

    • There is an error in my post. I was getting the init script from the master branch instead of the 5.0 branch. Gitlab changed the init script for Gitlab 5.1 which is now the master branch.

      I’ve fixed my post. Grab a fresh copy of the init script from https://raw.github.com/gitlabhq/gitlab-recipes/5-0-stable/init.d/gitlab make the tweaks I document in step 18 and try again.

      You’ll always get a warning about the init script since we’re modifying it. You should be able to safely ignore it.

  18. Hello again,

    I found out the issue. I had entered the information:

    # ——– Make the following edits ——–
    # The lines with a + are lines you need to add to the script

    APP_ROOT=”/data/apps/sa_gitlab/gitlab”
    APP_USER=”sa_gitlab”

    # Search and replace “sudo -u $APP_USER -H bash” with “sudo -u $APP_USER -H bash

    Incorrectly for the file: /etc/init.d/gitlab

    One has to make sure that the changed text appears at the TOP of this file and not in the middle or the bottom. It needs to be BEFORE the declaration of environment variables – like these:
    #APP_ROOT=”/home/git/gitlab”
    DAEMON_OPTS=”-c $APP_ROOT/config/unicorn.rb -E production”
    PID_PATH=”$APP_ROOT/tmp/pids”
    UNICORN_PID=”$PID_PATH/unicorn.pid”
    SIDEKIQ_PID=”$PID_PATH/sidekiq.pid”
    […snip …]

    So, after moving this, then when I did:
    /etc/init.d/gitlab status, I go the correct output.

    Hopefully gitlab works as advertised. Thanks for your instructions.
    STOP_SIDEKIQ=”RAILS_ENV=production bundle exec rake sidekiq:stop”

  19. Hi again – will any git client that works with github also work with gitlab? I wanted to use this with Eclipse. Thanks much!

    • No idea. Believe it or not I’ve barely used Gitlab after getting it setup. Just enough to make sure it was working.

      One day I’ll start coding something.

  20. How can one tell if this is working or not? Is there some kind of interface to use to say – create a repository in gitlab?

  21. Hi – can you remove all of my other posts (after the first one) and replace it with this? It might help
    someone in the same spot? Everyting is almost there …

    Basically, I have Centos 6 that was set up this way:
    http://www.howtoforge.com/perfect-server-centos-6.0-x86_64-ispconfig-2

    [root@zazu init.d]# cat /etc/redhat-release
    CentOS Linux release 6.0 (Final)

    [root@zazu init.d]# rpm -q centos-release
    centos-release-6-0.el6.centos.5.x86_64

    This was used to do the installation:
    http://www.howtoforge.com/perfect-server-centos-6.0-x86_64-ispconfig-3

    I followed Step #13, I used:
    gitlab:
    ## Web server settings
    host: zazu.pridelands.com
    port: 80
    https: false
    # Uncomment and customize to run in non-root path
    # Note that ENV[‘RAILS_RELATIVE_URL_ROOT’] in config/unicorn.rb may need to be changed
    # relative_url_root: /gitlab

    # Uncomment and customize if you can’t use the default user to run GitLab (default: ‘git’)
    user: sa_gitlab

    I followed Step #15, I used:
    listen “127.0.0.1:65527” # listen to port 8080 on the loopback interface

    I followed Step #20, I used:
    # ——– Make the following edits ——–

    ServerName zazu.pridelands.com
    DocumentRoot /data/apps/sa_gitlab/gitlab/public
    CustomLog logs/git.pridelands.com combined
    ErrorLog logs/git.pridelands.com-error.log

    ProxyPass / http://127.0.0.1:65527/
    ProxyPassReverse / http://127.0.0.1:65527/
    ProxyPreserveHost On

    # ——– Save and close the file ——-

    =>
    [root@zazu config]# /etc/init.d/httpd restart
    Stopping httpd: [ OK ]
    Starting httpd: [ OK ]

    =>
    [root@zazu config]# /etc/init.d/gitlab restart
    Restarting Gitlab service…
    Gitlab service restarted.

    =>
    [root@zazu config]# /etc/init.d/gitlab status
    Gitlab service / Unicorn with PID 11143 is running.
    Gitlab service / Sidekiq with PID 22479 is running.

    =>
    If I go to: http://zazu.pridelands.com:65527/

    Firefox can’t establish a connection to the server at zazu.pridelands.com:65527.

    =>
    If I go to: http://zazu.pridelands.com:8080/

    I get the ISP login screen

    =>
    If I go to: http://zazu.pridelands.com/ I get:

    This is the default index page of your website.

    This file may be deleted or overwritten without any difficulty. This is produced by the file index.html in the web directory.

    — BUT —

    If I refresh the page, I get the login screen for Gitlab (http://zazu.pridelands.com/users/sign_in)

    =>
    If I go to: http://zazu.pridelands.com/phpMyAdmin/index.php

    I get the login screen for Gitlab (http://zazu.pridelands.com/users/sign_in)

    ~this is something that is — not — wanted.

    QUESTION: How can I fix this so that when typing http://zazu.pridelands.com:7777, I will get the Gitlab
    login screen? How can I get the access to phpMyAdmin back?

    • There are a bunch of questions in there. First I’m going to leave your old posts. You never know who might find them helpful.

      Second I listen “127.0.0.1:65527″ # listen to port 8080 on the loopback interface means that the only way you can connect to Gitlab is via the local host. This is why we are configuring mod_proxy on Apache. If you want it to be available with out mod_proxy then change the line to listen “0.0.0.0:65527″ # listen to port 8080 on the loopback interface. That will make Gitlab listen on all network interfaces.

      If you want it accessible via port 7777 then change listen “127.0.0.1:65527″ # listen to port 8080 on the loopback interface to listen “0.0.0.0:7777″ # listen to port 8080 on the loopback interface. Then you should be able to access Gitlab via http://zazu.pridelands.com:7777/ assuming there is no port conflict and your firewall(s) allow it.

      I suspect you’ve lost access to a bunch of your websites because your vhosts are not configured correctly in Apache.

  22. During the installation you need to cd into the gitlab-shell directory and enter:

    /home/git/gitlab-shell: sudo -u git -H git checkout v1.1.0

    This is because during the installation (per these instructions) gitlab-shell returns “unknown” on the check.

  23. Im on step 17 but I get error “cannot find file or folder” on /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres

     

  24. Hello there,

    I came across this error when trying to push code to Gitlab (using the SmartGit front-end)

    remote: /data/apps/sa_gitlab/ruby/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/shared_helpers.rb:2:in `require’: no such file to load — rubygems (LoadError)

    Basically, I was on an old version of Ruby 1.8.x

    I then upgraded to 1.9.1 but then got this error.

    I found the answer here:

    ————————————————————–
    https://github.com/gitlabhq/gitlabhq/issues/3393
    my solution:

    $ sudo mv /usr/bin/ruby /usr/bin/ruby_1.8.7

    $ sudo ln -s /usr/local/bin/ruby /usr/bin/ruby
    ————————————————————–

    When I followed this, everything worked.

    Moral of the story: Make sure you upgrade to Ruby 1.9.x before starting the installation. Also,
    be sure that the ruby .exe file being referenced in /usr/local/bin/ and /usr/bin/ are the same version – maybe it could be something done if one upgrades their gitlab to 5.0 as well.

  25. Thank you for sharing this manual :)

    While compiling the ruby, the system complained about missing tlc. So I ended up installing tcl and tcl-devel with yum. Also the group install of Development Tools did not work, no components where found to install.

    Using centos 6.3, with kernel updates disabled due to restrictions of the hyperV 2012 Intergrated services components.

     

    • Out of curiosity why are you restricting kernel updates on Hyper-V 2012? We were using Hyper-V 2008 R2 for our RHEL/CentOS systems here but ran into so many stupid problems we just moved our *nix VMs to vSphere.

      If you run the command to install the development tools and see this:

      Warning: Group development does not have any packages.
      No packages in any requested group available to install or update

      That means everything you need is already installed.

  26. Hi Eric,

    I’ve got a question about redirections.
    Was the rule you provided in your howto sufficient to make Gitlab’s page running properly under https?

    The only imporant difference between my deployment and your’s is using different ports for http and https – respectively 8080 and 8443 in virtualhosts.
    My httpd.conf is identical, but I have to modified the redirect rule to:

    RewriteEngine On
    RewriteCond %{SERVER_PORT} 8080
    RewriteRule ^(.*)$ https://git.domain.com:8443$1 [R,L]

    But I got all the time error:

    Bad Request

    Your browser sent a request that this server could not understand.
    Reason: You’re speaking plain HTTP to an SSL-enabled server port.
    Instead use the HTTPS scheme to access this URL, please.

    In other way: I was putting address https://git.domain.com:8443, accepting certificate, writing down login and password then enter and… being redirected to http://git.domain.com:8443.
    I was doing a lot of mambo-jumbo in redirections – always same result.
    In Firebug I can see POST with https and GET with http at the beginning…

    I even removed httpd (2.2.25) and installed manually newer version (2.4.4) manually from RPM, as this is a known bug in 2.2 which should have been fixed since 2.4.X. But still same problem!

    I’m thinking about moving to nginx, Apache keeps pissing me off. ;)

    • Here is what I’m using to redirect HTTP to HTTPS and then proxy from Apache into the Gitlab webserver:


      [VirtualHost *:80]
      ServerName git.pickysysadmin.ca
      DocumentRoot /data/apps/sa_gitlab/gitlab/public
      CustomLog logs/git.pickysysadmin.ca.log combined
      ErrorLog logs/git.pickysysadmin.ca-error.log

      ProxyPass / http://127.0.0.1:65527/
      ProxyPassReverse / http://127.0.0.1:65527/
      ProxyPreserveHost On

      RewriteEngine On
      RewriteCond %{SERVER_PORT} 80
      RewriteRule ^(.*)$ https://git.pickysysadmin.ca$1 [R,L]
      [/VirtualHost]

      [VirtualHost *:443]
      ServerName git.pickysysadmin.ca
      DocumentRoot /data/apps/sa_gitlab/gitlab/public
      CustomLog logs/git.pickysysadmin.ca.log combined
      ErrorLog logs/git.pickysysadmin.ca-error.log

      ProxyPass / http://127.0.0.1:65527/
      ProxyPassReverse / http://127.0.0.1:65527/
      ProxyPreserveHost On

      SSLEngine on
      SSLProtocol all -SSLv2
      SSLCipherSuite ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
      SSLCertificateFile /etc/httpd/conf/certs/pickysysadmin.ca.crt
      SSLCertificateKeyFile /etc/httpd/conf/certs/pickysysadmin.ca.key
      SSLCertificateChainFile /etc/httpd/conf/certs/ca-bundle.pem
      [/VirtualHost]

      Just be sure to replace the [] brackets with the proper <> seems my comment system doesn’t allow for those symbols. I’ll need to fix that eventually.

      • I know, I’ve taken it from your howto. ;)
        But unfortunately this is not sufficient for me.
        I’m using CentOS 6.4, httpd 2.4.4 (2.2.25 has the same problem) and Gitlab 5.0.

        After logging on page https://git.domain.com:8443 and pressed enter I see error 400 and bad request, because I was being redirected to http://git.domain.com:8443

        When I change http at the beginning to https on the error page I’m logged in properly. But those errors after logging in and loggin out are annoying…

          • It has been done earlier, as in your howto.
            I’ve just upgraded Gitlab from 5.0 to 5.2, but still same error…
            Apache doesn’t like me. ;)

          • Yup.
            Eric, I’m a sysadmin like you, you wouldn’t catch me on basics like these. ;)
            But on the other hand, we usually waste the most of the time on basic problems or oversights.
            Here I spent several hours yesterday (I hate when something is not working as it should) trying to fix this problem, so I checked all related configs 10 times. ;)

          • Welp I’m stumped. I’d recommend watching the access/error logs on Apache and see what they say as you go through the login process.

            I think you can enable some debugging with mod_rewrite that might help further.

          • I did it!
            With the help of mod_header.

            In virtualhost:8443 I have added a line, which edits Location string in response header:

            Header edit Location “^http:” “https:”

            And that’s it! Now it works as it should. :)

            At last upgrading Apache was not pointless. ;)

  27. /data/apps/sa_gitlab/ruby/bin/bundle exec rake gitlab:setup RAILS_ENV=production
    rake aborted!
    (<unknown>): did not find expected key while parsing a block mapping at line 18 column 5
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:103:in `initialize’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `new’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `instance’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:37:in `[]’
    /data/apps/sa_gitlab/gitlab/config/initializers/1_settings.rb:38:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing’
    /data/apps/sa_gitlab/gitlab/config/environment.rb:5:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require_with_backports’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `call’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:246:in `block in execute’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:241:in `execute’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:184:in `block in invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:205:in `block in invoke_prerequisites’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:203:in `invoke_prerequisites’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:183:in `block in invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:177:in `invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/task.rb:170:in `invoke’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:143:in `invoke_task’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block (2 levels) in top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:101:in `block in top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:110:in `run_with_threads’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:95:in `top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:73:in `block in run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.4/lib/rake/application.rb:70:in `run’
    Tasks: TOP => gitlab:setup => environment
    (See full trace by running task with –trace)

  28. Hi,

    First of all, thanks a lot for this tutorial, it helped me a lot.

    I have a problem, everything looks fine except the “/data/apps/sa_gitlab/gitlab/public” which is almost empty and offcourse, the httpd doesn’t find an index page so it fail.
    Can you tell me what can cause this? I suppose it’s something that went wrong during install but I double check all command and made them again and still nothing :(

    Thanks,
    Sebastien

      • Ok, thanks for your response.
        So when I start httpd, it says: “Starting httpd: Warning: DocumentRoot [/home/sa_gitlab/gitlab/public] does not exist”
        Is it normal?

        My /etc/httpd/conf/httpd.conf file looks like:

        ServerAdmin monitoring@myserver.com
        DocumentRoot /home/sa_gitlab/gitlab/public
        ServerName git.mars
        ErrorLog logs/mars.gitlab-error.log
        CustomLog logs/mars.gitlab combined

        ProxyPass / http://127.0.0.1:65527/
        ProxyPassReverse / http://127.0.0.1:65527/
        ProxyPreserveHost On

        So you find anything not good in this?

        Thanks a lot,
        Sebastien


        • ServerAdmin monitoring@emixis.com
          DocumentRoot /home/sa_gitlab/gitlab/public
          ServerName git.mars
          ErrorLog logs/mars.gitlab-error.log
          CustomLog logs/mars.gitlab combined

          ProxyPass / http://127.0.0.1:65527/
          ProxyPassReverse / http://127.0.0.1:65527/
          ProxyPreserveHost On

          • Since mod_proxy is going to pass you through to the web service in Gitlab you can ignore the message.

            If you want the warning to go away just point DocumentRoot somewhere that Apache has access to or give Apache access to /home/sa_gitlab/gitlab/public.

            Oh and if you followed my instructions it should be /data/apps/sa_gitlab/gitlab/public not /home/sa_gitlab/gitlab/public.

  29. Hello, I am wondering about Step 16 with the database.

    Do you need to install mysql-server and do you need to make a root password beforehand?

    Do you put the exact username and password in the config/database.yml as you’ve written?

    Do you need to have the mysql-server service already running?

    I was somewhat confused at this point.

    ta, t.

    • The user can be anything you want as long as you are consistent. I chose sa_gitlab because that follows my naming convention on my server.

      The default database name is also fine if that’s what you’d like it to be. I name my databases after their FQDN. Makes it easier for me to associate databases with sites.

  30. Should the PATH in point 8 l. 6. really have this double assignment? PATH=PATH=…
    PATH=PATH=$HOME/git/bin:$HOME/ruby/bin:$PATH:$HOME/bin;
    It does look right from shell’s perspective.

  31. just before step 7. you might want to add the following step: yum -y install perl-ExtUtils-MakeMaker.x86_64

  32. Hello,

    I am a newbie at installing software on linux. I’m trying to install gitlab on Red Hat 6.3. The system already had ruby 1.9.3-p392 installed on it but I still went ahead and executed steps 6 and 8. However, when I try to execute step 9 I get this error:

    Fetching: bundler-1.3.5.gem (100%)
    ERROR: While executing gem … (Errno::ENOENT)
    No such file or directory – /data/apps/sa_gitlab/.gem/ruby/1.9.1/cache/bundler-1.3.5.gem

    Do you know why this could be happening? I am not sure why the system would look up 1.9.1 version of ruby when step 8 shows the correct version of ruby. Any suggestions would be appreciated.

    Thanks.

    • I see you’ve already posted your question here: http://stackoverflow.com/questions/17952902/unable-to-install-bundler

      It is very important you complete step 8 so you don’t use any of RHEL’s built-in software.

      You should see this if you’ve done Step 8 right:


      [sa_gitlab@localhost ~]$ which bundle
      ~/ruby/bin/bundle

      [sa_gitlab@localhost ~]$ bundle --version
      Bundler version 1.3.4

      [sa_gitlab@localhost~] which ruby
      ~/ruby/bin/ruby

      [sa_gitlab@localhost~] which git
      ~/git/bin/git

      • Thanks for the reply. I didn’t get correct results for the following two commands:

        -bash-4.1$ which bundle
        /usr/local/rvm/gems/ruby-1.9.3-p392/bin/bundle

        -bash-4.1$ bundle –version
        Bundler version 1.3.5

        It looks like its referencing an already existing version of the bundle. I went ahead and re-verified step 8. I didn’t see me missing anything unless I need to add something for the bundle as well to the bash_profile and bashrc files.

  33. What do you get for the following command?

    which ruby

    It should say

    [sa_gitlab@localhost ~]$ which ruby
    ~/ruby/bin/ruby

    If it doesn’t your PATHS are not working right.\

    If you go into ~/ruby/bin is there a ‘bundle’ binary in there?

  34. I had a question about Gitlab 5, running in Apache SSL. I set it up following the guide here and it works perfectly with the mod_rewrite, everything is in SSL which it should be (due to LDAP being used).

    However, I used my own certs (not signed). The weird thing which happened, is when I tried to use git ssh to upload a README to a project, it wouldn’t upload, it gave SSL-cert errors.

    If apache is not using SSL (no self-signed certs are involved), the git upload works just fine.

    Have you had this problem before? Is there a way to switch off this “feature” ?

    thanks,

    t.

    • I have not run into this before sorry. I’d guess you’d have to add your self-signed certificate to the local certificate store on the server as trusted and that might solve the problem.

  35. Great guide, very detailed. I feel I am 95% there now, I can get gitlab running as a service.

    When I run bundle exec rake gitlab:check RAILS_ENV=production

    I get

    GitLab Shell version? … FAIL. Please update gitlab-shell to v1.1.0

    How do I update gitlab-shell please?

    Also, I think line 4 in step 19. should read

    [root@localhost~] vim /etc/init.d/gitlab

  36. The install worked great, however, it seems that the public folder (where the web files are) are missing. The following files are there:

    404.html
    422.html
    500.html
    deploy.html
    favicon.ico
    gitlab_logo.png
    robots.txt
    static.css

    I’m not sure where to look for a resolution. the gitlab service is running and I didn’t notice any errors during installation. Any idea where I should look to find out why this didn’t install anything? I know I don’t have much helpful information here, but I’m at a bit of a loss on where to look.

    Thanks in advance.

  37. I see, I had thought it should have had a web interface as when last time I installed gitlab it had a web interface. Also makes me curious why we would set up a virtual host in Apache with that as the document root.

  38. thanks for posting the detailed steps.

     

    but I am stuck at Step 17 (using RHEL 6.3)

    gem install charlock_holmes –version ‘0.6.9.4’
    Building native extensions. This could take a while…
    ERROR: Error installing charlock_holmes:
    ERROR: Failed to build gem native extension.

    /usr/bin/ruby extconf.rb
    mkmf.rb can’t find header files for ruby at /usr/lib/ruby/ruby.h
    Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4 for inspection.
    Results logged to /usr/lib/ruby/gems/1.8/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/gem_make.out

     

    What am I missing

     

    • It looks like you’re using Ruby 1.8 and not 1.9.

      Run ‘which ruby’ and then ‘ruby –version’ your output should look like this:

      [sa_gitlab@localhost ~]$ which ruby
      ~/ruby/bin/ruby
      [sa_gitlab@localhost ~]$ ruby --version
      ruby 1.9.3p392 (2013-02-22) [x86_64-linux]

  39. Thanks you for this post, struggled for a week long (a long week) trying to get gitlab working.

    I followed a bunch of tutorial/procedures/how-tos … none really worked, before yours.

    It’s very complete, maybe a little too much, should have decided to use default user and path.

    Maybe you can indicate some steps to skip for people that are OK using default user and path.

     

    jeremi

  40. Hi Eric,

    When exec this command, error occurred, please help on this, thank you!

    [sa_gitlab@algsip-c1 gitlab]$  /data/apps/sa_gitlab/ruby/bin/bundle exec rake gitlab:setup RAILS_ENV=production –trace

    ** Invoke gitlab:setup (first_time)
    ** Invoke environment (first_time)
    ** Execute environment
    rake aborted!
    (<unknown>): did not find expected key while parsing a block mapping at line 18 column 5
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/psych.rb:203:in `parse’
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/psych.rb:203:in `parse_stream’
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/psych.rb:151:in `parse’
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/psych.rb:127:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:103:in `initialize’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `new’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:60:in `instance’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/settingslogic-2.0.9/lib/settingslogic.rb:37:in `[]’
    /data/apps/sa_gitlab/gitlab/config/initializers/1_settings.rb:38:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `block in load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:245:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:588:in `block (2 levels) in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/engine.rb:587:in `block in <class:Engine>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing’
    /data/apps/sa_gitlab/gitlab/config/environment.rb:5:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/backports-2.6.7/lib/backports/tools.rb:314:in `require_with_backports’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `call’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:228:in `block in execute’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:223:in `execute’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:166:in `block in invoke_with_call_chain’
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:187:in `block in invoke_prerequisites’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:185:in `invoke_prerequisites’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:165:in `block in invoke_with_call_chain’
    /data/apps/sa_gitlab/ruby/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:159:in `invoke_with_call_chain’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/task.rb:152:in `invoke’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:143:in `invoke_task’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block (2 levels) in top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `each’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:101:in `block in top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:110:in `run_with_threads’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:95:in `top_level’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:73:in `block in run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:160:in `standard_exception_handling’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/lib/rake/application.rb:70:in `run’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/gems/rake-10.0.3/bin/rake:33:in `<top (required)>’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `load’
    /data/apps/sa_gitlab/gitlab/vendor/bundle/ruby/1.9.1/bin/rake:23:in `<main>’
    Tasks: TOP => gitlab:setup => environment

    • You were able to run the previous command with no errors?

      # /data/apps/sa_gitlab/ruby/bin/bundle install –deployment –without development test postgres

      • Yes, Eric,bundle install is ok, with the following success msg:

        Your bundle is complete!
        Gems in the groups development, test and postgres were not installed.
        It was installed into ./vendor/bundle

        How should I debug then? Thanks!

        • Sorry I don’t know actually. I just spent a little time looking at it and I can’t think of what might be wrong. Sorry.

          Did you follow all of the previous steps? Even missing one by accident could cause problems.

Leave a Reply

Your email address will not be published. Required fields are marked *