mokky14's IT diary

IT関係の仕事メモ、勉強会の感想など書いてます。

redmineのCentOSへのインストールとサービス登録

CentOS環境にredmine(bitnami版)をインストールしてみたのでメモ。

 

ファイルはここからLinux用のファイルをダウンロード
ダウンロードしたファイルは以下。
 bitnami-redmine-2.3.0-0-linux-x64-installer.run 

 

インストールはダウンロードした上記ファイルに実行権付与して実行するだけ。
GUIインストーラが起動するので、画面内容に従ってインストール。
特に難しいところはなかった。

インストール後、インストールディレクトリのctlscript.shでredmineを起動する。

# ./ctlscript.sh start
130401 15:09:07 mysqld_safe Logging to '/opt/redmine-2.3.0-0/mysql/data/mysqld.log'.
130401 15:09:07 mysqld_safe Starting mysqld.bin daemon with databases from /opt/redmine-2.3.0-0/mysql/data
/opt/redmine-2.3.0-0/mysql/scripts/ctl.sh : mysql  started at port 3306
Syntax OK
/opt/redmine-2.3.0-0/apache2/scripts/ctl.sh : httpd started at port 80
/opt/redmine-2.3.0-0/subversion/scripts/ctl.sh : subversion started at port 3690

せっかくなので、サービスとして登録してみる。 
上記ctlscript.shは引数的にサービス用のスクリプトとして使用出来るのかなと思ったので、スクリプトへのリンク作って登録してみる。

# cd /etc/init.d/
# ln -s /opt/redmine-2.3.0-0/ctlscript.sh redmine
# chkconfig --add redmine
サービス redmine は、chkconfig をサポートしていません。

ダメらしい。
調べてみたら、起動スクリプトには「chkconfig: 」と「description: 」の設定が必要とか。*1
ということで、redmineスクリプトを作って/etc/init.dに置いた。ファイルの内容は以下。

#!/bin/sh
# chkconfig: 345 99 99
# description: redmine

INSTDIR=/opt/redmine-2.3.0-0
SCRIPT=$INSTDIR/ctlscript.sh

$SCRIPT $1
exit $?

改めて登録。

# chkconfig --add redmine
# chkconfig --list redmine
redmine         0:off   1:off   2:off   3:on    4:on    5:on    6:off

めでたく登録出来た。

一応、起動・停止の確認を。

# service redmine start
130401 15:36:51 mysqld_safe Logging to '/opt/redmine-2.3.0-0/mysql/data/mysqld.log'.
130401 15:36:51 mysqld_safe Starting mysqld.bin daemon with databases from /opt/redmine-2.3.0-0/mysql/data
/opt/redmine-2.3.0-0/mysql/scripts/ctl.sh : mysql  started at port 3306
Syntax OK
/opt/redmine-2.3.0-0/apache2/scripts/ctl.sh : httpd started at port 80
/opt/redmine-2.3.0-0/subversion/scripts/ctl.sh : subversion started at port 3690
# ps -ef|grep redmine
root       326     1  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
102        337     1  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/subversion/bin/.svnserve.bin -d --listen-port=3690 --pid-file=/opt/redmine-2.3.0-0/subversion/tmp/svnserve.pid
daemon     357   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     358   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     359   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     360   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     361   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     380   343 29 15:37 ?        00:00:06 Passenger AppPreloader: /opt/redmine-2.3.0-0/apps/redmine/htdocs                                                                               
daemon     426   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     435   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     436   326  0 15:37 ?        00:00:00 /opt/redmine-2.3.0-0/apache2/bin/httpd -f /opt/redmine-2.3.0-0/apache2/conf/httpd.conf
daemon     449   380  5 15:37 ?        00:00:00 Passenger RackApp: /opt/redmine-2.3.0-0/apps/redmine/htdocs                                                                                    
daemon     457   380  5 15:37 ?        00:00:00 Passenger RackApp: /opt/redmine-2.3.0-0/apps/redmine/htdocs                                                                                    
root       482 30909  0 15:37 pts/2    00:00:00 grep redmine
root     32485     1  0 15:36 pts/2    00:00:00 /bin/sh /opt/redmine-2.3.0-0/mysql/bin/mysqld_safe --defaults-file=/opt/redmine-2.3.0-0/mysql/my.cnf --port=3306 --socket=/opt/redmine-2.3.0-0/mysql/tmp/mysql.sock --datadir=/opt/redmine-2.3.0-0/mysql/data --log-error=/opt/redmine-2.3.0-0/mysql/data/mysqld.log --pid-file=/opt/redmine-2.3.0-0/mysql/data/mysqld.pid --lower-case-table-names=1
mysql    32747 32485  0 15:36 pts/2    00:00:00 /opt/redmine-2.3.0-0/mysql/bin/mysqld.bin --defaults-file=/opt/redmine-2.3.0-0/mysql/my.cnf --basedir=/opt/redmine-2.3.0-0/mysql --datadir=/opt/redmine-2.3.0-0/mysql/data --plugin-dir=/opt/redmine-2.3.0-0/mysql/lib/plugin --user=mysql --lower-case-table-names=1 --log-error=/opt/redmine-2.3.0-0/mysql/data/mysqld.log --pid-file=/opt/redmine-2.3.0-0/mysql/data/mysqld.pid --socket=/opt/redmine-2.3.0-0/mysql/tmp/mysql.sock --port=3306
# service redmine stop
/opt/redmine-2.3.0-0/subversion/scripts/ctl.sh : subversion stopped
Syntax OK
/opt/redmine-2.3.0-0/apache2/scripts/ctl.sh : httpd stopped
130401 15:37:56 mysqld_safe mysqld from pid file /opt/redmine-2.3.0-0/mysql/data/mysqld.pid ended
/opt/redmine-2.3.0-0/mysql/scripts/ctl.sh : mysql stopped
# ps -ef|grep redmine
root       545 30909  0 15:38 pts/2    00:00:00 grep redmine
# 

問題なさそう。