After a lot of bugs, errors, despair, etc…I’m finally finished Gitlab installation at my VM with Ubuntu Server 12.10.
The default wizard provided by own Gitlab works perfectly IF some small adjusts between and after some steps.
Use the default wizard (https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md) for main guide of Gitlab installation and attempt for steps mentioned bellow on this post and good luck.
Step 1
With this wizard, you can make step 1 directly without modifications.
Step 2
To keep your server organized, you can use another folder for ruby source, for example you can use:
/opt/ruby-1.9.3/
After you do or not this adjust, compile and install normally all step 2.
Steps 3 and 4
For system users and Gitlab-shell, follow default wizard normally.
Step 5
Important: remember to install libmysqlclient-dev package…either Ruby throws some exceptions when it’s install mysql2’s gems.
Step 6
Before the item ‘Install Gems’, you can install separately gem for mysql adapter:
1 2 |
cd /home/git/gitlab/ sudo gem install mysql2 |
After this, continue with default wizard instructions.
When we have configured init.d file, now we going to configure the Apache2 routing for Gitlab app.
Apache2 routing
If you want have an Apache server with pretty urls like:
boss.domain.com
And, you doesn’t have uris like this bellow:
boss.domain.com:3948502/some/page.foo
We going to use an Apache module to do internal routing from 3948502 to 80 ports.
Now install this modules with apt-get manager:
1 |
sudo apt-get install apache2-prefork-dev libapr1-dev libaprutil1-dev |
Now we’ll need install passenger gem to integrates two services,
1 2 3 |
cd /home/git/gitlab/ sudo gem install passenger sudo passenger-install-apache2-module |
The passenger installer will ask you for what you want do…choose the second option ‘install and configure’ …however with you have missing deps, the installer will show they for you.
After passenger’s installation, the installer will print the module location and configuration to be used with your Apache2 sites.
Apache site configurations
This step (and last) it’s very simple. Create your site conf ‘name_of_site.conf’:
1 |
sudo vim /etc/apache2/sites-available/gitlab.conf |
And put this content in this file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19/ext/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.19 PassengerRuby /usr/local/bin/ruby <VirtualHost *:80> ServerName gitlab.your-server.com # Point this to your public folder of teambox DocumentRoot /home/git/gitlab/public ProxyPass /gitlab/ http://gitlab.your-server.com:8081/ ProxyPassReverse /gitlab/ http://gitlab.your-server.com:8081/ <Proxy *> Order deny,allow Allow from all </Proxy> # Custom log file locations ErrorLog /var/log/apache2/gitlab_error.log CustomLog /var/log/apache2/gitlab_access.log combined </VirtualHost> |
Now you only need enable the site and restart gitlab and apache2 services:
1 2 3 |
sudo a2ensite gitlab sudo service gitlab restart sudo service apache2 restart |
It’s done! With all configs has been correct, now you can access your Gitlab’s by those two uris:
http://server-money.com:8081/ and http://gitlab.server-money.com/
Appendix (SSH bugs and more)
After my installation, I’ve problem with SSH auth because my SSH port it’s not a 22 (standard). So, I needed configure the ‘conf’ file under /home/git/.ssh/ folder:
1 2 3 4 |
host gitlab.carlos.inf.br user git port 1951 hostname gitlab.carlos.inf.br; |
After, check the permissions of /home/git/.ssh/ folder, you must set this permissions for him:
1 2 |
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys |
And still needed execute at /home/git/gitlab folder these commands:
1 2 |
sudo -u git -H bundle exec rake sidekiq:start RAILS_ENV=production sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production |
The second command will be validate all your Gitlab installation, repositories and users…and must important, your /home/git/.ssh/authorized_keys.
More bugs, read this page.
References
https://gist.github.com/carlosjrcabello/5486422
https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/installation.md
https://github.com/gitlabhq/gitlabhq/blob/5-0-stable/doc/install/databases.md
http://stackoverflow.com/questions/10954516/apache2-proxypass-for-rails-app-gitlab/16291877#16291877
https://github.com/gitlabhq/gitlab-public-wiki/wiki/Trouble-Shooting-Guide
https://github.com/gitlabhq/gitlab-shell/issues/46
Special thanks to
@lccezinha – support with satanical Ruby errors and Ruby usage and config.
@caarl0s – bitnami installer.