How to to set up Gitlab on Debian

Update: This howto is outdated. GitLab has changed a lot since it was written and a lot of it is not applicable anymore (e.g. since GitLab 5.0 it doesn’t depend on Gitolite any more and only needs one system user to be setup). So you are probably better off using the official installation guide. 🙂


If you want to install Gitlab on Debian you can easily follow their installation steps for Ubuntu. But be careful there are a few gotchas nobody is talking about.

The following steps will assume you are root.

Preparations

First make sure you have all the latest updates installed.

aptitude update
aptitude full-upgrade

Then we have to install a few packages.

aptitude install git-core wget curl gcc checkinstall libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev libicu-dev redis-server sudo

Install Ruby

If you have not installed ruby you might want to consider using RVM.

Install it with

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

It will be installed into /usr/local/rvm.

Ask it for the requirements for installing MRI and install them.

rvm requirements
aptitude install build-essentials ...

Install ruby and make it the default.

rvm install 1.9.3
rvm --default use 1.9.3

You should install a minimum set of gems. Add “passenger” if you are running Apache as your web server or “thin” if you are using Nginx.

gem install bundler

Install Gitolite

First of all we want to create a dedicated user for Gitolite and Gitlab. This will also be the user the Rails processes will be running in (this is important later).

adduser \
  --system \
 --shell /bin/sh \
 --gecos 'Git Version Control' \
 --group \
 --disabled-password \
 --home /home/git \
 git

Configure git for the new user.

sudo -u git -H git config --global user.email "git@your-server.tld"
sudo -u git -H git config --global user.name "Gitlab Admin"

Generate the ssh key for the git user. It will be saved in /home/git/.ssh/id_rsa. We will run Gitlab as the git user so it will use this key to authenticate against Gitolite.

sudo -u git -H ssh-keygen -t rsa -b 2048

Copy the public part of the key for later use when we setup Gitolite.

sudo -u git -H cp /home/git/.ssh/id_rsa.pub /home/git/rails.pub

After that we install Gitolite. In contrast to the Gitlab documentation I installed it from the Debian repositories.

aptitude install gitolite

It will not be fully installed as it will tell you something like:

No adminkey given – not initializing gitolite in /var/lib/gitolite.

So we do this by using dpkg-reconfigure and using our previously prepared account.
When prompted, answer as follows:

  • Gitolite user: git
  • repositories directory: /home/git
  • admin key: /home/git/rails.pub
dpkg-reconfigure gitolite

Now you should have Gitolite set up in the /home/git directory. But we will still have to tweak it a little.

Edit /home/git/.gitolite.rc and find the line that reads “REPO_UMASK = 0077;” and change it to “REPO_UMASK = 0007;” (i.e. three zeros).

You now need to change the directory privileges on the /repositories directory so Gitlab can use them

sudo chmod -R g+rwX /home/git/repositories/
sudo chown -R git:git /home/git/repositories/

Gitolite should be ready now.

You can test it by cloning the admin repository:

sudo -u git -H git clone git@localhost:gitolite-admin /tmp/gitolite-admin
rm -rf /tmp/gitolite-admin

Install Gitlab

Install a few prerequisites.

aptitude install python-dev python-pip redis-server libicu-dev
sudo pip install pygments

Clone Gitlab

git clone git://github.com/gitlabhq/gitlabhq.git gitlab
cd gitlab

We create a gemset for Gitlab to not pollute the global gemset. To automate this we will use a .rmvrc inside the Gitlab directory. RVM will make sure it will be loaded automatically whenever you enter the directory.

echo "rvm use 1.9.3@gitlab --create" > .rvmrc

cd into directory to make rvm use the .rvmrc and accept with “y”.

cd .. && cd gitlab

Check your current gemset with

rvm current

It should show something like “ruby-1.9.3-p0@gitlab”.

Now you might need to update Gitlab’s Gemfile (e.g. add the mysql2 gem for MySQL databases).

Now install the gems necessary for running Gitlab.

bundle install --deployment

You may need to run “bundle install –no-deployment” to pick up changes to the Gemfile and rerun the previous command.

Edit config/gitlab.yml to configure Gitlab. If you have followed this howto you should only need to update the “email” section and the “host” option in the “git_host” section.

You might want to edit config/application.rb and update the time zone and locale configurations.

Edit config/database.yml and set up your database configuration.

Now set up and initialize your database.

bundle exec rake db:setup RAILS_ENV=production
bundle exec rake db:seed_fu RAILS_ENV=production

Install with Passenger + Apache

(todo)

Install with Thin + Nginx

(todo)

Result

😀

Gerechtigkeit für Kim Dotcom

FAZ.NET schreibt, warum Kimble einfach nur wieder gezeigt hat, dass die Contentmafia ein weiteres einfaches wie lukratives Geschäftsmodell für Content im Internet ignoriert, nicht verstanden  und bekämpft hat.

Auszug:

Nur so ist diese Firma in der Lage gewesen, mit einer Handvoll Mitarbeitern und angemieteten Servern diese erstaunlichen Gewinne zu erzielen. Die Rechteinhaber, denen angeblich 500 Millionen entgangen sind, hätten ihre Inhalte vermutlich nicht so günstig ins Netz gebracht; Heerscharen von Anwälten, Programmierern und Beratern hätten Ewigkeiten damit zugebracht, dem System auf allen Ebenen jede Möglichkeit des Missbrauchs auszutreiben, und entsprechend hohe Kosten verursacht. Man könnte also frech die Frage stellen: Wären die Rechteinhaber in der Lage gewesen, selbst so ein umfassendes Downloadportal aufzubauen, mit dem sie 175 Millionen Dollar und jede Menge weiterhin gern zahlender Kunden abgeschöpft hätten, die selbst für die Bereitstellung der Inhalte sorgen? Ein Portal, das für sich so etwas wie Marktführerschaft beanspruchen kann? Mit schlanken Strukturen und einem Chef, der auf die Nutzern nicht wie ein raffigieriger Contentmafioso wirkt, mit Armeen von Anwälten im Hintergrund und der ständigen Drohung, beim kleinsten Verstoss gegen die Regeln werde man in die Privatinsolvenz abgemahnt?

FAZ.NET

Chronique scandaleuse des Verfassungsschutzes

Die Zeit hat mal die Chronique scandaleuse des Verfassungsschutzes zusammengestellt. Und wie sich zeigt, sind das alle ehrenhafte und verantwortungsvolle Menschen, die nur unser Bestes wollen und sich mit Leib und Seele dem Schutz der Verfassung [sic] widmen.

Einige Gedanken:

  • warum sollte man Leuten trauen, die eine “Lizenz” zum brechen von Gesetzen und Verfassung haben
  • darin vom Staat unterstützt und gedeckt werden
  • keine überprüfbaren Informationen produzieren
  • effektiv keiner Rechenschaftspflicht oder Überprüfbarkeit unterliegen
  • unverhältnismäßig viel Geld kosten
  • und Eigentlich nur durch Missbrauch ihrer Rechte und durch unseriöses Handeln auffallen

Um den Artikel oben zu zitieren:

Die Chronique scandaleuse des Verfassungsschutzes seit 1950 zeigt vor allem eins: Er ist überflüssig und gehört schleunigst abgeschafft.

Paper: Does Terrorism Really Work? Evolution in the Conventional Wisdom since 9/11

Bruce Schneier points to a new paper by Max Abrams titled “Does Terrorism Really Work? Evolution in the Conventional Wisdom since 9/11“. From the abstract:

The basic narrative of bargaining theory predicts that, all else equal, anarchy favors concessions to challengers who demonstrate the will and ability to escalate against defenders. For this reason, post-9/11 political science research explained terrorism as rational strategic behavior for non-state challengers to induce government compliance given their constraints. Over the past decade, however, empirical research has consistently found that neither escalating to terrorism nor with terrorism helps non-state actors to achieve their demands. In fact, escalating to terrorism or with terrorism increases the odds that target countries will dig in their political heels, depriving the non-state challengers of their given preferences. These empirical findings across disciplines, methodologies, as well as salient global events raise important research questions, with implications for counterterrorism strategy.

I hope my university has access to it …

Introspective and Intellectually Cautious

Hilarious quote comparing medieval Europe to Al-Andalus:

(talking about how Muslim scholars studied ancient Greek philosophy and the medieval Christian’s suspicion towards pagan texts)

“Set against this vibrant Islamic culture Europe can appear an introspective and intellectually cautious place.”

Muhahaha … “introspective and intellectually cautious” … this cracked me up 😀

CRE191 Internet im Festnetz

Der CRE über Internet im Festnetz ist besonders lustig geraten. Es ist teilweise echt überraschend wie dreist wir zum Narren gehalten wurden/werden … 🙁

Besonders lustig (d.h. die Szenen haben auch komödiantisch was her):

  • 43:19 über die “digitale Revolution” für Leute in der DSL-Wüste und den “heiligen Akt” der Einwahl 😀
  • 1:58:53 über die Möglichkeit 200Mbit über den gewöhnlichen Hausanschluss zu bekommen.

Money Quote:

Tim: “… Könnte ich ja im Prinzip 100Mbit …”

Gast: “200”

Tim: “… in jede Richtung? …”

Gast: “Mhmm”

(3s Schweigen)

(Zögenrndes Lachen)

Gast: “Aber warum … warum sollte die Telekom dir sowas legen, wenn sie dir auch ein Bussinesprodukt verkaufen kann, wo sie schön den Bürgersteig für aufmachen und ‘ne Glasfaser rein legen und dich tausend-quietsch Euro im Monat dafür zahlen lassen.”

Wirklich deprimierend. 🙁

It’s blue, wait … green, no … actually it’s 青

There are certain concepts that don’t translate well over language borders. It is difficult to convey a nuance of something to someone which she is not able to conceptually grasp (be it mentally or linguistically).

There are obvious things like Phonems (everyone loves those 😉 ) …

  • “L” vs. “R” in some Asian languages
  • “B” vs. “V” in Spanish
  • Turkish “ı” and Korean “” ([ɯ])
  • [x] vs. [ç] in German “ch”

… and less obvious things like … colors. 🙂 The most interesting thing is that almost all languages seem to make a black<->white and a red/yellow<->green/blue distinction. I came across a Wikipedia article talking about distinguishing blue from green in language as not all of them do. Another interesting concept that was described is that in some languages it is also hard to distinguish blue from black. There are studies showing the interdependence of color concepts:

According to Brent Berlin and Paul Kay‘s 1969 study Basic Color Terms: Their Universality and Evolution, distinct terms for brown, purple, pink, orange and grey will not emerge in a language until the language has made a distinction between green and blue. In their account of the development of color terms the first terms to emerge are those for white/black (or light/dark), red and green/yellow.

– Wikipedia

😀