Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
A guide to install GitLab >6.0 on Debian 7 "Wheezy"

GitLab is a self hosted Git management software based on Ruby on Rails.

It is free software and that is always a plus!

This tutorial is heavily based on the excellent post at and collects information I found in documentation and on the internet generally.

Note: We'll work in a root console using Bash

If you don't have an editor of choice install vim (it's great!)

  apt-get install vim

Then install a few useful packages:

  apt-get install dialog build-essential zlib1g-dev libyaml-dev libssl-dev libgdbm-dev libreadline-dev libncurses5-dev libffi-dev curl git-core openssh-server redis-server checkinstall libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev python-docutils sudo

Your Python version has to be greater than 2.5 and lower than 3.0+

  python --version

now check if you can access python shell via ‘python2′:

  test ! -e /usr/bin/python2 && ln -s /usr/bin/python /usr/bin/python2
  python2 --version

(the version has, obviously, to be the same!)

Unfortunately the ruby version included in Wheezy is not the one we'd like to use, so we'll have to compile and install it from source:

 mkdir /opt/ruby
 cd /opt/ruby
 curl --progress | tar xz
 cd ruby-2.0.0-p353
 ./configure && make
 make install

Now you can use ruby to install the bundler ruby gem:

  gem install bundler --no-ri --no-rdoc

Then create git user and install gitlab-shell:

  adduser --disabled-login --gecos 'GitLab' git
  cd /home/git
  sudo -u git -H git clone
  cd gitlab-shell
  sudo -u git -H git checkout v1.8.0

Edit the configuration including your URL as gitlab_url instead of the default "http://localhost/"

  sudo -u git -H cp config.yml.example config.yml
  sudo -u git -H vim config.yml

Now that the shell is properly configured, we can run the install script for gitlab-shell

  sudo -u git -H ./bin/install

Then we need to install MariaDB as database server. Go to and follow the istructions to be able to install deb packages from their repositories and them:

  apt-get install mariadb-server-10.0 mariadb-client-10.0 libmariadbclient-dev

When prompted insert a proper password for your administrator, then start using it

  mysql -u root -p
  MariaDB [(none)]> CREATE DATABASE IF NOT EXISTS `gitlabDB` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
  MariaDB [(none)]> GRANT ALL ON `gitlabDB`.* TO 'gitlab'@'localhost' identified by 'INSERT_PASSWORD_HERE_PLEASE';
  MariaDB [(none)]> exit

Once the database has been created, proceed with the installation of GitLab:

  cd ../
  sudo -u git -H git clone gitlab
  cd gitlab/
  sudo -u git -H git checkout 6-4-stable

Edit the configuration including your URL as host instead of the default "localhost" and filling email_from and support_email with proper values

  sudo -u git -H cp config/gitlab.yml.example config/gitlab.yml
  sudo -u git -H vim config/gitlab.yml

Fix directory permissions:

  chown -R git log/ tmp/
  chmod -R u+rwX  log/ tmp/
  sudo -u git -H mkdir /home/git/gitlab-satellites
  sudo -u git -H mkdir tmp/pids/
  sudo -u git -H mkdir tmp/sockets/
  sudo -u git -H mkdir public/uploads
  chmod -R u+rwX  tmp/pids/ tmp/sockets/ public/uploads

Configure unicorn HTTP server - make sure you tune unicorn to suit your needs. be careful how much resources you allocate and actually have. you can always start with something like worker_processes 1 and timeout 120:

  sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
  sudo -u git -H vim config/unicorn.rb

Now configure git user's git configuration

  sudo -u git -H git config --global "GitLab"
  sudo -u git -H git config --global "gitlab@INSERT_YOUR_DOMAIN"
  sudo -u git -H git config --global core.autocrlf input

Edit database configuration (in "production" section) to setup connection to mysql and db, editing "database", "username" and "password" according to your configuration (in this example database is gitlabDB and username is gitlab)

  sudo -u git cp config/database.yml.mysql config/database.yml
  sudo -u git -H vim config/database.yml
  sudo -u git -H chmod o-rwx config/database.yml

Use ruby to initialize the database

  gem install charlock_holmes --version ''
  sudo -u git -H bundle install --deployment --without development test postgres aws
  sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

You have to answer ‘yes’ when asked "Do you want to continue (yes/no)?"

GitLab needs an init script in init.d

  cp lib/support/init.d/gitlab /etc/init.d/gitlab
  chmod +x /etc/init.d/gitlab
  update-rc.d gitlab defaults 21

then check gitlab application status and start it

  sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
  /etc/init.d/gitlab start

Install and configure Nginx:

  apt-get install nginx
  cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlab

Edit the configuration (delete default_server if this is not the only website on your server, for example) and make sure to change server_name YOUR_SERVER_FQDN to your real url

  vim /etc/nginx/sites-available/gitlab
  ln -s /etc/nginx/sites-available/gitlab /etc/nginx/sites-enabled/gitlab
  service nginx restart

now you can point your browser to your domain and enjoy gitlab


password: 5iveL!fe

Notes on GitLab customization

that's just a collection of notes, don't take it too seriously

  • Since 6.4 the Default project features settings section supports a visibility_level: keyword that can be set to "public", "internal" or "private" <- don't forget the quotes! (substitutes public: which was a bool).

Logo on the homepage (and custom text as well):

when editing the "Extra customization" section you have to uncomment sign_in_text if you want any of the following to work (yaml parsing seems to be very strict and an indentation level should never be neglected).

    ## Text under sign-in page (Markdown enabled)
    # sign_in_text: |
    #   ![Company Logo](
    #   [Learn more about CompanyName](


    ## Text under sign-in page (Markdown enabled)
     sign_in_text: Put your custom text here (or leave | if you want)
        ![Company Logo](
    #   [Learn more about CompanyName](

Is there a setting to change logo in the upper left corner (the gitlab cat mascotte)?

Copy link

novalore commented Dec 20, 2013

I'm currently trying to customize Company Logo on GitLab, but it seems to be more difficult than I thought

It has surely something to do with white-spacing in .yaml files. I commented on issue to ask if someone knows better. We'll see...

Copy link

novalore commented Dec 24, 2013

Since 6.4.3 gitlab-shell does not have to be in /home/git, but can be placed wherever you like. I should try that feature.

Copy link

xsharp commented Feb 11, 2014

  • step ?

sudo -u git -H bundle exec rake assets:precompile RAILS_ENV=production

Copy link

kpobococ commented Apr 14, 2014

While installing GitLab with your guide, specifically on the "bundle install" step, I got a following error:

Could not find modernizr-2.6.2 in any of the sources

Here's a solution I've found, if somebody else has the same error:

Copy link

vojtechmares commented Nov 5, 2014

Hello, I have small issue. When I run this command:
sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production

SSH shows me this error:
root@arrow:/home/git/gitlab# sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=production
Could not find rake-10.1.0 in any of the sources
Run bundle install to install missing gems.

Can someone tell me how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment