2011年9月22日木曜日

Redmine1.2.1構築メモ(1)

■構成情報
・OS:    CentOS5.7(64bit)
・MySQL:   5.0.77(OSバンドル)
・Ruby:   1.8.7(Ruby Enterprise Editionを利用)
 ・rack:  1.1.1
 ・rake:  0.8.7
 ・i18n:  0.4.2
・Apache:  2.2.3(OSバンドル)
・Passenger: 3.0.9
・Redmine:  1.2.1
(1) MySQLの準備

■OSバンドルのmysqlモジュール確認
[root@redmine01 ~]# mysql --version
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1
[root@redmine01 ~]# rpm -qa | grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-5.0.77-4.el5_6.6
mysql-server-5.0.77-4.el5_6.6
mysql-5.0.77-4.el5_6.6
mysql-connector-odbc-3.51.26r1127-1.el5
⇒mysql-develがない!

■mysql-develインストール
[root@redmine01 ~]# yum -y install mysql-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-devel.i386 0:5.0.77-4.el5_6.6 set to be updated
---> Package mysql-devel.x86_64 0:5.0.77-4.el5_6.6 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================
 Package                    Arch          Version                 Repository       Size
========================================================================================
Installing:
 mysql-devel                i386          5.0.77-4.el5_6.6        base            2.4 M
 mysql-devel                x86_64        5.0.77-4.el5_6.6        base            2.5 M

Transaction Summary
========================================================================================
Install       2 Package(s)
Upgrade       0 Package(s)

Total download size: 4.9 M
Downloading Packages:
(1/2): mysql-devel-5.0.77-4.el5_6.6.i386.rpm                              | 2.4 MB  00:01
(2/2): mysql-devel-5.0.77-4.el5_6.6.x86_64.rpm                            | 2.5 MB  00:00
------------------------------------------------------------------------------------------
Total                                                            2.2 MB/s | 4.9 MB  00:02
警告: rpmts_HdrFromFdno: ヘッダ V3 DSA signature: NOKEY, key ID e8562897
base/gpgkey                                                               | 1.5 kB  00:00
Importing GPG key 0xE8562897 "CentOS-5 Key (CentOS 5 Official Signing Key) " from /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : mysql-devel                                                                                      1/2
  Installing     : mysql-devel                                                                                      2/2

Installed:
  mysql-devel.i386 0:5.0.77-4.el5_6.6                       mysql-devel.x86_64 0:5.0.77-4.el5_6.6

Complete!
[root@redmine01 ~]#


■データベース初期化
[root@redmine01 ~]# /etc/init.d/mysqld start
MySQL データベースを初期化中:  Installing MySQL system tables...
OK
Filling help tables...
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 rails02.daynalias.net 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 mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
                                                           [  OK  ]
MySQL を起動中:                                            [  OK  ]

⇒起動確認
[root@redmine01 ~]# mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+


■自動起動設定
[root@redmine01 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@redmine01 ~]# chkconfig mysqld on
[root@redmine01 ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off


■MySQLのデフォルトキャラクタセットをutf8に設定
[root@redmine01 ~]# cp -p /etc/my.cnf /etc/my.cnf.20110510
[root@redmine01 ~]# vi /etc/my.cnf
[root@redmine01 ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line:
# symbolic-links=0

# 20110924 for redmine		←追記
default-character-set=utf8	←追記

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

# 20110924 for redmine		←追記
[mysql]				←追記
default-character-set=utf8	←追記
[root@redmine01 ~]#

⇒キャラクタセット設定確認
[root@redmine01 ~]# /etc/init.d/mysqld restart
MySQL を停止中:                                            [  OK  ]
MySQL を起動中:                                            [  OK  ]
[root@redmine01 ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.77 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| 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)


■Redmine用データベース準備
⇒匿名ユーザー削除
mysql> use mysql
Database changed
mysql> delete from user where user = '';
Query OK, 2 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

⇒Redmine用データベースとユーザーの作成
mysql> create database db_redmine default character set utf8;
Query OK, 1 row affected (0.06 sec)

mysql> grant all on db_redmine.* to user_redmine identified by 'ienaiyo';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

0 件のコメント:

コメントを投稿