Skip to content
ufna edited this page Nov 28, 2011 · 21 revisions

Requirements

  • ruby 1.9.2
  • sqlite
  • ubuntu/debian
  • pygments lib - sudo pip install pygments
  • gitosis

Install Project

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

# install this library first
sudo pip install pygments
sudo apt-get install python-dev

# To install pygments using easy_install, then
sudo apt-get install python-setuptools
sudo easy_install pygments

# Installing sqlite3 as database
sudo apt-get install libsqlite3-dev

# Install gems
sudo gem install bundler
sudo bundle install --without development test
# If later it wouldn`t work with apache2 or nginx try
# sudo bundle install --path vendor/bundle
# (http://stackoverflow.com/questions/3605235/rails-3-passenger-cant-find-git-gems-installed-by-bundler)

bundle exec rake db:setup RAILS_ENV=production
  
# create admin user 
# [email protected]
# pass.....5iveL!fe
bundle exec rake db:seed_fu RAILS_ENV=production

# you maybe need this to access gitosis
usermod -a -G git username

# give your user access to remove git repo 
# Ex.
#   If you are going to use user 'gitlabhq' for rails server
#   gitlabhq ALL = (git) NOPASSWD: /bin/rm" | sudo tee -a /etc/sudoers
#
echo "USERNAME ALL = (git) NOPASSWD: /bin/rm" | sudo tee -a /etc/sudoers


#
#
#
ssh localhost # type yes. it required once before you use gitlab

Install gitosis, edit /config/gitlab.yml & start server

From gitlabhq folder:

rails s -e production

or as daemon

rails s -e production -d

When you add new repository or ssh key for the first time, server console will ask for a password for your ssh key, if you have entered any.

Install Gitosis

sudo aptitude install gitosis

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

adduser -r -s /bin/sh -c 'git version control' -U -m git # RedHat/Fedora

ssh-keygen -t rsa

sudo -H -u git gitosis-init < ~/.ssh/id_rsa.pub
sudo chmod 755 /home/git/repositories/gitosis-admin.git/hooks/post-update
cd /tmp && git clone git@localhost:gitosis-admin.git 
rm -rf gitosis-admin.git && cd

Install ruby 1.9.2

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

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

tar xfvz ruby-1.9.2-p290.tar.gz

cd ruby-1.9.2-p290
./configure
make
sudo checkinstall -D

sudo gem update --system

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

Passenger + nginx

sudo gem install passenger
sudo passenger-install-nginx-module

sudo vim /opt/nginx/conf/nginx.conf
user gitlabhq staff;

server {
  listen 80;
  server_name your_host;
  root /home/gitlabhq/gitlabhq/public;
  passenger_enabled on;
}

External Links