Skip to content

Instantly share code, notes, and snippets.

@zaeleus
Created December 23, 2012 08:04
Show Gist options
  • Save zaeleus/4362544 to your computer and use it in GitHub Desktop.
Save zaeleus/4362544 to your computer and use it in GitHub Desktop.
Gitlab install on CentOS 6.3 (2012-09-13)
-- 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: [email protected]
-- password: 5iveL!fe
@eehpcm
Copy link

eehpcm commented Jan 9, 2013

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment