public
Created

Gitlab install on CentOS 6.3 (2012-09-13)

  • Download Gist
gitlab_centos6.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
-- install packages
 
# yum update
# yum groupinstall "Development Tools" "Additional Development"
-- epel for redis, libyaml, pip, qtwebkit-devel
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm
# yum install libicu-devel libyaml-devel redis wget python-pip qt-devel qtwebkit-devel
 
-- install ruby
 
# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
# tar xfvz ruby-1.9.3-p194.tar.gz
# cd ruby-1.9.3-p194
# ./configure
# make
# make install
 
-- install gitolite
 
# adduser --system --shell /bin/sh --comment 'git version control' --user-group --create-home --home-dir /home/git git
# adduser --shell /bin/bash --create-home --home-dir /home/gitlab gitlab
# su - gitlab
$ ssh-keygen -t rsa
$ exit
# cp ~gitlab/.ssh/id_rsa.pub ~git/gitlab.pub
# chmod 0444 ~git/gitlab.pub
# su - git
$ git clone git://github.com/gitlabhq/gitolite ~/gitolite
$ echo -e "PATH=\$PATH:/home/git/bin\nexport PATH" >> ~/.profile
$ source ~/.profile
$ gitolite/src/gl-system-install
$ sed -i 's/0077/0007/g' share/gitolite/conf/example.gitolite.rc
$ gl-setup -q /home/git/gitlab.pub
$ exit
 
# usermod -a -G git gitlab
# chmod 750 /home/git
# chmod -R g+rwX /home/git/repositories/
# chown -R git:git /home/git/repositories/
# passwd gitlab
# visudo
-- uncomment %wheel for root (or just give the gitlab user sudo privileges)
# usermod -a -G wheel gitlab
-- test if gitlab can login with pubkey
# su gitlab
$ ssh git@localhost
 
-- install mysql
 
# yum install mysql-server
# service mysqld start
# mysql_secure_installation
# mysql -u root -p
mysql> CREATE DATABASE gitlab CHARACTER SET UTF8;
mysql> GRANT ALL PRIVILEGES ON gitlab.* TO 'gitlab'@'localhost' IDENTIFIED BY 'secret' WITH GRANT OPTION;
mysql> quit
 
-- start redis
 
# service redis start
 
-- install gitlab
 
# gem update --system
# gem update --no-ri --no-rdoc
# gem install rails bundler --no-ri --no-rdoc
# gem install charlock_holmes --version '0.6.8' --no-ri --no-rdoc
# pip-python install pygments
 
# su - gitlab
 
$ echo 'export PATH=$PATH:/usr/lib64/qt4/bin' >> .bashrc
$ source .bashrc
 
$ git clone -b stable git://github.com/gitlabhq/gitlabhq.git ~/gitlab
$ cd ~/gitlab
 
$ bundle install --without development test --deployment
 
$ sudo cp ./lib/hooks/post-receive /home/git/share/gitolite/hooks/common/post-receive
$ sudo chown git:git /home/git/share/gitolite/hooks/common/post-receive
 
$ cp config/gitlab.yml.example config/gitlab.yml
$ cp config/database.yml.example config/database.yml
 
$ vim config/database.yml
 
$ RAILS_ENV=production bundle exec rake gitlab:app:setup
$ RAILS_ENV=production BACKGROUND=yes bundle exec rake environment resque:work QUEUE=*
$ RAILS_ENV=production bundle exec rake gitlab:app:status
$ bundle exec rails s -e production
 
-- http://localhost:3000/
-- username: admin@local.host
-- password: 5iveL!fe

The step

$ RAILS_ENV=production bundle exec rake gitlab:app:status

is for gitlab 3.1 and below. For 4.0+ use

$ RAILS_ENV=production bundle exec rake gitlab:check

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.