Skip to content

V1.2 easy setup for ubuntu

seventoes edited this page Dec 15, 2011 · 2 revisions

Installing GitLabHQ on Ubuntu Server 10.04 LTS

Download the latest server updates

sudo apt-get update
sudo apt-get dist-upgrade -y

Create a gitlabhq user account

sudo useradd gitlabhq -m 

Set a password for the account

sudo passwd gitlabhq

Add gitlabhq to the admin group so it can sudo

sudo adduser gitlabhq admin

Login as the gitlabhq user

When prompted to accept the authenticity of the RSA key fingerprint type yes

ssh gitlabhq@localhost

Download prerequisite packages including postfix for sending email

sudo aptitude install git-core curl gcc libxml2-dev libxslt-dev sqlite3 libsqlite3-dev libcurl4-openssl-dev libreadline5-dev libc6-dev libssl-dev libmysql++-dev make build-essential zlib1g-dev python-dev python-setuptools postfix gitosis -y

Download tar of ruby 1.9.2

wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.2-p290.tar.gz

Extract Ruby tar

tar zxvf ruby-1.9.2-p290.tar.gz

Configure, make, and install

cd ruby-1.9.2-p290
./configure
make
sudo make install

Verify Ruby installed correctly

cd ~
ruby --version

Update the Ruby Gems to the latest version

sudo gem update --system

Configure gem not to install rdoc or ri

echo "gem: --no-rdoc --no-ri" > ~/.gemrc

Install Gitosis

sudo aptitude install gitosis -y

Now add a dedicated git user for Gitosis interaction

sudo adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git

Add the gitlabhq user to the new git group

sudo usermod -a -G git gitlabhq

Create ssh key

When prompted for the file in which to save the file, press Enter When prompted for a passphrase, press Enter When prompted to confirm the passphrase again, press Enter

ssh-keygen -t rsa

Now run the gitosis-init command as the newly created git user account and give it the gitlabhq users public key we just created

sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub

Copy the SSH public key for the gitlabhq user to the git user account

sudo cp /home/gitlabhq/.ssh/id_rsa.pub /home/git/.ssh/id_rsa.pub

We need to change the permissions on the gitosis admin repo hook

sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update

Install Rails framework

sudo gem install rails

Change to your home directory, clone the gitlabhq code, then change to that directory

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

Open the Rakefile to edit

nano Rakefile

To prevent the Rake::DSL error, add the following two lines right after the last comment. Use Control + X, then Y to save and exit

require 'rake/dsl_definition'
require 'rake'

Install gitlabhq dependencies

sudo easy_install pygments
sudo gem install bundler
sudo bundle install

Now connect to your localhost again and accept the fingerprint When prompted authenticate the RSA key fingerprint, type yes

ssh localhost
exit

Setup the gitlabhq database

bundle exec rake db:setup RAILS_ENV=production

Next seed the database with the initial data needed

bundle exec rake db:seed_fu RAILS_ENV=production

Start the server using WEBrick

rails s -e production

Verify that the server is up and running now by connecting using your web browser

Default login credentials

Clone this wiki locally