GitLab installation on Fedora 16 (with gitolite)

Posted by in all posts

This is updated ver­sion of my tuto­r­ial for Git­Lab 2.1. Old ver­sion can be found here

Atten­tion: this guide seri­ously out­dated! It has been writ­ten for Git­lab v2.1 and cur­rent ver­sion is >= v7.1.1. Almost every­thing has changed since then.

Git­Lab is a won­der­ful piece of soft­ware made by these guys and I’d like to try and install it on Fedora 16 sys­tem, as it is most recent Fedora OS at the time I am writ­nig this. I will base my tuto­r­ial on on found here by Déja. Also on my way to suc­cess­ful install I’ve stum­bled upon this descrip­tion, so I might have gain some expe­ri­ence from it too.

Git­Lab is Ruby on Rails appli­ca­tion and it takes some expe­ri­ence to get it all work­ing because of many, many, many depen­den­cies and pack­ages it needs. It’s noth­ing like sim­ple PHP on Apache instal­la­tion. But it works and it’s worth it, I assure you :)

Let’s begin! (by the way: I per­form all as root user — again: test environment)

small edit: For peo­ple who only want this to work and not nec­es­sar­ily wish to know how and why, I have pre­pared easy instal­la­tion scripts in here
another EDIT: Git­Lab is under heavy devel­op­ment and now it’s sta­ble ver­sion is 2.1. This means that my guide might be not entirely accu­rate. Please be cau­tious. I’ll update it soon.
  1. First of all: I am work­ing on vir­tual machine with brand new and fresh Fedora 16 installed. Min­i­mal instal­la­tion, just to make sure noth­ing messes with Git­Lab. Con­sider this a test environment.
  2. Once you have your OS ready, update it with yum update and also install some pack­ages you will need on the way:
    yum install make openssh-clients gcc libxml2 libxml2-devel \
    libxslt libxslt-devel python-devel
  3. Check what ver­sion of ruby is avail­able via yum. Git­Lab needs at least ver­sion 1.9.2
    yum info ruby

    on mine it says that the only avail­able ver­sion for me is so I have to get it some­where else.

  4. Using RVM to install Ruby.
    EDIT: I have switched to ruby 1.9.3p0 — it works and starts a lot faster, you can use it instead of 1.9.2-p290 in this guide.

    I will use RVM, which stands for Ruby Ver­sion Man­ager — bril­liant tool, which you can use to install and man­age your Ruby with ease. Let’s check it out, shall we? (you can install Ruby any way you want — I’ll just do this RVM way)

    Notice use of –with-openssl switch — with­out that pas­sen­ger will com­plain about Ruby OpenSSL sup­port and won’t com­pile in next step.

    sudo bash -s stable < <(curl -sk
    source /etc/profile.d/
    rvm install ruby-1.9.2-p290 --with-openssl
    rvm use ruby-1.9.2-p290 --default

    Done. Just like that we have oper­a­tional Ruby 1.9.2-p290. No RPMs, no going back in time.. nice, huh? :)

  5. Good. Small (nice) sur­prise: our RPM installed ruby gems for us, so now we only have to get rails gem.
    first, just to make sure every­thing is up to date, execute:
    rvm all do gem update --system

    now install rails with:

    rvm all do gem install rails
  6. Now we will install apache2 as a web­server and Pas­sen­ger for ruby apps deploy­ment. I know that most Git­Lab tuto­ri­als use nginx but I really like apache ;)
    yum install -y httpd
    rvm all do gem install passenger

    as I men­tioned: I use apache, so I will need pas­sen­ger mod­ule for it:
    first some required packages:

    yum install -y gcc-c++ curl-devel openssl-devel zlib-devel \
    httpd-devel apr-devel apr-util-devel

    an then use


    in order to install gives you 2 infor­ma­tion on how to pro­ceed with apache configuration:

    • add fol­low­ing lines to /etc/httpd/conf/httpd.conf (at the very end):
      LoadModule passenger_module /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.11/ext/apache2/
      PassengerRoot /usr/lib/ruby/gems/1.9.1/gems/passenger-3.0.11
      PassengerRuby /usr/bin/ruby
    • and then cre­ate file named default.conf (or gitlab.conf, or some­thing other you like) in /etc/httpd/conf.d/ con­tain­ing these lines (remem­ber to change to fit your environment):
      <VirtualHost *:80>
      DocumentRoot /somewhere/public
      <Directory /somewhere/public>
      AllowOverride all
      Options -MultiViews

      (don’t worry, we’ll come back to this one later)

  7. Now it is time for gito­lite. I won’t use gito­sis because it is not actively devel­oped any more and I found that new Git­Lab works bet­ter with gitolite.install it with
    yum install -y gitolite

    now, wasn’t that quick? :)

  8. Now we will need to cre­ate new gito­lite server con­fig­u­ra­tion and in order to do that we have to gen­er­ate SSH key-pair. But first things first.
    To get us started we will cre­ate git user with

    adduser -r -m --shell /bin/bash \
     --comment 'git version control' git
    mkdir /home/git/.ssh
    chown git:git -R /home/git/.ssh

    Now we have to cre­ate SSH keys pair for him:

    ssh-keygen -q -o -N '' -t rsa -f /home/git/.ssh/id_rsa

    To ini­tial­ize Gito­lite we need to first edit it’s default con­fig­u­ra­tion file and change default per­mis­sions and then ini­tial­ize it by using git user:

    sed -i 's/0077/0007/g' /usr/share/gitolite/conf/example.gitolite.rc
    su - git -c "gl-setup -q /home/git/.ssh/"

    as men­tioned here

  9. Just to make sure that git user has all nec­es­sary access rights to his own home direc­tory after we have added SSH keys for him:
    chown git:git -R /home/git/
  10. OK, time for next require­ments: python Pip, I will go with method from orig­i­nal post and NOT use yum for that.
    curl | python

    and then

    easy_install pip
  11. Data­base. We need it. We have it already — it was installed on the way as a depen­dency. Just to make sure check if you have SQLite at list ver­sion 3.6 with:
    yum info sqlite

    I have All we need is SQLite devel­op­ment pack­age, get it with:

    yum install -y sqlite-devel
  12. And now the main event! GitLabHQ!

    I like install web apps in /var/www so we will go there and git clone GitLab:

    cd /var/www
    git clone git://
    cd gitlabhq/

    we need to use pip to install some python dependencies:

    pip install pygments

    and bundler gem so it can later on do most of the work for us:

    rvm all do gem install bundler

    you will need one more depen­dency for bun­dle install

    yum install -y libicu-devel

    finally (remem­ber to be in Git­Lab direc­tory):

    bundle install

    (go get your­self a cof­fee or other treat — it takes a while)

  13. Redis instal­la­tion. More about Redis here
    yum install -y redis

    and start it with:

    service redis start
  14. Prepar­ing con­fig files.copy data­base and git­lab con­fig files from exam­ple to work­ing copies:
    cp config/gitlab.yml.example config/gitlab.yml
    cp config/database.yml.example config/database.yml
  15. DB setup:
    And now data­base setup and import:
    RAILS_ENV=production rake db:setup
    RAILS_ENV=production rake db:seed_fu

    TIP: if you get errors here, check if you don’t have 2 ver­sions of rake installed (I had some­how): 0.8.7 and 0.9.2. If you do, remove older with:

    gem uninstall rake

    and choose appro­pri­ate ver­sion. If you still have prob­lems try:

    gem install rake

    -> don’t know why, but if it installs again same ver­sion of rake, it works.

  16. Apache vir­tual host con­fig­u­ra­tion should look some­thing like this (I told you, we will get back to that):file: /etc/httpd/conf.d/gitlab.conf
    <VirtualHost *:80>
    DocumentRoot /var/www/gitlabhq/public
    <Directory /var/www/gitlabhq/public>
    AllowOverride all
    Options -MultiViews
  17. enable apache user, co you can su into this account:
    usermod -s /bin/bash -d /var/www/ apache

    pre­pare SSH key for him (actu­ally use one cre­ated for git user)

    mkdir /var/www/.ssh
    cp -f /home/git/.ssh/id_rsa /var/www/.ssh/ && chown apache:apache /var/www/.ssh/id_rsa && chmod 600 /var/www/.ssh/id_rsa

    add local­host to apache user known_hosts with:

    ssh-keyscan localhost >> /var/www/.ssh/known_hosts

    also give him per­mis­sions to his own home direc­tory with:

    chown -R apache:apache /var/www/


  18. add apache user to git group with:
    usermod -a -G git apache
  19. check if repos­i­to­ries direc­tory has cor­rect per­mis­sions, it should be 770. You can set it with
    chmod 770 /home/git/repositories/
  20. dou­ble check your fire­wall (for exam­ple ipt­a­bles) if it allows con­nec­tions on port 80 to your server.
  21. impor­tant: Apache won’t be able o start with SELinux set to “enforc­ing”. Please set it to permissive.
  22. start apache server with:
    service httpd start
  23. Now it all should work. Fin­gers crossed.. go to
  24. Now you should be able to log in using these cre­den­tials:

    pass: 5iveL!fe

    and you’re in :)

