CentOS 6.2
Redmine 1.4.1インストールメモ
2012年4月
目次
2 ImageMagickが導入されていない場合導入する 4
4 Apahceの開発環境が導入されていない場合は導入する 4
[root@cent6 ~]# yum -y install ruby ruby-devel rubygems
[root@cent6 ~]# yum -y install ImageMagick ImageMagick-devel
[root@cent6 ~]# yum -y install mysql mysql-devel
[root@cent6 ~]# yum -y install httpd-devel
[root@cent6 ~]# yum -y install libcurl-devel
iptablesの停止と、SELinuxの無効化
これらを使ってセキュリティの設定が必要な場合、この手順とは別に設定を行ってください。
[root@cent6 ~]# service iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Unloading modules: [ OK ]
[root@cent6 ~]# chkconfig iptables off
現状の確認
[root@cent6 ~]# getenforce
Enforcing
保護状態の解除
[root@cent6 ~]# setenforce Permissive
永続的に無効化する設定
[root@cent6 ~]# vi /etc/sysconfig/selinux
# disabled - No SELinux policy is loaded.
##SELINUX=enforcing
SELINUX=disabled
[root@cent6 ~]#
リリースパッケージの中にある、GemFileを使って、依存モジュールの一括インストールを行います。
RubyForge
[root@cent6 ~]# cd Downloads/
[root@cent6 Downloads]# wget http://rubyforge.org/frs/download.php/76033/redmine-1.4.1.tar.gz
[root@cent6 Downloads]# tar zxf redmine-1.4.1.tar.gz
[root@cent6 Downloads]# cd redmine-1.4.1
[root@cent6 redmine-1.4.1]#
[root@cent6 redmine-1.4.1]# gem install bundler
Successfully installed bundler-1.1.3
1 gem installed
Installing ri documentation for bundler-1.1.3...
Installing RDoc documentation for bundler-1.1.3...
[root@cent6 redmine-1.4.1]#
[root@cent6 redmine-1.4.1]# bundle install --without development test postgresql sqlite
Fetching gem metadata from http://rubygems.org/.......
Using rake (0.9.2.2)
Using activesupport (2.3.14)
Using rack (1.1.3)
Using actionpack (2.3.14)
Using actionmailer (2.3.14)
Using activerecord (2.3.14)
Using activeresource (2.3.14)
Using coderay (1.0.6)
Using fastercsv (1.5.4)
Using i18n (0.4.2)
Using mysql (2.8.1)
Using net-ldap (0.3.1)
Installing rails (2.3.14)
Installing rmagick (2.13.1) with native extensions
Installing ruby-openid (2.1.8)
Installing tzinfo (0.3.33)
Using bundler (1.1.3)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
[root@cent6 redmine-1.4.1]#
後で設定を調整し易くなるように、サンプル設定ファイルを利用します。
[root@cent6 redmine-1.4.1]# cd /etc
[root@cent6 etc]# cp my.cnf my.cnf.org
[root@cent6 etc]# cp /usr/share/mysql/my-medium.cnf my.cnf
cp: overwrite `my.cnf'? y
[root@cent6 etc]#
とりあえず、標準のcharacter-setをutf8に設定する位で、あとは標準地を利用します
各セクションに”default-character-set = utf8”の設定を追記します。
[root@cent6 etc]# vi my.cnf
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients
[client]
#password = your_password
port = 3306
socket = /var/lib/mysql/mysql.sock
default-character-set = utf8
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
port = 3306
socket = /var/lib/mysql/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
default-character-set = utf8
bind-address = 127.0.0.1
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin=mysql-bin
# binary logging format - mixed recommended
binlog_format=mixed
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
# the syntax is:
#
# CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
# MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
# where you replace <host>, <user>, <password> by quoted strings and
# <port> by the master's port number (3306 by default).
#
# Example:
#
# CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
# MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
# start replication for the first time (even unsuccessfully, for example
# if you mistyped the password in master-password and the slave fails to
# connect), the slave will create a master.info file, and any later
# change in this file to the variables' values below will be ignored and
# overridden by the content of the master.info file, unless you shutdown
# the slave server, delete master.info and restart the slaver server.
# For that reason, you may want to leave the lines below untouched
# (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id = 2
#
# The replication master for this slave - required
#master-host = <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
#
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /var/lib/mysql
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /var/lib/mysql
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
default-character-set = utf8
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set = utf8
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
[root@cent6 etc]#
起動時に初期データベースが作成されます。この初期データベースにも、my.cnfの設定内容が反映されますので、必ず、mysqlを起動する前に設定を行ってください。
[root@cent6 etc]# service mysqld start
Initializing MySQL database: WARNING: The host 'cent6.example.co.jp' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
120421 12:45:02 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
120421 12:45:02 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
OK
Filling help tables...
120421 12:45:02 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
120421 12:45:02 [Warning] '--default-character-set' is deprecated and will be removed in a future release. Please use '--character-set-server' instead.
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h cent6.example.co.jp password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
[root@cent6 etc]#
[root@cent6 etc]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61-log Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> show variables like '%char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
mysql> select host,user,password from mysql.user;
+---------------------+------+----------+
| host | user | password |
+---------------------+------+----------+
| localhost | root | |
| cent6.example.co.jp | root | |
| 127.0.0.1 | root | |
| localhost | | |
| cent6.example.co.jp | | |
+---------------------+------+----------+
5 rows in set (0.00 sec)
mysql>
mysql> drop database test;
Query OK, 0 rows affected (0.02 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
+--------------------+
2 rows in set (0.00 sec)
mysql
mysql> delete from mysql.user where user='';
Query OK, 2 rows affected (0.01 sec)
mysql> select host,user,password from mysql.user;
+---------------------+------+----------+
| host | user | password |
+---------------------+------+----------+
| localhost | root | |
| cent6.example.co.jp | root | |
| 127.0.0.1 | root | |
+---------------------+------+----------+
3 rows in set (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> set password = password('password');
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> create database redmine character set utf8;
Query OK, 1 row affected (0.00 sec)
mysql> create user 'redmine'@'localhost' identified by 'my_password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@cent6 etc]#
最初にやってもいいんだけど、ある程度準備が出来てから公開位置に配置するように癖をつけると、アップデートの時にも、このメモをちょっと直せば使えるかな~と
パッケージを/var/www配下に配置してあと、redmine の名前でlincを作成します。
リンクは今後のバージョンアップ作業を便利に進めるための準備です。
[root@cent6 ~]# cp -R Downloads/redmine-1.4.1 /var/www/
[root@cent6 ~]# cd /var/www/
[root@cent6 www]# ln -s redmine-1.4.1/ redmine
[root@cent6 www]# cd redmine-1.4.1/
[root@cent6 redmine-1.4.1]# cp config/database.yml.example config/database.yml
[root@cent6 redmine-1.4.1]# vi config/database.yml
# Default setup is given for MySQL with ruby1.8. If you're running Redmine
# with MySQL and ruby1.9, replace the adapter name with `mysql2`.
# Examples for PostgreSQL and SQLite3 can be found at the end.
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: my_password
encoding: utf8
development:
adapter: mysql
database: redmine_development
host: localhost
username: root
password:
encoding: utf8
[root@cent6 redmine-1.4.1]# rake generate_session_store
Please install RDoc 2.4.2+ to generate documentation.
[root@cent6 redmine-1.4.1]#
[root@cent6 redmine-1.4.1]# RAILS_ENV=production rake db:migrate
[root@cent6 redmine-1.4.1]# RAILS_ENV=production rake redmine:load_default_data
Please install RDoc 2.4.2+ to generate documentation.
Select language: ar, bg, bs, ca, cs, da, de, el, en, en-GB, es, et, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] ja
====================================
Default configuration data loaded.
[root@cent6 redmine-1.4.1]#
[root@cent6 redmine-1.4.1]# chown -R apache:apache files log tmp public/plugin_assets
[root@cent6 redmine-1.4.1]# chmod -R 755 files log tmp public/plugin_assets
[root@cent6 redmine-1.4.1]# chmod -R 777 tmp
※ tmp はマニュアル上 755 に設定する事になっているが、777じゃないと、PDFの出力が出来なかった
PDF出力時はnobody:nobody が書込みを行っている
webrickでredmineを起動し、ブラウザを使って動作確認を行います。動作確認が終わったら、Ctrl+CでWebrickを終了します。
ここでの動作確認は、サイトがみれて、admin/adminでログイン出来る位までで十分だとおもいます。
[root@cent6 redmine-1.4.1]# ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.14 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-04-21 16:26:01] INFO WEBrick 1.3.1
[2012-04-21 16:26:01] INFO ruby 1.8.7 (2011-06-30) [i386-linux]
[2012-04-21 16:26:01] INFO WEBrick::HTTPServer#start: pid=22288 port=3000
passenger(mod_rails)を使って、apacheとredmineを連携させます。
[root@cent6 redmine-1.4.1]# gem install passenger
[root@cent6 redmine-1.4.1]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.12.
This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.
Here's what you can expect from the installation process:
1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails application.
Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.
Press Enter to continue, or Ctrl-C to abort.
--------------------------------------------
Checking for required software...
* GNU C++ compiler... found at /usr/bin/g++
* Curl development headers with SSL support... found
* OpenSSL development headers... found
* Zlib development headers... found
* Ruby development headers... found
* OpenSSL support for Ruby... found
* RubyGems... found
* Rake... found at /usr/bin/rake
* rack... found
* Apache 2... found at /usr/sbin/httpd
* Apache 2 development headers... found at /usr/sbin/apxs
* Apache Portable Runtime (APR) development headers... found at /usr/bin/apr-1-config
* Apache Portable Runtime Utility (APU) development headers... found at /usr/bin/apu-1-config
--------------------------------------------
Compiling and installing Apache 2 module...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--------------------------------------------
The Apache 2 module was successfully installed.
Please edit your Apache configuration file, and add these lines:
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
PassengerRuby /usr/bin/ruby
After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!
Press ENTER to continue.
--------------------------------------------
Deploying a Ruby on Rails application: an example
Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:
<VirtualHost *:80>
ServerName www.yourhost.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /somewhere/public
<Directory /somewhere/public>
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
</Directory>
</VirtualHost>
And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:
/usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/doc/Users guide Apache.html
Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/
Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
[root@cent6 redmine-1.4.1]#
[root@cent6 ~]# vi /etc/httpd/conf/httpd.conf
LoadModule version_module modules/mod_version.so
## For passenger module
LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12/ext/apa
che2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.12
PassengerRuby /usr/bin/ruby
#ServerName www.example.com:80
ServerName cent6.example.co.jp:80
##DocumentRoot "/var/www/html"
DocumentRoot "/var/www/redmine/public"
##<Directory "/var/www/html">
<Directory "/var/www/redmine/public">
居るかな???
あとで書こう
Redmine用のテーマ「farend fancy」 を使おうと思います。
なんか、このテーマを使うと和みます。
[root@cent6 ~]# cd /var/www/redmine
[root@cent6 redmine]# git clone git://github.com/farend/redmine_theme_farend_fancy.git public/themes/farend_fancy
Initialized empty Git repository in /var/www/redmine-1.4.1/public/themes/farend_fancy/.git/
remote: Counting objects: 191, done.
remote: Compressing objects: 100% (110/110), done.
remote: Total 191 (delta 72), reused 168 (delta 49)
Receiving objects: 100% (191/191), 49.31 KiB, done.
Resolving deltas: 100% (72/72), done.
[root@cent6 redmine]#
[root@cent6 redmine]# ls -l public/themes/
total 16
drwxr-xr-x 3 root root 4096 Apr 21 16:05 alternate
drwxr-xr-x 4 root root 4096 Apr 21 16:05 classic
drwxr-xr-x 5 root root 4096 Apr 21 17:07 farend_fancy
-rw-r--r-- 1 root root 30 Apr 21 16:05 README
[root@cent6 redmine]#
[root@cent6 ~]# chkconfig mysqld on
[root@cent6 ~]# chkconfig httpd on
2012