ラベル MySQL の投稿を表示しています。 すべての投稿を表示
ラベル MySQL の投稿を表示しています。 すべての投稿を表示

2014年5月5日月曜日

Amazon LinuxにWordPressをインストールする手順

AWSのEC2(Amazon Linux)にWordPressをインストールする手順です。必要パッケージ(Apache、MySQL、PHP等)を準備して、データベースを作成してからWordPressをドキュメントルートに展開後、コンフィグ設定すれば、だいたい完了です。
後は画面にてインストールプロセスに必要な項目を入力し、ログインしてダッシュボードを表示するところまでまとめます。
パーマリンク設定をデフォルト以外に設定しても404エラーを出さない方法については、別途記載できればと思います。

Amazon Linux AMI release 2014.03
WordPress 3.9 日本語版
ドメイン(仮): lnx-cms.linuxnow.com


■既存パッケージの確認

[root@lnx-cms ~]# rpm -qa | grep -e httpd -e mysql -e php | sort
[root@lnx-cms ~]#
何も入っていません。Amazon Linuxは本当にシンプル。


■必要パッケージの準備

[root@lnx-cms ~]# yum install httpd mysql-server php php-mysql php-mbstring
(中略)
===============================================================================
 Package                   Arch      Version              Repository      Size
===============================================================================
Installing:
 httpd                     x86_64    2.2.27-1.2.amzn1     amzn-updates   1.2 M
 mysql-server              noarch    5.5-1.6.amzn1        amzn-main      2.8 k
 php                       x86_64    5.3.28-1.5.amzn1     amzn-updates   2.8 M
 php-mbstring              x86_64    5.3.28-1.5.amzn1     amzn-updates   2.3 M
 php-mysql                 x86_64    5.3.28-1.5.amzn1     amzn-updates   178 k
Installing for dependencies:
 apr                       x86_64    1.5.0-2.11.amzn1     amzn-updates   115 k
 apr-util                  x86_64    1.4.1-4.14.amzn1     amzn-main       87 k
 apr-util-ldap             x86_64    1.4.1-4.14.amzn1     amzn-main       17 k
 generic-logos             noarch    17.0.0-2.5.amzn1     amzn-main      589 k
 httpd-tools               x86_64    2.2.27-1.2.amzn1     amzn-updates    79 k
 mailcap                   noarch    2.1.31-2.7.amzn1     amzn-main       27 k
 mysql55                   x86_64    5.5.37-1.46.amzn1    amzn-updates   7.5 M
 mysql55-common            x86_64    5.5.37-1.46.amzn1    amzn-updates    48 k
 mysql55-libs              x86_64    5.5.37-1.46.amzn1    amzn-updates   812 k
 mysql55-server            x86_64    5.5.37-1.46.amzn1    amzn-updates    13 M
 perl-Compress-Raw-Bzip2   x86_64    2.061-1.10.amzn1     amzn-main       33 k
 perl-Compress-Raw-Zlib    x86_64    2.061-1.10.amzn1     amzn-main       60 k
 perl-DBD-MySQL            x86_64    4.023-2.16.amzn1     amzn-main      148 k
 perl-DBI                  x86_64    1.627-1.7.amzn1      amzn-main      854 k
 perl-Data-Dumper          x86_64    2.145-1.4.amzn1      amzn-main       49 k
 perl-IO-Compress          noarch    2.061-1.1.11.amzn1   amzn-main      298 k
 perl-Net-Daemon           noarch    0.48-4.4.amzn1       amzn-main       58 k
 perl-PlRPC                noarch    0.2020-12.5.amzn1    amzn-main       38 k
 php-cli                   x86_64    5.3.28-1.5.amzn1     amzn-updates   2.6 M
 php-common                x86_64    5.3.28-1.5.amzn1     amzn-updates   1.0 M
 php-pdo                   x86_64    5.3.28-1.5.amzn1     amzn-updates   170 k

Transaction Summary
================================================================================
Install  5 Packages (+21 Dependent packages)
(以下略)

## インストールしたパッケージの確認
[root@lnx-cms ~]# rpm -qa | grep -e httpd -e mysql -e php | sort
httpd-2.2.27-1.2.amzn1.x86_64
httpd-tools-2.2.27-1.2.amzn1.x86_64
mysql55-5.5.37-1.46.amzn1.x86_64
mysql55-common-5.5.37-1.46.amzn1.x86_64
mysql55-libs-5.5.37-1.46.amzn1.x86_64
mysql55-server-5.5.37-1.46.amzn1.x86_64
mysql-server-5.5-1.6.amzn1.noarch
php-5.3.28-1.5.amzn1.x86_64
php-cli-5.3.28-1.5.amzn1.x86_64
php-common-5.3.28-1.5.amzn1.x86_64
php-mbstring-5.3.28-1.5.amzn1.x86_64
php-mysql-5.3.28-1.5.amzn1.x86_64
php-pdo-5.3.28-1.5.amzn1.x86_64
[root@lnx-cms ~]#


■phpinfoで状況確認

[root@lnx-cms ~]# echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
[root@lnx-cms ~]# /etc/init.d/httpd start
[root@lnx-cms ~]# /etc/init.d/mysqld start

## ブラウザにて確認
http://lnx-cms.linuxnow.com/phpinfo.php


■MySQLのrootパスワード設定

[root@lnx-cms ~]# mysqladmin -u root -h localhost password "naisyo"
[root@lnx-cms ~]#


■データベースとユーザの作成

データベース名: wp_db
管理ユーザ名: wp_admin
管理ユーザパスワード: secret
[root@lnx-cms ~]# mysql -u root -pnaisyo
(中略)
mysql> create database wp_db;
Query OK, 1 row affected (0.00 sec)

mysql> grant all privileges on wp_db.* to wp_admin@localhost identified by 'secret';
Query OK, 0 rows affected (0.00 sec)

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

mysql> quit
Bye
[root@lnx-cms ~]#


■自動起動設定

[root@lnx-cms ~]# chkconfig httpd on; chkconfig --list httpd
httpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@lnx-cms ~]# chkconfig mysqld on; chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@lnx-cms ~]#


■WordPressインストーラ取得

[root@lnx-cms ~]# cd /usr/local/src/
[root@lnx-cms src]# wget http://ja.wordpress.org/latest-ja.tar.gz
--2014-05-05 22:41:13--  http://ja.wordpress.org/latest-ja.tar.gz
(中略)
2014-05-05 22:41:18 (1.37 MB/s) - ‘latest-ja.tar.gz’ saved [6250676/6250676]

[root@lnx-cms src]# ll
total 6108
-rw-r--r-- 1 root root 6250676 Apr 17 17:26 latest-ja.tar.gz
[root@lnx-cms src]#


■WordPressの配置

[root@lnx-cms src]# tar -zxf latest-ja.tar.gz -C /var/www/html/
[root@lnx-cms src]# ll /var/www/html/wordpress/
total 192
-rw-r--r--  1 nobody 65534   418 Sep 25  2013 index.php
-rw-r--r--  1 nobody 65534 19930 Apr 10 08:50 license.txt
-rw-r--r--  1 nobody 65534 10163 Apr 17 11:58 readme.html
-rw-r--r--  1 nobody 65534  3293 Apr 17 11:58 readme-ja.html
-rw-r--r--  1 nobody 65534  4896 Dec 25 03:57 wp-activate.php
drwxr-xr-x  9 nobody 65534  4096 Apr 17 11:58 wp-admin
-rw-r--r--  1 nobody 65534   271 Jan  9  2012 wp-blog-header.php
-rw-r--r--  1 nobody 65534  4818 Feb 19 06:45 wp-comments-post.php
-rw-r--r--  1 root   root   4230 May  5 23:26 wp-config.php
-rw-r--r--  1 nobody 65534  4255 Apr 17 11:58 wp-config-sample.php
drwxr-xr-x  5 nobody 65534  4096 Apr 17 11:58 wp-content
-rw-r--r--  1 nobody 65534  2932 Sep 25  2013 wp-cron.php
drwxr-xr-x 12 nobody 65534  4096 Apr 17 11:58 wp-includes
-rw-r--r--  1 nobody 65534  2380 Oct 25  2013 wp-links-opml.php
-rw-r--r--  1 nobody 65534  2359 Oct 25  2013 wp-load.php
-rw-r--r--  1 nobody 65534 32671 Apr 14 01:06 wp-login.php
-rw-r--r--  1 nobody 65534  8235 Nov 13 20:58 wp-mail.php
-rw-r--r--  1 nobody 65534 11070 Apr  8 05:15 wp-settings.php
-rw-r--r--  1 nobody 65534 25665 Nov 13 12:23 wp-signup.php
-rw-r--r--  1 nobody 65534  4026 Oct 25  2013 wp-trackback.php
-rw-r--r--  1 nobody 65534  3032 Feb 10 05:39 xmlrpc.php
[root@lnx-cms src]#


■wp-config.phpの設定

先ほど作成したデータベース名、ユーザー名、パスワードを設定します。
[root@lnx-cms src]# cd /var/www/html/wordpress/
[root@lnx-cms wordpress]# cp wp-config-sample.php wp-config.php
[root@lnx-cms wordpress]# vi wp-config.php
[root@lnx-cms wordpress]# grep -A 12 "MySQL 設定" wp-config.php
// ** MySQL 設定 - この情報はホスティング先から入手してください。 ** //
/** WordPress のためのデータベース名 */
define('DB_NAME', 'wp_db');

/** MySQL データベースのユーザー名 */
define('DB_USER', 'wp_admin');

/** MySQL データベースのパスワード */
define('DB_PASSWORD', 'secret');

/** MySQL のホスト名 */
define('DB_HOST', 'localhost');

[root@lnx-cms wordpress]#

## ファイル所有者変更
[root@lnx-cms wordpress]# chown -R apache: /var/www/html/wordpress


■WordPressの初期設定

http://lnx-cms.linuxnow.com/wordpress/ (←実在はしませんのであしからず。)

画面の入力項目に従って進みます。

ダッシュボード画面を表示するところまでできました。今回の作業は以上で終了です。
次回は、 パーマリンク設定をデフォルト以外に設定しても404エラーを出さない方法を記載したいと思います。


こちらの情報が何かのお役に立てましたら幸いです。ちょこっと右サイドも見ていただければ幸いです。m(_ _)m

2012年2月24日金曜日

Redmineデータバックアップスクリプト


Redmineのデータをバックアップするスクリプトの例です。
概要は、Redmineで使用しているデータベースをダンプし、
添付ファイルをアーカイブしてダンプファイルとともに別
領域にコピーします。

バージョン1.3.1で動作確認済みです。


■仕様
バックアップ対象:
 MySQLのデータベース、db_redmineのダンプ
 /opt/redmine1.3.1 ディレクトリ全体をアーカイブ
 ※本来は添付ファイルだけでよいので/opt/redmine1.3.1/publicを対象とすればよい。

バックアップ開始時刻:午前3時33分
 /etc/crontabに登録しています。

バックアップ世代:10世代
 10日以上前のバックアップは自動削除されます。
 構築直後のデータサイズは全部で約10MB以下です。

バックアップ先:別Linuxサーバの/home/backup/redmine
 ※筐体の異なる物理サーバ上のVMの領域をNFSマウントします。


■マウントポイント作成
[root@redmine ~]# mkdir -p /opt/bk_redmine/backup


■バックアップスクリプト
[root@redmine ~]# cat /opt/bk_redmine/bk_redmine.sh
#!/bin/sh
#######################################################################
# << 機能概要 >>
# Redmineのデータを別サーバのマウント領域にバックアップする
#
# << 前提 >>
# /opt/bk_redmine/backup ディレクトリが存在すること
# /opt/bk_redmine/bk_redmine.sh としてこのファイルが存在すること
#
# <<変更履歴>>
# Version  変更日      変更者        変更内容
# --------+-----------+-------------+----------------------------------
#     1.0  2012/02/21  tanyao        新規作成
#######################################################################

BASE_DIR=/opt/bk_redmine
MOUNT_POINT=$BASE_DIR/backup
LOG_FILE=$0.log

echo "`date \"+%Y%m%d %H:%M:%S\"` INFO: bk_redmine start." >> $LOG_FILE

# mount settings
mount -t nfs 192.168.xxx.195:/home/backup/redmine $MOUNT_POINT

mount_chk=`mount | grep 192.168.xxx.195 | wc -l`
if [ $mount_chk -ge 1 ]; then
    echo "`date \"+%Y%m%d %H:%M:%S\"` INFO: mount check OK." >> $LOG_FILE
else
    echo "`date \"+%Y%m%d %H:%M:%S\"` ERROR: mount check error." >> $LOG_FILE
    echo "" >> $LOG_FILE
    exit 1
fi

# Backup DataBase
/usr/bin/mysqldump -u root db_redmine > $MOUNT_POINT/db_redmine_`date +%Y%m%d`.dbf

# Backup files
cd /opt/
tar -zcf $MOUNT_POINT/redmine-1.3.1_`date +%Y%m%d`.tar.gz redmine-1.3.1
cd -

# 10日以前のバックアップは削除
find $MOUNT_POINT -mtime +10 -iregex ".*\.dbf$\|.*\.gz$" > $BASE_DIR/delete.list
for i in `cat $BASE_DIR/delete.list`
do
    rm -rf $i
    echo "`date \"+%Y%m%d %H:%M:%S\"` INFO: $i is deleted." >> $LOG_FILE
done

# unmount
umount $MOUNT_POINT

echo "`date \"+%Y%m%d %H:%M:%S\"` INFO: Backup of Redmine data has been completed." >> $LOG_FILE
echo "" >> $LOG_FILE

exit 0
[root@redmine ~]#

■動作確認(cron実行させるため直近の時刻を設定)
[root@redmine ~]# grep -i redmine /etc/crontab
# Backup of Redmine
31 13  *  *  * root /opt/bk_redmine/bk_redmine.sh
[root@redmine ~]#

[root@redmine ~]# tail -f /opt/bk_redmine/bk_redmine.sh.log
20120221 13:31:01 INFO: bk_redmine start.
20120221 13:31:01 INFO: mount check OK.
20120221 13:31:04 INFO: /opt/bk_redmine/backup/db_redmine_20120105.dbf is deleted.
20120221 13:31:04 INFO: /opt/bk_redmine/backup/db_redmine_20120107.dbf is deleted.
20120221 13:31:04 INFO: Backup of Redmine data has been completed.


バックアップ先サーバ(バックアップ前)
[root@bksrv02 redmine]# ll
合計 12204
-rw-r--r--  1 root root   770214  1月  5 11:11 db_redmine_20120105.dbf
-rw-r--r--  1 root root   770214  1月  7 11:11 db_redmine_20120107.dbf
-rw-r--r--  1 root root   770214  2月 15 11:11 db_redmine_20120215.dbf
-rw-r--r--  1 root root 10144029  2月 21 10:19 redmine-1.3.1_20120221.tar.gz
[root@bksrv02 redmine]#

バックアップ先サーバ(バックアップ後)
[root@bksrv02 redmine]# ll
合計 11468
-rw-r--r--  1 root root   770214  2月 15 11:11 db_redmine_20120215.dbf
-rw-r--r--  1 root root   786275  2月 21 13:31 db_redmine_20120221.dbf
-rw-r--r--  1 root root 10154630  2月 21 13:31 redmine-1.3.1_20120221.tar.gz
[root@bksrv02 redmine]#

→10日以前のバックアップは削除される。同名のバックアップファイルがあったとしても上書きされる。

2012年2月14日火曜日

CentOS6.2 Redmine1.3.1構築メモ(1)

CentOS6.2にRedmine1.3.1を構築する手順をまとめてみました。
 Step1. パッケージおよびインストーラの準備
 Step2. MySQLの準備
 Step3. Ruby Enterprise Edition インストール
 Step4. Redmine インストール
 Step5. ApacheにPassenger組込み

■構成情報
・OS:        CentOS6.2(64bit)
・MySQL:     5.1.52(OSバンドル)
・Ruby:      1.8.7(Ruby Enterprise Editionを利用)
 ・rack:    1.1.2
 ・rake:    0.9.2
 ・i18n:    0.4.2
・gem:       1.6.2
・Apache:    2.2.15(OSバンドル)
・Passenger: 3.0.11
・Redmine:   1.3.1


Step1. パッケージおよびインストーラの準備
■Firewall、SELinuxを無効化
[root@redmine ~]# chkconfig iptables off
[root@redmine ~]# chkconfig ip6tables off
[root@redmine ~]# vi /etc/sysconfig/selinux
SELINUX=enforcing
↓ # 変更
SELINUX=disabled

⇒再起動後に確認
[root@redmine ~]# getenforce
Disabled


■作業前ディスク使用状況確認
[root@redmine ~]# df -m
Filesystem           1M-ブロック    使用   使用可 使用% マウント位置
/dev/mapper/vg_redmine-lv_root
                          4607      3253      1120  75% /
tmpfs                      751         1       751   1% /dev/shm
/dev/sda1                  485        33       428   7% /boot
/dev/sr0                  4219      4219         0 100% /media/CentOS_6.2_Final


■インストールメディアからパッケージインストール設定(基本的にはこちらから)
[root@redmine ~]# vi /etc/yum.repos.d/dvdmedia.repo
[root@redmine ~]# cat /etc/yum.repos.d/dvdmedia.repo
[dvdmedia]
name=CentOS-6.2-x86_64-DVD1
baseurl=file:///media/CentOS_6.2_Final/
enabled=0
gpgcheck=1
gpgkey=file:///media/CentOS_6.2_Final/RPM-GPG-KEY-CentOS-6
[root@redmine ~]#


■yumのproxy越え設定(インストールメディアにない場合は最新バージョンを採用)
[root@redmine ~]# vi /etc/yum.conf
[root@redmine ~]# tail -5 /etc/yum.conf
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

# Add Proxy
proxy=http://tanyao:xxxxxxxx@proxy.kuitan.net:8080/
[root@redmine ~]#
⇒最下行に上記2行を追記


■関連パッケージの確認
[root@redmine ~]# rpm -q openssl-devel readline-devel zlib-devel curl-devel
パッケージ openssl-devel はインストールされていません。
パッケージ readline-devel はインストールされていません。
パッケージ zlib-devel はインストールされていません。
パッケージ curl-devel はインストールされていません。
[root@redmine ~]# rpm -q mysql mysql-server mysql-devel
mysql-5.1.52-1.el6_0.1.x86_64
mysql-server-5.1.52-1.el6_0.1.x86_64
パッケージ mysql-devel はインストールされていません。
[root@redmine ~]# rpm -q httpd httpd-devel
httpd-2.2.15-15.el6.centos.x86_64
パッケージ httpd-devel はインストールされていません。
[root@redmine ~]# rpm -q ImageMagick ImageMagick-devel
パッケージ ImageMagick はインストールされていません。
パッケージ ImageMagick-devel はインストールされていません。
[root@redmine ~]#

⇒念のため開発ツール関係のパッケージも
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia groupinstall "Development Tools"
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
dvdmedia                                                     | 4.0 kB     00:00 ...
dvdmedia/primary_db                                          | 4.5 MB     00:00 ...
(中略)

No packages in any requested group available to install or update
[root@redmine ~]#


■関連パッケージのインストール
⇒openssl-devel
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install openssl-devel
(中略)
Installed:
  openssl-devel.x86_64 0:1.0.0-20.el6

Dependency Installed:
  keyutils-libs-devel.x86_64 0:1.4-3.el6         krb5-devel.x86_64 0:1.9-22.el6
  libcom_err-devel.x86_64 0:1.41.12-11.el6       libselinux-devel.x86_64 0:2.0.94-5.2.el6
  libsepol-devel.x86_64 0:2.0.41-4.el6           zlib-devel.x86_64 0:1.2.3-27.el6

Complete!
[root@redmine ~]#
→zlib-develも同時にインストールされた。

⇒readline-devel
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install readline-devel
(中略)
Installed:
  readline-devel.x86_64 0:6.0-3.el6

Dependency Installed:
  ncurses-devel.x86_64 0:5.7-3.20090208.el6

Complete!
[root@redmine ~]#

⇒curl-devel
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install curl-devel
(中略)
Installed:
  libcurl-devel.x86_64 0:7.19.7-26.el6_1.2

Dependency Installed:
  libidn-devel.x86_64 0:1.18-2.el6

Complete!
[root@redmine ~]#

⇒mysql-devel
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install mysql-devel
(中略)
Installed:
  mysql-devel.x86_64 0:5.1.52-1.el6_0.1

Complete!
[root@redmine ~]#

⇒httpd-devel
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install httpd-devel
(中略)
Installed:
  httpd-devel.x86_64 0:2.2.15-15.el6.centos

Dependency Installed:
  apr-devel.x86_64 0:1.3.9-3.el6_1.2    apr-util-devel.x86_64 0:1.3.9-3.el6_0.1 cyrus-sasl-devel.x86_64 0:2.1.23-13.el6
  db4-cxx.x86_64 0:4.7.25-16.el6        db4-devel.x86_64 0:4.7.25-16.el6        expat-devel.x86_64 0:2.0.1-9.1.el6
  openldap-devel.x86_64 0:2.4.23-20.el6

Complete!
[root@redmine ~]#

⇒ImageMagick
[root@redmine ~]# yum --disablerepo=\* --enablerepo=dvdmedia install ImageMagick
(中略)
Installed:
  ImageMagick.x86_64 0:6.5.4.7-5.el6

Dependency Installed:
  libwmf-lite.x86_64 0:0.2.8.4-22.el6.centos

Complete!
[root@redmine ~]#

⇒ImageMagick-devel(依存パッケージがインストールメディアに全部は無い)
[root@redmine ~]# yum install ImageMagick-devel
(中略)

Installed:
  ImageMagick-devel.x86_64 0:6.5.4.7-5.el6

Dependency Installed:
  bzip2-devel.x86_64 0:1.0.5-7.el6_0                  freetype-devel.x86_64 0:2.3.11-6.el6_1.8
  ghostscript-devel.x86_64 0:8.70-11.el6_1.2          jasper-devel.x86_64 0:1.900.1-15.el6_1.1
  lcms-devel.x86_64 0:1.19-1.el6                      libICE-devel.x86_64 0:1.0.6-1.el6
  libSM-devel.x86_64 0:1.1.0-7.1.el6                  libX11-devel.x86_64 0:1.3-2.el6
  libXau-devel.x86_64 0:1.0.5-1.el6                   libXdmcp-devel.x86_64 0:1.0.3-1.el6
  libXext-devel.x86_64 0:1.1-3.el6                    libXt-devel.x86_64 0:1.0.7-1.el6
  libjpeg-devel.x86_64 0:6b-46.el6                    libtiff-devel.x86_64 0:3.9.4-1.el6_0.3
  libxcb-devel.x86_64 0:1.5-1.el6                     xorg-x11-proto-devel.noarch 0:7.6-13.el6

Dependency Updated:
  freetype.x86_64 0:2.3.11-6.el6_1.8                  jasper-libs.x86_64 0:1.900.1-15.el6_1.1

Complete!
[root@redmine ~]#


■インストーラダウンロード
⇒Ruby Enterprise Edition
サイト: http://www.rubyenterpriseedition.com/download.html
ファイル: ruby-enterprise-1.8.7-2012.01.tar.gz(約7.5MB)

⇒Redmine1.3
サイト: http://rubyforge.org/frs/?group_id=1850
ファイル: redmine-1.3.1.tar.gz(約5.7MB)

⇒インストーラ格納用ディレクトリを作成しFTP等でサーバにUP
[root@redmine ~]# mkdir /root/src
[root@redmine ~]# ll /root/src/
合計 13632
-rwxr--r-- 1 root root 6034718  2月  7 18:41 2012 redmine-1.3.1.tar.gz
-rwxr--r-- 1 root root 7918155  2月  7 18:41 2012 ruby-enterprise-1.8.7-2012.01.tar.gz
[root@redmine ~]#


Step2. MySQLの準備
■データベース初期化
[root@redmine ~]# /etc/init.d/mysqld start
MySQL データベースを初期化中:  WARNING: The host 'redmine' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
(中略)

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

                                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]
[root@redmine ~]#
[root@redmine ~]# mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
[root@redmine ~]#


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


■MySQLのデフォルトキャラクタセットをutf8に設定
[root@redmine ~]# cp -p /etc/my.cnf /etc/my.cnf.20110625
[root@redmine ~]# vi /etc/my.cnf
[root@redmine ~]# cat /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# for redmine        ←追記
character-set-server=utf8 ←追記

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

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

⇒再起動して設定反映
[root@redmine ~]# /etc/init.d/mysqld restart
mysqld を停止中:                                           [  OK  ]
mysqld を起動中:                                           [  OK  ]

⇒キャラクタセット設定確認
[root@redmine ~]# mysql -u root -e "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/ |
+--------------------------+----------------------------+
[root@redmine ~]#


■Redmine用データベース準備
⇒匿名ユーザー削除
[root@redmine ~]# mysql -u root

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.00 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.01 sec)

mysql> quit
Bye
[root@redmine ~]#

2012年1月17日火曜日

CentOS6.2 主なバンドルソフトウェアのバージョン

CentOS6.2の主なバンドルソフトウェアのバージョンを紐解いてみたいと思います。
ぶっちゃけrpmコマンド結果をgrepしているだけです。
■apache
[root@centos62 ~]# rpm -qa | grep httpd
httpd-tools-2.2.15-15.el6.centos.x86_64
httpd-manual-2.2.15-15.el6.centos.noarch
httpd-2.2.15-15.el6.centos.x86_64

■perl
[root@centos62 ~]# rpm -q perl
perl-5.10.1-119.el6_1.1.x86_64

■php
[root@centos62 ~]# rpm -q php
php-5.3.3-3.el6_1.3.x86_64

■java
[root@centos62 ~]# java -version
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (rhel-1.41.1.10.4.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

■mysql
[root@centos62 ~]# rpm -qa | grep mysql
mysql-libs-5.1.52-1.el6_0.1.x86_64
mysql-server-5.1.52-1.el6_0.1.x86_64
mysql-connector-odbc-5.1.5r1144-7.el6.x86_64
mysql-5.1.52-1.el6_0.1.x86_64

■samba
[root@centos62 ~]# rpm -qa | grep samba
samba-winbind-clients-3.5.10-114.el6.x86_64
samba-3.5.10-114.el6.x86_64
samba-client-3.5.10-114.el6.x86_64
samba-common-3.5.10-114.el6.x86_64

■NFS
[root@centos62 ~]# rpm -qa | grep nfs
nfs-utils-1.2.3-15.el6.x86_64
nfs-utils-lib-1.1.5-4.el6.x86_64
nfs4-acl-tools-0.3.3-5.el6.x86_64

■FTP
[root@centos62 ~]# rpm -qa | grep vsftpd
vsftpd-2.2.2-6.el6_0.1.x86_64

思いつくままに列挙してみましたが、何か足りてない気も…。

2011年10月1日土曜日

Ruby1.9.2p290にRedmine1.2.1インストールしてみたが…

■前提
OS: CentOS5.7(64bit)
Ruby: 1.9.2p290
MySQL: 5.0.77(OSバンドルのものを使用)
Apache: 2.2.3(OSバンドルのものを使用)
passenger: 3.0.9


■Redmineを実行するために必要なgemパッケージおよびそのバージョンをインストール
⇒Rack 1.1.1、rake 0.8.7、i18n 0.4.2 (最新バージョンだと動かないため)
⇒バージョン確認
[root@redmine02 ~]# gem list | grep -e rack -e rake -e i18n
i18n (0.6.0)
rack (1.3.3)
rack-cache (1.0.3)
rack-mount (0.8.3)
rack-ssl (1.3.2)
rack-test (0.6.1)
rake (0.9.2, 0.8.7)

⇒Rack 1.1.1インストール
[root@redmine02 ~]# gem install rack -v=1.1.1 --no-rdoc --no-ri
Successfully installed rack-1.1.1
1 gem installed
[root@redmine02 ~]#

⇒i18n 0.4.2
[root@redmine02 ~]# gem install i18n -v=0.4.2 --no-rdoc --no-ri
Successfully installed i18n-0.4.2
1 gem installed
[root@redmine02 ~]#


■MySQLのデフォルトキャラクタセットをutf8に設定
[root@redmine02 ~]# mysql --version
mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (x86_64) using readline 5.1

[root@redmine02 ~]# cat /etc/my.cnf
[root@redmine02 ~]# 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

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

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

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

⇒MySLQ再起動
[root@redmine02 ~]# /etc/init.d/mysqld restart
MySQL を停止中:                                            [  OK  ]
MySQL を起動中:                                            [  OK  ]

⇒キャラクタセット設定確認
[root@redmine02 ~]# mysql -u root
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)


■MySQLデータベース準備
⇒匿名ユーザー削除
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

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


■Redmineのダウンロード
http://rubyforge.org/frs/?group_id=1850
上記サイトよりredmine-1.2.1.tar.gzをダウンロード
/home/public/src/に配置


■Redmineの配置先のディレクトリに解凍
[root@redmine02 ~]# tar -zxf /home/public/src/redmine-1.2.1.tar.gz -C /rails_projects/
[root@redmine02 ~]# cd /rails_projects/redmine-1.2.1/


■Redmine設定
⇒database.ymlの設定
[root@redmine02 redmine-1.2.1]# vi config/database.yml
[root@redmine02 redmine-1.2.1]# cat config/database.yml
production:
  adapter: mysql2
  database: db_redmine
  host: localhost
  username: user_redmine
  password: ienaiyo
  encoding: utf8
[root@redmine02 redmine-1.2.1]#

⇒configuration.ymlの設定
[root@redmine02 redmine-1.2.1]# cp config/configuration.yml.example config/configuration.yml
[root@redmine02 redmine-1.2.1]# vi config/configuration.yml
[root@redmine02 redmine-1.2.1]# tail -11 config/configuration.yml
production:
  email_delivery:		←追記
    delivery_method: :smtp	←追記
    smtp_settings:		←追記
      address: "localhost"	←追記
      port: 25			←追記
      domain: 'dynalias.net'	←追記(環境により異なる)

# specific configuration options for development environment
# that overrides the default ones
development:
[root@redmine02 redmine-1.2.1]#

⇒Redmineの初期設定とデータベースのテーブル作成
[root@redmine02 redmine-1.2.1]# rake generate_session_store
(in /rails_projects/redmine-1.2.1)

[root@redmine02 redmine-1.2.1]# rake db:migrate RAILS_ENV=production
(in /rails_projects/redmine-1.2.1)
rake aborted!
undefined method `map' for nil:NilClass
/usr/local/lib/ruby/1.9.1/rubygems.rb:228:in `activate'
/usr/local/lib/ruby/1.9.1/rubygems.rb:1119:in `try_activate'
:32:in `rescue in require'
:29:in `require'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `block in require'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
/rails_projects/redmine-1.2.1/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'


■エラー対応
最新バージョンをアンインストール
[root@redmine02 ~]# gem uninstall rack

Select gem to uninstall:
 1. rack-1.1.1
 2. rack-1.3.3
 3. All versions
> 2

You have requested to uninstall the gem:
        rack-1.3.3
