参考
apt-get install -y build-essential apache2 mysql-server mysql-client git git-svn apg geoip-bin libgeoip1 libgeoip-dev sqlite3 libsqlite3-dev imagemagick libpcre3 libpcre3-dev zlib1g zlib1g-dev libyaml-dev libmysqlclient15-dev apache2-dev postfix apt-get install libonig2 memcached aspell-en aspell libaspell-dev
wget http://www.sphinxsearch.com/downloads/sphinx-0.9.8.tar.gz tar xvfz sphinx-0.9.8.tar.gz cd sphinx-0.9.8 ./configure && make && make install
cd /home/gitorious git clone git@gitorious.org/gitorious/mainline.git
apt-get install uuid uuid-dev openjdk-6-jre wget http://www.powertech.no/apache/dist/activemq/apache-activemq/5.2.0/apache-activemq-5.2.0-bin.tar.gz tar xzvf apache-activemq-5.2.0-bin.tar.gz -C /usr/local/ adduser --system --no-create-home activemq echo "export ACTIVEMQ_HOME=/usr/local/apache-activemq-5.2.0" >> /etc/activemq.conf echo "export JAVA_HOME=/usr/" >> /etc/activemq.conf chown -R activemq /usr/local/apache-activemq-5.2.0/data
/usr/local/apache-activemq-5.2.0/conf/activemq.xml の書き換え
<networkConnector name="localhost" uri="static://(tcp://127.0.0.1:61616)"/>
wget http://launchpadlibrarian.net/15645459/activemq mv activemq /etc/init.d chmod +x /etc/init.d/activemq
wget http://rubyforge.org/frs/download.php/64475/ruby-enterprise-1.8.7-20090928.tar.gz apt-get install libreadline5-dev
展開して installというスクリプトを叩くとインストール開始. おわるとこんなのが表示.
If want to use Phusion Passenger (http://www.modrails.com) in combination with Ruby Enterprise Edition, then you must reinstall Phusion Passenger against Ruby Enterprise Edition, as follows: /opt/ruby-enterprise-1.8.7-20090928/bin/passenger-install-apache2-module Make sure you don't forget to paste the Apache configuration directives that the installer gives you. If you ever want to uninstall Ruby Enterprise Edition, simply remove this directory: /opt/ruby-enterprise-1.8.7-20090928
/etc/profileに追加
export PATH=/opt/ruby-enterprise-1.8.7-20090928/bin:$PATH export LD_LIBRARY_PATH="/usr/local/lib" export LDFLAGS="-L/usr/local/lib -Wl,-rpath,/usr/local/lib"
source /etc/profile
passengerのインストーラ起動
passenger-install-apache2-module
/etc/apache2/mods-available/passenger.loadを作る
LoadModule passenger_module /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/passenger-2.2.5/ext/apache2/mod_passenger.so PassengerRoot /opt/ruby-enterprise-1.8.7-20090928/lib/ruby/gems/1.8/gems/passenger-2.2.5 PassengerRuby /opt/ruby-enterprise-1.8.7-20090928/bin/ruby
a2enmod passenger
/etc/apache2/sites-available/gitoriousを編集してからa2ensite gitorious
<VirtualHost *:80> ServerName codes.mlab.t.u-tokyo.ac.jp DocumentRoot /home/gitorious/gitorious/public # <-- be sure to point to 'pu blic'! </VirtualHost>
apt-get install libonig-dev libmagick9-dev gem install raspell mime-types oniguruma textpow chronic BlueCloth ruby-yadis ruby-openid rmagick geoip ultrasphinx rspec rspec-rails RedCloth echoe daemons geoip --no-rdoc --no-ri
public/.htaccsss 以下のように書いてあるのを消した.
RewriteEngine on RewriteRule ^projects/([a-zA-z0-9\-_]+)/?$ /$1 [R=301,L] RewriteRule ^projects/([a-zA-z0-9\-_]+)/repos/([a-zA-z0-9\-_]+)(.+)?$ /$1/$2$3 [R=301,L]
doc/templates/ubuntu/{git-ultrasphinx,git-daemon} を /etc/init.d以下にコピーしてかきかえる.そして chmod +x しとく.
root@codes:/etc/init.d# update-rc.d git-ultrasphinx start 99 2 3 4 5 . root@codes:/etc/init.d# update-rc.d git-daemon start 99 2 3 4 5 .
adduser git chown -R git:git /home/gitorious su - git
config/database.ymlをexampleからコピーして作成.rootのパスワードを設定する.
config/gitorious.ymlをいじる.重要なのは,cookie_secret, gitorious_host
rake をうごかしてみるといくつか足りないgemがあるようなので追加.
gem install rdiscount stomp diff-lcs json mocha gem install rdiscount -v 1.3.1.1 gem install ruby-hmac
rake tmp:create rake db:create RAILS_ENV=production rake db:migrate RAILS_ENV=production rake ultrasphinx:bootstrap RAILS_ENV=production
export RUBY_HOME=/opt/ruby-enterprise-1.8.7-20090928 export GEM_HOME=$RUBY_HOME/lib/ruby/gems/1.8/gems export PATH=$RUBY_HOME/bin:$PATH
logrotateの設定.
broker.ymlを設定する.
gem install stompserver ln -s /opt/ruby-enterprise-1.8.7-20090928/bin/stompserver /usr/bin
さらに /etc/init.d/stompを設定する.
http://millarian.com/programming/installing-aspell-and-raspell-for-ultrasphinx/ をまず見る.
rootでこれをやる.
rake ultrasphinx:spelling:build RAILS_ENV=production
araki:20091108aとaraki:20091108b
CentOS5.3でgitoriousを動かすまで.
以下は,gitorious.orgにある2009年11月7日版で動かす話.
おおむね,http://gitorious.org/gitorious/mainline/blobs/master/doc/recipes/install-centos.txtのがいいと思います.
CentOSのpackage以外で利用したものは以下の通り.
http://gitorious.org/gitorious/mainline/blobs/master/doc/recipes/install-centos.txt にある通りなのだが違うところ.
/etc/init.d/git-daemon
#!/bin/bash
#
# Init file for Gitorious GIT-Daemon daemon
#
# chkconfig: 2345 55 25
# description: GIT-Daemon server daemon
#
# processname: git-daemon
# pidfile: /var/www/gitorious/log/git-daemon.pid
# source function library
. /etc/rc.d/init.d/functions
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH
RETVAL=0
PROG="git daemon"
GIT_DAEMON="/usr/local/ruby-enterprise/bin/ruby /var/www/gitorious/script/git-da
emon -d"
LOCK_FILE=/var/lock/git-daemon
PID_FILE=/var/www/gitorious/log/git-daemon.pid
do_check_pid() {
if [ -f $PID_FILE ]; then
PID=`cat $PID_FILE`
RUNNING=`ps --pid $PID | wc -l`
else
PID=0
RUNNING=0
fi
}
runlevel=$(set -- $(runlevel); eval "echo \$$#" )
start()
{
do_check_pid
if [ $RUNNING != 2 ] ; then
echo -n $"Starting $PROG: "
/bin/su git -c "$GIT_DAEMON"
sleep 1
if [ -f $PID_FILE ] ; then
success
else
failure
fi
RETVAL=$?
else
echo -n $"$PROG already running"
failure
fi
[ "$RETVAL" = 0 ] && touch $LOCK_FILE
echo
}
stop()
{
do_check_pid
echo -n $"Stopping $PROG: "
if [ $RUNNING != 2 ] ; then
failure $"Stopping $PROG"
else
killproc -p $PID_FILE
fi
RETVAL=$?
# if we are in halt or reboot runlevel kill all running sessions
# so the TCP connections are closed cleanly
if [ "x$runlevel" = x0 -o "x$runlevel" = x6 ] ; then
killproc -p $PID 2>/dev/null
fi
[ "$RETVAL" = 0 ] && rm -f $LOCK_FILE
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $LOCK_FILE ] ; then
if [ "$RETVAL" = 0 ] ; then
stop
# avoid race
sleep 5
start
fi
fi
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart}"
RETVAL=1
esac
exit $RETVAL
/etc/init.d/ultrasphinx
#!/bin/bash
#
# Init file for Gitorious Ultrasphinx daemon
#
# chkconfig: 2345 55 25
# description: Ultrasphinx server daemon
#
# processname: searchd
# pidfile: /var/www/gitorious/db/sphinx/log/searchd.pid
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH
RETVAL=0
START_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:start RAILS_ENV=production"
STOP_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:stop RAILS_ENV=production"
RESTART_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:restart RAILS_ENV=production"
STATUS_CMD="cd /var/www/gitorious/ && rake ultrasphinx:daemon:status RAILS_ENV=production"
LOCK_FILE=/var/lock/git-ultrasphinx
PID_FILE=/var/www/gitorious/db/sphinx/log/searchd.pid
case "$1" in
start)
/bin/su git -c "$START_CMD"
;;
stop)
/bin/su git -c "$STOP_CMD"
;;
status)
/bin/su git -c "$STATUS_CMD"
;;
restart)
/bin/su git -c "$RESTART_CMD"
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
esac
exit $RETVAL
/etc/init.d/stomp
#!/bin/bash
#
# Init file for Gitorious stomp daemon
#
# chkconfig: 2345 55 25
# description: stomp server daemon
#
# processname: stomp
# pidfile: /var/www/gitorious/log/stomp.pid
# source function library
. /etc/rc.d/init.d/functions
PATH=/usr/local/ruby-enterprise/bin:/usr/local/bin:$PATH
RETVAL=0
PROG=/usr/local/bin/stompserver
DAEMON=/usr/local/bin/stompserver
LOCK_FILE=/var/lock/stomp
#PID_FILE=/var/www/gitorious/log/stomp.pid
runlevel=$(set -- $(runlevel); eval "echo \$$#" )
start()
{
echo -n $"Starting $PROG: "
$DAEMON > /dev/null &
sleep 1
}
stop()
{
echo -n $"Stopping $PROG: "
killall stompserver
echo
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart}"
RETVAL=1
esac
exit $RETVAL
おわったらこの3つの/etc/init.d以下のファイルはchkconfig -add file名 で追加.
crontabにtask_performerはもういらない.
CentOS5.3にgitoriousをいれる続き.
自分がはまったところ.
「gitoriousを動かすvirtualhostにパスワード認証がかかっている」が故の問題
gitoriousは内部から内部に対して 正確には gitorious_client_host と gitorious_client_port で指定した先にアクセスがある.
ここに認証をかけたりすると,あっさりあきらめられてしまうので,このアクセスが通るように指定しておく必要がある.
例えば、同じネットワーク上にいる人にはウェブサイトのある部分について 無制限のアクセスを許したいけれど、外のネットワークの人には パスワードを提供させるようにするためには、次のような設定をすることが できます:
Require valid-user Allow from 192.168.1 Satisfy Anyバージョン 2.0.51 からは セクションと セクションを使用することで Satisfy ディレクティブが 適用されるメソッドを制限することが できるようになりました。
gitoriousはgit pushをするのに内部でsshをする.
それゆえ,git ユーザはsshで外部から接続できなければならない.ダミーでいいのでパスワードを設定しないと,sshは空のパスワードのアカウントには例え公開鍵ログインの場合でも許可してくれない.