GitLab installation on Fedora 16 (with gitolite)

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 :)

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.

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.

Once you have your OS ready, update it with yum update and also install some pack­ages you will need on the way:

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

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.

impor­tant: Apache won’t be able o start with SELinux set to “enforc­ing”. Please set it to permissive.

start apache server with:

service httpd start

Now it all should work. Fin­gers crossed.. go to http://www.yourhost.com

Now you should be able to log in using these cre­den­tials:

user: admin@local.host
pass: 5iveL!fe

and you’re in :)

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

Trou­bleshoot­ing:

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

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.

I don’t have access to Cen­tos box right now, but I’m guess­ing it might have some­thing to do with either x64 arch not work­ing with sqlite-devel — maybe you have it with wrong archi­tec­ture installed?

I’m not sure what you set-up is, but there shouldn’t be any index.html in pub­lic direc­tory. Can you please try post­ing your Apache error and access log right after you get 403 error? Only lines cor­re­spond­ing needed.
Also please dou­ble check you Apache vir­tu­al­host con­fig­u­ra­tion. You know: paths and all.

Hi,SSH key is needed because this is how any user is authen­ti­cat­ing with gito­lite. All actions like adding SSH key or repos­i­tory via Git­Lab inter­face rely on this authen­ti­ca­tion, so Apache user has to have abil­ity to con­nect with­out pass­word. Adding ‘local­host’ to known_hosts pre­vents SSH to ask to accept this host per­ma­nently — you can see how it works every time you try to con­nect to any host for the first time. You just have to do it once.

Please check if your con­fig­u­ra­tion in /var/www/gitlabhq/config/gitlab.yml is cor­rect: please check host­name, git user (gito­lite) and path to repos­i­to­ries. If you have typed there other host­name then ‘local­host’, for exam­ple my-domain.com — you should su — to apache user and SSH to this host too. Same thing as I described ear­lier with accept­ing new host to known_hosts.

ok, i have it work­ing and kick­ing, but the prob­lem is that when i use
“admin_uri: gitolite@localhost:gitolite-admin“
i get error that there is no git repo, but when i change to
“admin_uri: gitolite@localhost:repositories/gitolite-admin“
it does work, but i can pub­lish anything =[

Hi,
Sorry to say that, but right now I don’t really know how to help you… You see, when you clone from github, you are cloning bleed­ing edge, newest com­pi­la­tion. This means, that there might be some bugs or it might be messed up com­pletely. I have to update my guide to cover new sta­ble ver­sion 2.1 (stable).

Hi,
It sounds like you have some prob­lem with Apache vir­tu­al­host con­fig­u­ra­tion, maybe some­thing mis­spelled in direc­tory path? On the other hand you might be point­ing your web­root (/) to either non-exiting folder, folder with per­mis­sions not allow­ing apache user to access it or your vir­tu­al­host con­fig­u­ra­tion is point on wrong direc­tory — I mean, not “pub­lic” in Git­Lab folder.

Please see what is show­ing in apache logs (access/error) for your vir­tu­al­host — maybe you’ll find a clue there.

I’m get­ting a 404 when try­ing to add a project, it works some­times and some­times it doesn’t. Seems to be related to files in /tmp. I’ve installed using the new ruby and fol­lowed this how-to to the letter.

Hi,
It might sound obvi­ous, but try clear­ing /tmp folder. It worked for me and I think some­one on Git­Lab sup­port forum as well. Also please check your apache logs for this 404 error and see if there is any info about what exactly is caus­ing it. It might help to check Git­Lab pro­duc­tion log also.

Hi. This is what worked for me: in your Git­Lab direc­tory find file named Gem­file and edit it. Search for lines which have ref­er­ence to pack­age down­load path and dupli­cate them, com­ment out orig­i­nal and delete this ref­er­ence from copy so it will look like all other pack­age entries. There is one for git/grit and 2 or 3 more. You can dis­able them one by one to see which are problematic.

Hi,
Check your file gitlab.yml, which is located in (accord­ing to my tuto­r­ial) in /var/www/gitabhq/config direc­tory. There is line say­ing: host: local­host
In my instal­la­tion it works for me, but you may have to change ‘local­host’ to your_hostname.

Direc­tory /home/git/repositories has to be acces­si­ble by Apache user, who should be in ‘git’ sys­tem group. To make it acces­si­ble you have to set direc­tory per­mis­sions, so they will allow that. This is what chmod does. Chown just makes sure that this direc­tory (and sub­di­rec­to­ries) are owned by git user and his group.

Appli­ca­tion (Git­Lab) is run by Apache user, so you have to make sure that this user can log in via SSH to git user account with SSH key. To check it, please log in as Apache user or if you are root:
su — apache
and try com­mand: ssh git@localhost or ssh git@{your_hostname}

If it suc­ceeds and does not prompt for pass­word, then it is work­ing cor­rectly and I would have to have more details to help you.

Thanks for writ­ing this up. I started with installing gito­sis and that is work­ing just fine.

As I am also work­ing with openshift.redhat.com, they use ruby and I am con­cerned that in pulling in the ver­sion of ruby that you’ve described here for git­lab, I don’t want to have to worry about the newer ver­sion not work­ing with openshift.

I will exper­i­ment with this any­way, and report back here (and on my blog).

Has any­one ever encoun­tered “unini­tial­ized con­stant Linguist::BlobHelper”. I am doing this on a Media Tem­ple DV4 box which is Cen­tOS 5.

I did a Google search and some­one else is hav­ing this same prob­lem within the last 24 hours, but they just posted their error anony­mously in paste­bin. You can see their post here: http://pastebin.com/SKrqnEC3

I may also be worth men­tion­ing that if you are doing this in an envi­ron­ment that uses Plesk Panel the only direc­tory and its con­tents that need chown apache:apache is the /var/www/gitlabhq direc­tory. Oth­er­wise, if you fol­low these instruc­tions all your Plesk con­trolled vir­tual hosts will loose their Plesk assigned owner:group permissions.

Thanks for the won­der­ful arti­cle. I fol­lowed your step, but I am not able to add any project into the git­labhq GUI. It shows error
Gito­lite Error
Appli­ca­tion cant get access to your gito­lite system.

2. Don’t get me wrong, but did you per­form this as root user? If yes, then I’m not sure what is going on. Try google’ing those errors.

3. I did once get those errors, when on new OS I for­got to install few pack­ages needed for devel­op­ment (make, gcc, cpp) or *-devel pack­ages needed by par­tic­u­lar ruby pack­age. Try look­ing in /usr/local/rvm/gems/ruby-1.9.2-p290/gems/capybara-webkit-0.12.1/./gem_make.out for more details.

Hi Taras,
Did you have any luck with your capy­bara prob­lem?
I just found a solu­tion for your prob­lem, when I tried to per­form a clean Git­Lab install.
Try this:
yum install qt-webkit-devel or yum install qtwebkit-devel (or both)
and this after­wards: export QMAKE=/usr/bin/qmake-qt4

Hello Ben­son,
Web server has to be able to access git user home direc­tory and par­tic­u­larly: repos­i­to­ries. In order to do that, repos­i­to­ries folder has to have at least 770 per­mis­sions — you have set this cor­rectly. Now you have to make sure that what­ever user web server is run­ning as, he is in git group. You can check it with:
id [user_name]
It will show you all groups that web server user is mem­ber of.
I use Apache, so my user is ‘apache’.

In order to add apache user to git group you can do some­thing like this:
user­mod –G –a git apache