sprockets-2.0.0 depends on [rack (~> 1.0)]
actionpack-3.1.0 depends on [rack (~> 1.3.2)]
rack-mount-0.8.3 depends on [rack (>= 1.0.0)]
passenger-3.0.9 depends on [rack (>= 0)]
rack-test-0.6.1 depends on [rack (>= 1.0)]
rack-ssl-1.3.2 depends on [rack (>= 0)]
rack-cache-1.0.3 depends on [rack (>= 0.4)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled rack-1.3.3

[root@redmine02 redmine-1.2.1]# gem uninstall i18n

Select gem to uninstall:
 1. i18n-0.4.2
 2. i18n-0.6.0
 3. All versions
> 2

You have requested to uninstall the gem:
        i18n-0.6.0
mail-2.3.0 depends on [i18n (>= 0.4.0)]
actionpack-3.1.0 depends on [i18n (~> 0.6)]
activemodel-3.1.0 depends on [i18n (~> 0.6)]
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn]  y
Successfully uninstalled i18n-0.6.0
[root@redmine02 redmine-1.2.1]#

⇒environment.rbに追記
[root@redmine02 redmine-1.2.1]# head -30 config/environment.rb
# Be sure to restart your web server when you modify this file.

# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'

# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.11' unless defined? RAILS_GEM_VERSION

# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')

# add 20110930
if Gem::VERSION >= "1.3.6"
    module Rails
        class GemDependency
            def requirement
                r = super
                (r == Gem::Requirement.default) ? nil : r
            end
        end
    end
end

# Load Engine plugin if available
begin
  require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
rescue LoadError
  # Not available
end


⇒エラー解消せず。(T-T)
結局Redmine1.2.1は現時点で最新のruby1.9.2には対応していないことが原因の模様。

2011年9月25日日曜日

Redmine1.2.1構築メモ(4)

■構成情報
・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
(4) ApacheにPassengerを組み込み

■パッケージを準備
[root@redmine01 ~]# rpm -q httpd-devel
パッケージ httpd-devel はインストールされていません。
[root@redmine01 ~]# yum -y install httpd-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 httpd-devel.i386 0:2.2.3-53.el5.centos.1 set to be updated
--> Processing Dependency: httpd = 2.2.3-53.el5.centos.1 for package: httpd-devel
--> Processing Dependency: apr-util-devel for package: httpd-devel
--> Processing Dependency: apr-devel for package: httpd-devel
---> Package httpd-devel.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
--> Running transaction check
---> Package apr-devel.x86_64 0:1.2.7-11.el5_6.5 set to be updated
---> Package apr-util-devel.x86_64 0:1.2.7-11.el5_5.2 set to be updated
--> Processing Dependency: httpd = 2.2.3-53.el5.centos for package: mod_ssl
--> Processing Dependency: httpd = 2.2.3-53.el5.centos for package: httpd-manual
---> Package httpd.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
--> Running transaction check
---> Package httpd-manual.x86_64 0:2.2.3-53.el5.centos.1 set to be updated
---> Package mod_ssl.x86_64 1:2.2.3-53.el5.centos.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================
 Package                               Arch                Version                        Repository                 Size
==========================================================================================================================
Installing:
 httpd-devel                           i386                2.2.3-53.el5.centos.1          updates                   151 k
 httpd-devel                           x86_64              2.2.3-53.el5.centos.1          updates                   151 k
Installing for dependencies:
 apr-devel                             x86_64              1.2.7-11.el5_6.5               base                      238 k
 apr-util-devel                        x86_64              1.2.7-11.el5_5.2               base                       53 k
Updating for dependencies:
 httpd                                 x86_64              2.2.3-53.el5.centos.1          updates                   1.2 M
 httpd-manual                          x86_64              2.2.3-53.el5.centos.1          updates                   815 k
 mod_ssl                               x86_64              1:2.2.3-53.el5.centos.1        updates                    94 k

Transaction Summary
==========================================================================================================================
Install       4 Package(s)
Upgrade       3 Package(s)

Total download size: 2.7 M
Downloading Packages:
(1/7): apr-util-devel-1.2.7-11.el5_5.2.x86_64.rpm                                                       |  53 kB     00:00
(2/7): mod_ssl-2.2.3-53.el5.centos.1.x86_64.rpm                                                         |  94 kB     00:00
(3/7): httpd-devel-2.2.3-53.el5.centos.1.x86_64.rpm                                                     | 151 kB     00:00
(4/7): httpd-devel-2.2.3-53.el5.centos.1.i386.rpm                                                       | 151 kB     00:00
(5/7): apr-devel-1.2.7-11.el5_6.5.x86_64.rpm                                                            | 238 kB     00:00
(6/7): httpd-manual-2.2.3-53.el5.centos.1.x86_64.rpm                                                    | 815 kB     00:00
(7/7): httpd-2.2.3-53.el5.centos.1.x86_64.rpm                                                           | 1.2 MB     00:00
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                          1.2 MB/s | 2.7 MB     00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating       : httpd                                                                                              1/10
  Installing     : apr-devel                                                                                          2/10
  Updating       : mod_ssl                                                                                            3/10
  Installing     : apr-util-devel                                                                                     4/10
  Updating       : httpd-manual                                                                                       5/10
  Installing     : httpd-devel                                                                                        6/10
  Installing     : httpd-devel                                                                                        7/10
  Cleanup        : httpd-manual                                                                                       8/10
  Cleanup        : httpd                                                                                              9/10
  Cleanup        : mod_ssl                                                                                           10/10

Installed:
  httpd-devel.i386 0:2.2.3-53.el5.centos.1   httpd-devel.x86_64 0:2.2.3-53.el5.centos.1

Dependency Installed:
  apr-devel.x86_64 0:1.2.7-11.el5_6.5        apr-util-devel.x86_64 0:1.2.7-11.el5_5.2

Dependency Updated:
  httpd.x86_64 0:2.2.3-53.el5.centos.1       httpd-manual.x86_64 0:2.2.3-53.el5.centos.1     mod_ssl.x86_64 1:2.2.3-53.el5.centos.1

Complete!
[root@redmine01 ~]#


■Passengerのインストール
[root@redmine01 ~]# gem install passenger --no-rdoc --no-ri
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions.  This could take a while...
Fetching: daemon_controller-0.2.6.gem (100%)
Fetching: passenger-3.0.9.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-0.2.6
Successfully installed passenger-3.0.9
3 gems installed
[root@redmine01 ~]#


■PassengerのApache用モジュールのインストール
[root@redmine01 ~]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.9.

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/local/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...
cd /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
/usr/local/bin/ruby /usr/local/bin/rake apache2:clean apache2 RELEASE=yes
(中略)

--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
   PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
   PassengerRuby /usr/local/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:

   
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
      
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off
      
   

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/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@redmine01 ~]#


■Apacheの設定
⇒worker MPMに切り替える
[root@redmine01 ~]# vi /etc/sysconfig/httpd
[root@redmine01 ~]# grep httpd.worker /etc/sysconfig/httpd
#HTTPD=/usr/sbin/httpd.worker
HTTPD=/usr/sbin/httpd.worker ←追記

⇒passnger.conf作成
[root@redmine01 ~]# vi /etc/httpd/conf.d/passnger.conf
[root@redmine01 ~]# cat /etc/httpd/conf.d/passnger.conf
# output of "passenger-install-apache2-module"
LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-3.0.9
PassengerRuby /usr/local/bin/ruby

# rails settings
RailsBaseURI /redmine

# Passengerが追加するHTTPヘッダを削除するための設定
Header always unset "X-Powered-By"
Header always unset "X-Rack-Cache"
Header always unset "X-Content-Digest"
Header always unset "X-Runtime"

# 必要に応じてPassengerのチューニングのための設定を追加。
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerUseGlobalQueue on
PassengerHighPerformance on
PassengerStatThrottleRate 10
RailsSpawnMethod smart
RailsAppSpawnerIdleTime 86400
RailsFrameworkSpawnerIdleTime 0
[root@redmine01 ~]#

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

⇒Redmineディレクトリの所有者変更
[root@redmine01 ~]# chown -R apache: /opt/redmine-1.2.1

⇒サブディレクトリでRedmineを実行(シンボリックリンク作成)
[root@redmine01 ~]# ln -s /opt/redmine-1.2.1/public /var/www/html/redmine

⇒Apacheを起動
[root@redmine01 ~]# /etc/init.d/httpd configtest
Syntax OK
[root@redmine01 ~]# /etc/init.d/httpd graceful
httpd not running, trying to start
[root@redmine01 ~]#

⇒ブラウザからアクセス
http://192.168.1.15/redmine/
ログイン:admin/admin

お手数をおかけして恐縮ですが、広告サイトクリックにご協力いただけるとありがたいです。m(_ _)m

2011年9月24日土曜日

Redmine1.2.1構築メモ(3)

■構成情報
・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
(3) Redmineインストール

■インストーラダウンロード&解凍
http://rubyforge.org/frs/?group_id=1850
redmine-1.2.1.tar.gzをダウンロードしてサーバにUP

⇒/optに解凍
[root@redmine01 src]# tar -zxf redmine-1.2.1.tar.gz -C /opt

■Redmine関連ファイル設定
[root@redmine01 ~]# cd /opt/redmine-1.2.1/

⇒database.yml作成
[root@redmine01 redmine-1.2.1]# vi config/database.yml
[root@redmine01 redmine-1.2.1]# cat config/database.yml
production:
  adapter: mysql
  database: db_redmine
  host: localhost
  username: user_redmine
  password: ienaiyo
  encoding: utf8
[root@redmine01 redmine-1.2.1]#

⇒configuration.ymlの設定
[root@redmine01 redmine-1.2.1]# cp config/configuration.yml.example config/configuration.yml
[root@redmine01 redmine-1.2.1]# vi config/configuration.yml
[root@redmine01 redmine-1.2.1]# tail -11 config/configuration.yml
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      domain: 'foo.com'

# specific configuration options for development environment
# that overrides the default ones
development:
[root@redmine01 redmine-1.2.1]#

⇒Redmineの初期設定とデータベースのテーブル作成
[root@redmine01 redmine-1.2.1]# rake generate_session_store
(in /opt/redmine-1.2.1)
[root@redmine01 redmine-1.2.1]# rake db:migrate RAILS_ENV=production
(in /opt/redmine-1.2.1)
==  Setup: migrating ==========================================================
-- create_table("attachments", {:force=>true})
   -> 0.0072s
-- create_table("auth_sources", {:force=>true})
(中略)

==  AddRepositoriesExtraInfo: migrating =======================================
-- add_column(:repositories, :extra_info, :text)
   -> 0.0092s
==  AddRepositoriesExtraInfo: migrated (0.0095s) ==============================

[root@redmine01 redmine-1.2.1]#



2011年9月23日金曜日

Redmine1.2.1構築メモ(2)

■構成情報
・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
(2) Ruby Enterprise Edition インストール

■OSバンドルのRuby有無確認
[root@redmine01 ~]# rpm -qa | grep ruby
[root@redmine01 ~]#
⇒既存Rubyは存在しないのでOK!

■インストーラダウンロード&解凍
http://www.rubyenterpriseedition.com/download.html
ruby-enterprise-1.8.7-2011.03.tar.gzをダウンロードしてサーバにUP

[root@redmine01 ~]# cd /home/public/src/
[root@redmine01 src]# tar -zxf ruby-enterprise-1.8.7-2011.03.tar.gz

■インストール
[root@redmine01 src]# ruby-enterprise-1.8.7-2011.03/installer --dont-install-useful-gems --no-dev-docs
Welcome to the Ruby Enterprise Edition installer
This installer will help you install Ruby Enterprise Edition 1.8.7-2011.03.
Don't worry, none of your system files will be touched if you don't want them
to, so there is no risk that things will screw up.

You can expect this from the installation process:

  1. Ruby Enterprise Edition will be compiled and optimized for speed for this
     system.
  2. Ruby on Rails will be installed for Ruby Enterprise Edition.
  3. You will learn how to tell Phusion Passenger to use Ruby Enterprise
     Edition instead of regular Ruby.

Press Enter to continue, or Ctrl-C to abort.

Checking for required software...

 * C compiler... found at /usr/bin/gcc
 * C++ compiler... found at /usr/bin/g++
 * The 'make' tool... found at /usr/bin/make
 * The 'patch' tool... found at /usr/bin/patch
 * Zlib development headers... found
 * OpenSSL development headers... found
 * GNU Readline development headers... found
--------------------------------------------
Target directory

Where would you like to install Ruby Enterprise Edition to?
(All Ruby Enterprise Edition files will be put inside that directory.)

[/opt/ruby-enterprise-1.8.7-2011.03] : /usr/local ←インストール先を指定
--------------------------------------------
Compiling and optimizing the memory allocator for Ruby Enterprise Edition
In the mean time, feel free to grab a cup of coffee.
(中略)

