====== Gitorious ======
This is for setting up [[http://gitorious.org/|Gitorious]] on Centos 6.
Based on the guide here: [[http://famousphil.com/blog/2011/06/installing-gitorious-on-centos-5-6-x64/]]
===== Installation =====
==== prep ====
- might as well enable eth0 (or make sure it is enabled, brainiac is registered)
- install rpmforge, set the following to includepkgs:
* apg libyaml* GeoIP* sphinx
- install: yum install git-core git-svn java-1.6.0-openjdk apg pcre pcre-devel zlib zlib-devel libyaml-devel GeoIP-devel sphinx mysql-devel mysql-server mysql
- install: yum install -y tcl-devel libpng-devel libjpeg-devel ghostscript-devel bzip2-devel freetype-devel libtiff-devel ImageMagick-devel
- yum install rubygems ruby-devel
- (for nokogiri gem) yum install gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
- yum install -y httpd httpd-devel mod_ssl mod_xsendfile (add mod_xsendfile to epel.repo)
- yum install rubygem-rake libcurl-devel
- install remi repo: yum install /src/files/repos/rhel6/remi-release-6.rpm
- add git user, and setup some directories: # useradd -d /home/git git
# su - git
$ mkdir {log,conf}
$ mkdir -p data/{repos,tarballs,tarballs-work}
- fix perms: # chmod 755 /home/git
# chmod 777 /home/git/data/
- setup ssh keys
- setup sshd_config for keys
- setup ssh_config KeySign crap
==== MySQL ====
- start mysql, and run the initial setup (answer yes to the prompts after setting password):# service mysqld start
# /usr/bin/mysql_secure_installation
- configure mysql (settings for database.yml as well): # mysql -u root -p
mysql> create database gitorious;
mysql> create database gitorious_test;
mysql> create database gitorious_dev;
mysql> CREATE user 'git'@'localhost' IDENTIFIED BY '';
mysql> GRANT ALL ON gitorious.* TO 'git'@'localhost';
mysql> GRANT ALL ON gitorious_test.* TO 'git'@'localhost';
mysql> GRANT ALL ON gitorious_dev.* TO 'git'@'localhost';
mysql> FLUSH privileges;
mysql> exit;
- enable MySQL: # chkconfig mysqld on
==== gitorious ====
- on ein, clone the git repo: git clone git://gitorious.org/gitorious/mainline.git gitorious
- back on brainiac, clone the git repo as the git user: $ git clone /src/files/git/gitorious gitorious
- edit a few things: $ cd gitorious
$ mkdir tmp/pids
$ exit
# ln -s /home/git/gitorious/script/gitorious /usr/local/bin/gitorious
# cd /home/git/gitorious
# chmod ug+x script/*
# chmod -R g+w config/ log/ public/ tmp/
- su - git edit files (RUBY_HOME="/usr/lib/ruby")
* settings:
* RUBY_HOME="/usr/lib/ruby"
* GEMS_HOME="/usr/lib/ruby/gems/1.8/gems/stompserver-0.9.9"
* GITORIOUS_HOME="/home/git/gitorious"
* files:
* gitorious/doc/templates/centos/stomp
* gitorious/doc/templates/centos/git-ultrasphinx
* gitorious/doc/templates/centos/git-poller
* also, export _JAVA_OPTIONS=-Xmx64m
* gitorious/doc/templates/centos/git-daemon
* other files (not with above settings):
* gitorious/config/gitorious.yml (gitorious.sample.yml)
* database.sample.yml
* broker.yml.example
- now install some bundles as root: # gem install bundle
# cd /home/git/gitorious
# bundle install
# bundle exec rake gems:install
or if that fails,
# bundle exec rake gems:install RAILS_ENV=production
# gem install stompserver (it wasn't installed with the bundle)
- install/start the daemons:
chmod 0666 /home/git/gitorious/log/production.log
ln -s /home/git/gitorious/doc/templates/centos/git-daemon /etc/init.d/git-daemon
chkconfig --add git-daemon
service git-daemon start
** see note/fix below
ln -s /home/git/gitorious/doc/templates/centos/stomp /etc/init.d/stomp
chkconfig --add stomp
service stomp start
** need to add: /home/git/gitorious/tmp/stomp/log/
** need to run: gem install stompserver
ln -s /home/git/gitorious/doc/templates/centos/git-poller /etc/init.d/git-poller
chkconfig --add git-poller
service git-poller start
* fix for problem starting git-daemon, needed on centos6:
- run: # git clone git://github.com/roman/rots.git
- run: # cd rots && gem build rots.gemspec && gem install rots-0.2.1.gem
- run: rm -rf /usr/lib/ruby/gems/1.8/bundler/gems/rots-babb5559aae8
- edit ''/var/www/gitorious/Gemfile'':
# replace:
gem ''"rots", :git => 'https://github.com/roman/rots.git' ''
# with
gem ''"rots", "~> 0.2.1"''
- run: # bundle install && bundle pack
- run: # export RAILS_ENV=production && \
bundle exec rake db:create && \
bundle exec rake db:migrate && \
bundle exec rake ultrasphinx:bootstrap
==== Apache ====
- edit xsendfile.conf: # vim /etc/httpd/conf.d/xsendfile.conf
#add below LoadModule line
XSendFile on
XSendFilePath /home/git/data/tarballs
XSendFilePath /home/git/data/repos
- gem install passenger
- passenger-install-apache2-module
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby
ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!
AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off
- configure apache (getting tired) - need to get configs
- start apache
- add git admin user:su git
cd ~/gitorious
env RAILS_ENV=production script/create_admin
#sample
Type in Administrator's e-mail:
admin@matthouse.us
Type in Administrator's password:
Admin user created successfully.
exit
==== Ultrasphinx ====
- run ultrasphinx bundles: # cd /home/git/gitorious
# bundle exec rake ultrasphinx:configure RAILS_ENV=production
# bundle exec rake ultrasphinx:index RAILS_ENV=production
# bundle exec rake ultrasphinx:daemon:start RAILS_ENV=production
- install/configure aspell: # yum install aspell
# aspell config dict-dir
# cp vendor/plugins/ultrasphinx/examples/ap.multi /usr/lib64/aspell-0.60/
# bundle exec rake ultrasphinx:spelling:build
- edit ultrasphinx config ''/home/git/gitorious/config/ultrasphinx/production.conf'':
#change "address" to "listen" due to deprecation
listen = 0.0.0.0
- setup init scripts and start service: # ln -s /home/git/gitorious/doc/templates/centos/git-ultrasphinx /etc/init.d/git-ultrasphinx
# chkconfig --add git-ultrasphinx
# service git-ultrasphinx start
You may have to manually kill ultrasphinx (try to stop it with the init script, if you can't, kill it) - then you can use the init script
==== final notes ====
- need? maybe... ln -s /usr/local/bin/gitorious /usr/bin
- if clone/push urls don't display:# cd /var/www/gitorious
# git submodule init
# git submodule update
# cd public/javascripts
# rm all.js (it's probably empty)
===== Notes =====
yum install git-core git-svn java-1.6.0-openjdk vim-* apg pcre pcre-devel zlib zlib-devel libyaml-devel GeoIP-devel sphinx mysql-devel mysql-server mysql
No package apg available.
Package pcre-7.8-3.1.el6.x86_64 already installed and latest version
Package zlib-1.2.3-27.el6.x86_64 already installed and latest version
No package libyaml-devel available.
No package GeoIP-devel available.
No package sphinx available.
using config file '/home/git/gitorious/config/ultrasphinx/production.conf'...
WARNING: key 'address' is deprecated in /home/git/gitorious/config/ultrasphinx/production.conf line 10; use 'listen' instead.
==== not needed ====
* install ruby enterprise: # wget http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.03.tar.gz
# tar xzf blah
# yum install gcc-c++ make zlib-devel openssl-devel readline-devel
# cd ruby-en...
# ./install (accept defaults)
==
{{tag>:linux:server :linux}}