Top > インストールガイド > CentOS5+Pound+Mongrel
インストールガイド (CentOS5+Pound+Mongrel)
対象バージョン
当ドキュメントはRubricks-0.6.9向けです。
最新版での動作確認を行っていません。
当ドキュメントは参考情報としてご覧下さい。
CentOS 5.0のインストール情報
IP Address : 192.168.0.10 Gateway : 192.168.0.254 Host Name : rubricks Package Group : 「言語-日本語のサポート」以外全て削除
SELinuxの停止
vi /etc/selinux/config ==[/etc/selinux/config]===================================== (省略) SELINUX=disabled (省略) ==[/etc/selinux/config]=====================================
不要なデーモンの停止
chkconfig haldaemon off chkconfig ip6tables off chkconfig iptables off chkconfig kudzu off chkconfig mcstrans off chkconfig messagebus off chkconfig netfs off chkconfig restorecond off chkconfig xfs off
RPMの更新
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 yum -y update yum -y install crontabs logrotate sudo telnet unzip vixie-cron wget which zip shutdown -r now
MySQLの導入
yum -y install mysql mysql-server perl-DBI perl-DBD-MySQL
vi /etc/my.cnf
==[/etc/my.cnf]=============================================
[mysqld_safe]
pid-file = /var/lib/mysql/mysqld.pid
err-log = /var/log/mysql/mysqld.log
[mysqld]
user = mysql
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
datadir = /var/lib/mysql/data
max_allowed_packet = 24M
long_query_time = 1
log-bin = /var/log/mysql/update-bin
expire_logs_days = 7
log-slow-queries = /var/log/mysql/slow_query.log
thread_concurrency = 8
max_connections = 200
thread_cache_size = 200
table_cache = 1024
query_cache_type = 1
query_cache_size = 16M
join_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 8M
sort_buffer_size = 8M
tmp_table_size = 32M
skip-locking
key_buffer = 8M
skip-bdb
bdb_cache_size = 8M
innodb_data_home_dir = /var/lib/mysql/data
innodb_data_file_path = ibdata1:128M:autoextend
innodb_log_group_home_dir = /var/log/mysql_innodb/
innodb_log_arch_dir = /var/log/mysql_innodb/
innodb_buffer_pool_size = 512M
innodb_additional_mem_pool_size = 8M
innodb_log_file_size = 128M
innodb_log_buffer_size = 16M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
innodb_file_per_table
[client]
user = root
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
[mysql]
user = root
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
no-auto-rehash
safe-updates
[mysqladmin]
user = root
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
[mysqldump]
default-character-set = utf8
max_allowed_packet = 16M
quick
[mysqlhotcopy]
interactive-timeout
==[/etc/my.cnf]=============================================
mkdir /var/log/{mysql,mysql_innodb}
chown mysql.mysql /var/log/{mysql,mysql_innodb}
chmod 700 /var/log/{mysql,mysql_innodb}
mysql_install_db --defaults-file=/etc/my.cnf
chkconfig --level 2345 mysqld on
service mysqld start
mysql
mysql> REVOKE GRANT OPTION on *.* from ''@localhost;
mysql> DROP USER ''@rubricks;
mysql> DROP USER ''@localhost;
mysql> DROP DATABASE test;
mysql> CREATE DATABASE rubricks;
mysql> GRANT ALL ON rubricks.* TO rubricks@localhost;
mysql> CREATE DATABASE rubricks_test;
mysql> GRANT ALL ON rubricks_test.* TO rubricks@localhost;
mysql> EXIT
Apache/Pound/Ruby/Mongrelの導入
注)
以下の手順で利用する一部のRPMはCentOS公式のものではなく、utaが独自にビルドしたものです。
試用するには手軽ですが、実運用時の利用は推奨致しません。
vi /etc/yum.repos.d/u-jp.repo
==[/etc/yum.repos.d/u-jp.repo]==========================
[u-jp]
name=CentOS-$releasever - u-jp
baseurl=http://repos.u-jp.com/$basearch/
enabled=1
gpgcheck=0
==[/etc/yum.repos.d/u-jp.repo]==========================
yum -y install httpd apr apr-util mailcap postgresql-libs
yum -y install Pound
yum -y install ruby ruby-docs ruby-irb ruby-libs ruby-rdoc ruby-ri
yum -y install rubygems rake daemons gem_plugin fastthread cgi_multipart_eof_fix mongrel mongrel_cluster
vi /etc/httpd/conf/httpd.conf
==[/etc/httpd/conf/httpd.conf]==========================
LoadModule authz_host_module modules/mod_authz_host.so
LoadModule dir_module modules/mod_dir.so
LoadModule log_config_module modules/mod_log_config.so
LoadModule mime_module modules/mod_mime.so
ServerRoot /etc/httpd
DocumentRoot /var/www/html
PidFile /var/run/httpd.pid
User apache
Group apache
ServerName 192.168.0.10
Listen 8080
ServerSignature Off
ServerTokens Prod
DirectoryIndex index.html
HostnameLookups Off
TypesConfig /etc/mime.types
DefaultType text/plain
AddDefaultCharset utf-8
<Directory />
Options None
AllowOverride None
Deny from all
</Directory>
Timeout 300
KeepAlive On
MaxKeepAliveRequests 10000
KeepAliveTimeout 10
StartServers 8
MinSpareServers 5
MaxSpareServers 20
ServerLimit 256
MaxClients 256
MaxRequestsPerChild 10000
ErrorLog /var/log/httpd/error.log
LogLevel error
LogFormat '%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"' combined
CustomLog /var/log/httpd/access.log combined
#===[Setting for Static]=======================================================#
<VirtualHost *:8080>
ServerName 192.168.0.10
DocumentRoot /var/mongrel/rubricks/public
<Directory /var/mongrel/rubricks/public>
Options None
AllowOverride None
Allow from all
</Directory>
</VirtualHost>
==[/etc/httpd/conf/httpd.conf]==========================
chown -R apache.apache /var/www/html
chmod 700 /var/www/{cgi-bin,error,html,icons}
chkconfig --level 2345 httpd on
service httpd start
vi /etc/pound/pound.cfg
==[/etc/pound/pound.cfg]================================
User "pound"
Group "pound"
RootJail "/var/pound"
Daemon 1
LogFacility local6
LogLevel 4
Alive 30
Control "/var/pound/poundctl.sock"
ListenHTTP
Address 0.0.0.0
Port 80
xHTTP 0
Client 30
Err414 "/var/pound/errors/414.html"
Err500 "/var/pound/errors/500.html"
Err501 "/var/pound/errors/501.html"
Err503 "/var/pound/errors/503.html"
Service
URL ".*.(css|jpeg|jpg|js|gif|png|swf)"
BackEnd
Address localhost
Port 8080
End
End
Service
BackEnd
Address localhost
Port 3000
Timeout 180
End
BackEnd
Address localhost
Port 3001
Timeout 180
End
BackEnd
Address localhost
Port 3002
Timeout 180
End
BackEnd
Address localhost
Port 3003
Timeout 180
End
BackEnd
Address localhost
Port 3004
Timeout 180
End
BackEnd
Address localhost
Port 3005
Timeout 180
End
BackEnd
Address localhost
Port 3006
Timeout 180
End
BackEnd
Address localhost
Port 3007
Timeout 180
End
BackEnd
Address localhost
Port 3008
Timeout 180
End
BackEnd
Address localhost
Port 3009
Timeout 180
End
Session
Type COOKIE
TTL 3600
ID "_session_id"
End
End
End
==[/etc/pound/pound.cfg]================================
chkconfig --level 2345 pound on
service pound start
Rubricksの導入
wget http://rubyforge.org/frs/download.php/xxxxx/rubricks-0.X.X.tar.gz tar -zxf rubricks-0.X.X.tar.gz -C /var/mongrel/ chmod 701 /var/mongrel chown -R mongrel.mongrel /var/mongrel/rubricks cp /var/mongrel/rubricks/config/sample1_environment.rb /var/mongrel/rubricks/config/environment.rb cp /var/mongrel/rubricks/config/sample1_database.yml /var/mongrel/rubricks/config/database.yml vi /var/mongrel/rubricks/config/environment.rb ==[/var/mongrel/rubricks/config/environment.rb]============= (省略) ENV['RUBRICKS_SERVER_CONTROL'] = 'true' ==[/var/mongrel/rubricks/config/environment.rb]============= cd /var/mongrel/rubricks export RAILS_ENV=production rake db:migrate chown -R mongrel.mongrel /var/mongrel/rubricks chkconfig --level 2345 mongrel_rubricks on service mongrel_rubricks start
動作確認
ブラウザで http://192.168.0.10/ にアクセスすると、Rubricksトップページが表示されます。
管理者ユーザでログインしてください。デフォルトの管理者のユーザ名及びパスワードは以下の通りです。
| ユーザ名 | 'admin' |
| パスワード | 'pass' |