--------------------------------------------
Installing useful libraries...
/usr/local/bin/ruby /usr/local/bin/gem sources --update
source cache successfully updated
Updating /usr/local/bin/irb...
Updating /usr/local/bin/gem...
Updating /usr/local/bin/ri...
Updating /usr/local/bin/erb...
Updating /usr/local/bin/testrb...
Updating /usr/local/bin/rdoc...
--------------------------------------------
Ruby Enterprise Edition is successfully installed!
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:

  /usr/local/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:

  /usr/local

If you have any questions, feel free to visit our website:

  http://www.rubyenterpriseedition.com

Enjoy Ruby Enterprise Edition, a product of Phusion (www.phusion.nl) :-)
[root@redmine01 src]# 

⇒/usr/localのインストール前
[root@redmine01 ~]# ll /usr/local/
合計 80
drwxr-xr-x 2 root root 4096  5月 11 20:58 bin
drwxr-xr-x 2 root root 4096  5月 11 20:58 etc
drwxr-xr-x 2 root root 4096  5月 11 20:58 games
drwxr-xr-x 2 root root 4096  5月 11 20:58 include
drwxr-xr-x 2 root root 4096  5月 11 20:58 lib
drwxr-xr-x 2 root root 4096  5月 11 20:58 lib64
drwxr-xr-x 2 root root 4096  5月 11 20:58 libexec
drwxr-xr-x 2 root root 4096  5月 11 20:58 sbin
drwxr-xr-x 4 root root 4096  9月 24 05:19 share
drwxr-xr-x 2 root root 4096  5月 11 20:58 src

⇒/usr/localのインストール後
[root@redmine01 ~]# ll /usr/local/
合計 80
drwxr-xr-x 2 root root 4096  9月 24 23:27 bin
drwxr-xr-x 2 root root 4096  5月 11 20:58 etc
drwxr-xr-x 2 root root 4096  5月 11 20:58 games
drwxr-xr-x 2 root root 4096  5月 11 20:58 include
drwxr-xr-x 3 root root 4096  9月 24 23:27 lib
drwxr-xr-x 2 root root 4096  5月 11 20:58 lib64
drwxr-xr-x 2 root root 4096  5月 11 20:58 libexec
drwxr-xr-x 2 root root 4096  5月 11 20:58 sbin
drwxr-xr-x 4 root root 4096  9月 24 05:19 share
drwxr-xr-x 2 root root 4096  5月 11 20:58 src


■gemパッケージのインストール
⇒Rack 1.1.1のインストール
[root@redmine01 ~]# gem install rack -v=1.1.1 --no-rdoc --no-ri
Fetching: rack-1.1.1.gem (100%)
Successfully installed rack-1.1.1
1 gem installed
[root@redmine01 ~]#

⇒rake 0.8.7のインストール
[root@redmine01 ~]# gem install rake -v=0.8.7 --no-rdoc --no-ri
Fetching: rake-0.8.7.gem (100%)
Successfully installed rake-0.8.7
1 gem installed
[root@redmine01 ~]#

⇒i18n 0.4.2のインストール
[root@redmine01 ~]# gem install i18n -v=0.4.2 --no-rdoc --no-ri
Fetching: i18n-0.4.2.gem (100%)
Successfully installed i18n-0.4.2
1 gem installed
[root@redmine01 ~]#

⇒Ruby用MySQLドライバのインストール
[root@redmine01 ~]# gem install mysql --no-rdoc --no-ri
Fetching: mysql-2.8.1.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql-2.8.1
1 gem installed
[root@redmine01 ~]#

⇒確認
[root@redmine01 ~]# gem list

*** LOCAL GEMS ***

i18n (0.4.2)
mysql (2.8.1)
rack (1.1.1)
rake (0.8.7)
[root@redmine01 ~]#

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

2011年9月18日日曜日

CentOS5.7バンドルのMySQL

★RubyOnRailsのデータベースとしてMySQLを準備

■OSバンドルのmysqlモジュール確認
[root@rails01 ~]# 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@rails01 ~]# yum 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
Is this ok [y/N]: y
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.1 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
Is this ok [y/N]: y
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@rails01 ~]# rpm -qa | grep mysql
libdbi-dbd-mysql-0.8.1a-1.2.2
mysql-5.0.77-4.el5_6.6
mysql-devel-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-5.0.77-4.el5_6.6


■データベース初期化
[root@rails01 ~]# /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 rails01 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@rails01 ~]# mysqlshow
+--------------------+
|     Databases      |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+

⇒停止
[root@rails01 ~]# /etc/init.d/mysqld stop
MySQL を停止中:                                            [  OK  ]

2011年9月17日土曜日

CentOS5.7インストールパッケージ

★RubyOnRails用として仮想サーバをCentOSで構築。
⇒MySQLはOSバンドルを利用予定。
⇒RubyおよびRailsは最新版をインストール予定。

■OSインストール時のパッケージ選択
-----------------------------------------------------------
【デスクトップ環境】
 ■ GNOMEデスクトップ環境
 □ KDE(Kデスクトップ環境)

【アプリケーション】
 □ Emacs
 □ Office/生産性
 ■ エディタ
 ■ グラフィカルインターネット
 ■ グラフィクス
 □ ゲームと娯楽
 ■ サウンドとビデオ
 □ テキストベースのインターネット
 □ 技術系と科学系
 □ 著作権と発行

【開発】
 □ GNOMEソフトウェア開発
 ■ Java開発
 □ KDEソフトウェア開発
 □ Ruby
 □ Xソフトウェア開発
 ■ レガシーなソフトウェアの開発
 ■ 開発ツール
 ■ 開発ライブラリ

【サーバー】
 □ DNSネームサーバー
 ■ FTPサーバー
 ■ MySQLデータベース
 □ PostgreSQLデータベース
 ■ Webサーバー
 ■ Windowsファイルサーバー
 ■ サーバー設定ツール
 □ ニュースサーバー 
 □ ネットワークサーバー
 □ メールサーバー
 □ レガシーなネットワークサーバー
 □ 印刷サポート

【ベースシステム】
 ■ Java
 ■ OpenFabrics Enterprise ディストリビューション
 ■ X Window System
 ■ システムツール
 □ ダイヤルアップネットワークサポート
 ■ ベース
 ■ レガシーなソフトウェアのサポート
 ■ 管理ツール

【仮想化】
 □ KVM
 □ 仮想化

【クラスタリング】
 □ クラスタリング

【クラスタストレージ】
 □ クラスタストレージ

【言語】
 ■ 日本語のサポート