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 rosehosting.com 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 vimThen 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 sudoYour Python version has to be greater than 2.5 and lower than 3.0+
  python --versionnow 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 ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p353.tar.gz | tar xz
 cd ruby-2.0.0-p353
 ./configure && make
 make installNow you can use ruby to install the bundler ruby gem:
  gem install bundler --no-ri --no-rdocThen create git user and install gitlab-shell:
  adduser --disabled-login --gecos 'GitLab' git
  cd /home/git
  sudo -u git -H git clone https://github.com/gitlabhq/gitlab-shell.git
  cd gitlab-shell
  sudo -u git -H git checkout v1.8.0Edit 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.ymlNow that the shell is properly configured, we can run the install script for gitlab-shell
  sudo -u git -H ./bin/installThen we need to install MariaDB as database server. Go to https://downloads.mariadb.org/mariadb/repositories/ 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-devWhen 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)]> exitOnce the database has been created, proceed with the installation of GitLab:
  cd ../
  sudo -u git -H git clone https://github.com/gitlabhq/gitlabhq.git gitlab
  cd gitlab/
  sudo -u git -H git checkout 6-4-stableEdit 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.ymlFix 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/uploadsConfigure 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.rbNow configure git user's git configuration
  sudo -u git -H git config --global user.name "GitLab"
  sudo -u git -H git config --global user.email "gitlab@INSERT_YOUR_DOMAIN"
  sudo -u git -H git config --global core.autocrlf inputEdit 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.ymlUse ruby to initialize the database
  gem install charlock_holmes --version '0.6.9.4'
  sudo -u git -H bundle install --deployment --without development test postgres aws
  sudo -u git -H bundle exec rake gitlab:setup RAILS_ENV=productionYou 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 21then check gitlab application status and start it
  sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production
  /etc/init.d/gitlab startInstall and configure Nginx:
  apt-get install nginx
  cp lib/support/nginx/gitlab /etc/nginx/sites-available/gitlabEdit 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 restartnow you can point your browser to your domain and enjoy gitlab
username: [email protected]
password: 5iveL!fe
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.