It wasn’t so hard, wasn’t it? ;)


  1. I get error 500 when I enter par­tic­u­lar project and try to get into it’s “Admin” sec­tion. Don’t know how to fix it yet.To fix it, check if repos­i­to­ries direc­tory has cor­rect per­mis­sions, it should be 770. You can set it with
    chmod 770 /home/git/repositories

    also set this:

    chmod 770 /home/git
  2. If Pas­sen­ger insists, that we don’t have or he can’t see grit library (gem actu­ally, as far as I know) even though we have it. (at mas­ter) is not checked out. Please run ‘bun­dle install‘ (Bundler::GitError)

    Only res­o­lu­tion to this prob­lem I have found is to (as root) change /usr/local/rvm/gems/ruby-1.9.3-p0/gems own­er­ship to apache user with:

    chown apache:root -R /usr/local/rvm/gems/ruby-1.9.3-p0/gems

    I know that is not great res­o­lu­tion but it worked for me. If you’ll hap­pen to know bet­ter way — please let me know, so I can update this tuto­r­ial and my knowl­edge of course ;)


    I found another solu­tion (instead of chang­ing per­mis­sions): after first

    bundle install

    edit Gem­file and in lines con­tain­ing “git:” remove every­thing after first comma, for example:

    gem "grit", :git => ""

    should be

    gem "grit"

    and so on.

    then do again

    bundle install

    and now pas­sen­ger shouldn’t com­plain any more.