Установка Redmine на CentOS 6

1. Проверка текущей версии CentOS.

cat /etc/redhat-release
CentOS release 6.5 (Final)

2. Подготовка к установке. Установка дополнительных пакетов.
[root@loginsrv ebabenko]# yum groupinstall «Development Tools»

[…skipped…]

Total download size: 3.8 M
Is this ok [y/N]: y

[…skipped…]

Dependency Updated:
systemtap-runtime.x86_64 0:1.6-5.el6_2

Complete!
[root@loginsrv ebabenko]# yum install zlib-devel openssl-devel

[…skipped…]

Total download size: 2.5 M
Is this ok [y/N]: y

[…skipped…]

Dependency Updated:
openssl.x86_64 0:1.0.0-20.el6_2.5

Complete!
[root@loginsrv ebabenko]# yum install ncurses-devel gdbm-devel openssl-devel zlib-devel readline-devel libyaml-devel

[…skipped…]

Total download size: 25 k
Installed size: 22 k
Is this ok [y/N]: y

[…skipped…]

Installed:
gdbm-devel.x86_64 0:1.8.0-36.el6

Complete!

3. Установка Ruby.

Качаем пакет с исходниками Ruby с сайта http://www.ruby-lang.org/en/downloads/ (на момент установки была доступна версия http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz)
[root@loginsrv ebabenko]# cp ~ebabenko/data/distrib/redmine/ruby-1.9.3-p194.tar.gz /usr/local/src
[root@loginsrv ebabenko]# cd /usr/local/src/
[root@loginsrv src]# tar zxvf ruby-1.9.3-p194.tar.gz

[…skipped…]

[root@loginsrv src]# rm ruby-1.9.3-p194.tar.gz
rm: remove regular file `ruby-1.9.3-p194.tar.gz’? y
[root@loginsrv src]# cd ruby-1.9.3-p194
[root@loginsrv ruby-1.9.3-p194]# ./configure
[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# make

[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# make install

[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# ruby -v
bash: ruby: command not found

Настроим переменные окружения:
[root@loginsrv ruby-1.9.3-p194]# /usr/local/bin/ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[root@loginsrv ruby-1.9.3-p194]# printenv PATH
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin:/opt/maven/maven-3.0.4:/opt/maven/maven-3.0.4/bin:/sbin:/bin:/usr/sbin:/usr/bin
[root@loginsrv ruby-1.9.3-p194]# echo ‘PATH=$PATH:/usr/local/bin’ >> /etc/profile
[root@loginsrv ruby-1.9.3-p194]# echo ‘export PATH’ >> /etc/profile
[root@loginsrv ruby-1.9.3-p194]# echo ‘PATH=$PATH:/usr/local/bin’ >> /root/.bash_profile
[root@loginsrv ruby-1.9.3-p194]# echo ‘export PATH’ >> /root/.bash_profile
[root@loginsrv ruby-1.9.3-p194]# visudo

Найти следующие строки:
#
# Adding HOME to env_keep may enable a user to run unrestricted
# commands via sudo.
#
# Defaults env_keep += «HOME»

Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin
В переменную secure_path добавить ‘:/usr/local/bin’
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Теперь требуется проверить что пути установлены правильно и они будут доступны для каждого пользователя. Для этого нужно перелогиниться в системе. После перелогина:
[ebabenko@loginsrv ~]$ whoami
ebabenko
[ebabenko@loginsrv ~]$ printenv PATH
/usr/lib64/qt-3.3/bin:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin:/opt/maven/maven-3.0.4:/opt/maven/maven-3.0.4/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/home/ebabenko/bin
[ebabenko@loginsrv ~]$ ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[ebabenko@loginsrv ~]$ sudo -s
[sudo] password for ebabenko:
[root@loginsrv ebabenko]# whoami
root
[root@loginsrv ebabenko]# printenv PATH
/usr/lib/jvm/jre-1.6.0-openjdk.x86_64:/usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin:/opt/maven/maven-3.0.4:/opt/maven/maven-3.0.4/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
[root@loginsrv ebabenko]# ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]

4. Установка RubyGems.

Качаем пакет с исходниками RubyGems с сайта http://rubyforge.org/frs/?group_id=126 (на момент установки была доступна версия http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz).
[root@loginsrv ebabenko]# cp ~ebabenko/data/distrib/redmine/rubygems-1.8.24.tgz /usr/local/src
[root@loginsrv ebabenko]# cd /usr/local/src/
[root@loginsrv src]# tar zxvf rubygems-1.8.24.tgz

[…skipped…]

[root@loginsrv src]# rm rubygems-1.8.24.tgz
rm: remove regular file `rubygems-1.8.24.tgz’? y
[root@loginsrv src]# cd rubygems-1.8.24
[root@loginsrv rubygems-1.8.24]# ruby setup.rb
/usr/local/lib/ruby/1.9.1/yaml.rb:56:in `’:
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.
RubyGems 1.8.24 installed

== 1.8.24 / 2012-04-27

* 1 bug fix:

* Install the .pem files properly. Fixes #320
* Remove OpenSSL dependency from the http code path
——————————————————————————

RubyGems installed the following executables:
/usr/local/bin/gem

Сообщение «It seems your ruby installation is missing psych (for YAML output). To eliminate this warning, please install libyaml and reinstall your ruby.» говорит что даже то, что устанавливались дополнительные пакеты, их было не достаточно для полноценной работы Ruby. Поэтому добавляем недостающую библиотеку.

[root@loginsrv rubygems-1.8.24]# cd ~ebabenko/data/distrib/redmine/
[root@loginsrv redmine]# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
—2012-06-26 11:05:57— http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
Resolving pyyaml.org… 70.87.222.22
Connecting to pyyaml.org|70.87.222.22|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 471759 (461K) [application/x-gzip]
Saving to: «yaml-0.1.4.tar.gz»

100%[=========================================================================>] 471,759 368K/s in 1.3s

2012-06-26 11:05:59 (368 KB/s) — «yaml-0.1.4.tar.gz» saved [471759/471759]

[root@loginsrv redmine]# cp yaml-0.1.4.tar.gz /usr/local/src
[root@loginsrv redmine]# cd /usr/local/src
[root@loginsrv src]# tar zxvf yaml-0.1.4.tar.gz
[root@loginsrv src]# rm yaml-0.1.4.tar.gz
rm: remove regular file `yaml-0.1.4.tar.gz’? y
[root@loginsrv src]# cd yaml-0.1.4
[root@loginsrv yaml-0.1.4]# ./configure

[…skipped…]

[root@loginsrv yaml-0.1.4]# make

[…skipped…]

[root@loginsrv yaml-0.1.4]# make install

[…skipped…]

И переустанавливаем Ruby и RubyGems.
[root@loginsrv yaml-0.1.4]# cd ../ruby-1.9.3-p194
[root@loginsrv ruby-1.9.3-p194]# ./configure

[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# make

[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# make install

[…skipped…]

[root@loginsrv ruby-1.9.3-p194]# ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
[root@loginsrv ruby-1.9.3-p194]# cd ../rubygems-1.8.24
[root@loginsrv rubygems-1.8.24]# ruby setup.rb
RubyGems 1.8.24 installed

== 1.8.24 / 2012-04-27

* 1 bug fix:

* Install the .pem files properly. Fixes #320
* Remove OpenSSL dependency from the http code path
——————————————————————————

RubyGems installed the following executables:
/usr/local/bin/gem

[root@loginsrv rubygems-1.8.24]# gem —version
1.8.24

5. Установка Rails.

[root@loginsrv src]# gem install rails -v 3.2.6

[…skipped…]

[root@loginsrv src]# rails -v
Rails 3.2.6

6. Установка Extra Packages for Enterprise Linux 6 (EPEL).

Доступный пакет для установки можно найти по адресу http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/, далее выбирается версия CentOS (major version), далее битность системы:
CentOS 6.2, major version 6, следовательно переходим в директорию 6
битность системы 64, следовательно переходим в директорию x86_64
На момент установки была доступна версия http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
[root@loginsrv src]# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
Retrieving http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-7.noarch.rpm
warning: /var/tmp/rpm-tmp.xxQEqE: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing… ########################################### [100%]
1:epel-release ########################################### [100%]
[root@loginsrv src]# yum repolist
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink | 18 kB 00:00
* base: mirror.awanti.com
* epel: mirror.awanti.com
* extras: mirror.awanti.com
* jpackage-generic: sunsite.informatik.rwth-aachen.de
* updates: mirror.awanti.com
epel | 4.0 kB 00:00
epel/primary_db | 4.6 MB 00:02
repo id repo name status
base CentOS-6 — Base 6,294
epel Extra Packages for Enterprise Linux 6 — x86_64 7,567
extras CentOS-6 — Extras 6
jpackage-generic JPackage (free), generic 2,277
updates CentOS-6 — Updates 1,147
repolist: 17,291

7. Установка MySQL.
[root@loginsrv src]# yum install mysql mysql-server mysql-devel

[…skipped…]

Total download size: 10 M
Is this ok [y/N]: y

[…skipped…]

Installed:
mysql-server.x86_64 0:5.1.61-1.el6_2.1

Dependency Installed:
perl-DBD-MySQL.x86_64 0:4.013-3.el6

Updated:
mysql.x86_64 0:5.1.61-1.el6_2.1
mysql-devel.x86_64 0:5.1.61-1.el6_2.1

Dependency Updated:
mysql-libs.x86_64 0:5.1.61-1.el6_2.1

Complete!

8. Конфигурация MySQL.
[root@goodjob rubygems-1.8.11]# vi /etc/my.cnf

Добавить в файл /etc/my.cnf поддержку UTF-8.
[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
default-character-set=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
default-character-set=utf8

9. Первый запуск MySQL.
[root@loginsrv src]# /etc/init.d/mysqld start
Initializing MySQL database: Installing MySQL system tables…
120626 13:37:37 [Warning] ‘—default-character-set’ is deprecated and will be removed in a future release. Please use ‘—character-set-server’ instead.
OK
Filling help tables…
120626 13:37:37 [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 loginsrv 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 ]

Первый запуск объявил, что параметр default-character-set имеет статус deprecated, поэтому его требуется заменить на character-set-server.
[root@loginsrv src]# /etc/init.d/mysqld stop
Stopping mysqld: [ OK ]
[root@goodjob rubygems-1.8.11]# vi /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
character-set-server=utf8

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
character-set-server=utf8
[root@loginsrv src]# /etc/init.d/mysqld start
Starting mysqld: [ OK ]

10. Создание пароля для root и удаление анонимного подключения к MySQL.
[root@loginsrv src]# mysql -uroot mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61 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> update user set password=password(‘mysqlpasswd’) where user = ‘root’;
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

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)

mysql> exit
Bye
[root@loginsrv src]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]

11. Создание базы данных и пользователя для Redmine.

Для Redmine создадим базу и пользователя со следующими параметрами:
Пользователь (login): redmine
Пароль: RedMinePasswd
Имя БД: redmine
Хост: localhost
[root@loginsrv src]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61 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> CREATE USER ‘redmine’@’localhost’ IDENTIFIED BY ‘RedMinePasswd’;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT USAGE ON *.* TO ‘redmine’@’localhost’ IDENTIFIED BY ‘RedMinePasswd’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE DATABASE IF NOT EXISTS `redmine`;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON `redmine`.* TO ‘redmine’@’localhost’;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

12. Установка автоматического запуска MySQL.
[root@loginsrv src]# /sbin/chkconfig mysqld on
[root@loginsrv src]# /sbin/chkconfig —list mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Проверяем существование библиотек для доступа к MySQL.
[root@loginsrv src]# ll /usr/lib64/mysql
total 3124
lrwxrwxrwx. 1 root root 26 Jun 26 12:20 libmysqlclient_r.so -> libmysqlclient_r.so.16.0.0
lrwxrwxrwx. 1 root root 26 Jun 26 12:20 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0
-rwxr-xr-x. 1 root root 1588200 Feb 9 01:39 libmysqlclient_r.so.16.0.0
lrwxrwxrwx. 1 root root 24 Jun 26 12:20 libmysqlclient.so -> libmysqlclient.so.16.0.0
lrwxrwxrwx. 1 root root 24 Jun 26 12:20 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0
-rwxr-xr-x. 1 root root 1577608 Feb 9 01:39 libmysqlclient.so.16.0.0
-rwxr-xr-x. 1 root root 12913 Feb 9 01:39 mysqlbug
-rwxr-xr-x. 1 root root 6386 Feb 9 01:39 mysql_config
drwxr-xr-x. 2 root root 4096 Jun 26 12:20 plugin
Для 32-битной версии библиотеки будут расположены в директории /usr/lib/mysql.

13. Установка ImageMagick.

Скачиваем и устанавливаем ImageMagick. На момент установки была доступна версия ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.7.7-9.tar.gz
[root@loginsrv src]# cd ~ebabenko/data/distrib/redmine
[root@loginsrv redmine]# wget ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.7.7-9.tar.gz

[…skipped…]

[root@loginsrv redmine]# cp ImageMagick-6.7.7-9.tar.gz /usr/local/src
[root@loginsrv redmine]# cd /usr/local/src
[root@loginsrv src]# tar zxvf ImageMagick-6.7.7-9.tar.gz

[…skipped…]

[root@loginsrv src]# rm ImageMagick-6.7.7-9.tar.gz
rm: remove regular file `ImageMagick-6.7.7-9.tar.gz’? y
[root@loginsrv src]# cd ImageMagick-6.7.7-9
[root@loginsrv ImageMagick-6.7.7-9]# ./configure

[…skipped…]

[root@loginsrv ImageMagick-6.7.7-9]# make

[…skipped…]

[root@loginsrv ImageMagick-6.7.7-9]# make install

[…skipped…]

14. Установка поддержки шрифтов TrueType.
[root@loginsrv ImageMagick-6.7.7-9]# cd ~ebabenko/data/distrib/redmine
[root@loginsrv redmine]# yum install rpm-build ttmkfdir cabextract

[…skipped…]

Total download size: 90 k
Installed size: 195 k
Is this ok [y/N]: y

[…skipped…]

Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Importing GPG key 0x0608B895:
Userid : EPEL (6) <epel@fedoraproject.org>
Package: epel-release-6-7.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6
Is this ok [y/N]: y

[…skipped…]

Installed:
cabextract.x86_64 0:1.3-3.el6

Dependency Installed:
libmspack.x86_64 0:0.2-0.1.20100723alpha.el6

Complete!
[root@loginsrv redmine]# wget http://dl.atrpms.net/el6.2-x86_64/atrpms/stable/atrpms-repo-6-5.el6.x86_64.rpm

[…skipped…]

[root@loginsrv redmine]# rpm -ihv atrpms-repo-6-5.el6.x86_64.rpm

[…skipped…]

[root@loginsrv redmine]# yum install chkfontpath

[…skipped…]

Total download size: 117 k
Installed size: 207 k
Is this ok [y/N]: y

[…skipped…]

Importing GPG key 0x66534C2B:
Userid : ATrpms.net (rpm signing key) <Axel.Thimm@ATrpms.net>
Package: atrpms-repo-6-5.el6.x86_64 (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-atrpms
Is this ok [y/N]: y

[…skipped…]

Installed:
chkfontpath.x86_64 0:1.10.1-2.el6

Dependency Installed:
libFS.x86_64 0:1.0.1-5.el6
xorg-x11-xfs.x86_64 1:1.0.5-7.el6

Complete!
[root@loginsrv redmine]# wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec

[…skipped…]

Требуется изменить ссылку на целевые файлы в файле msttcorefonts-2.0-1.spec.
[…skipped…]

function set_mirror {
local r m
r=`expr $RANDOM % $mirror_count + 1`
m=`echo $mirrors |cut -d+ -f$r`
mirror=»http://${m}.dl.sourceforge.net/sourceforge/corefonts/»
}

[…skipped…]

Ссылка должна выглядеть следующим образом:
mirror=»http://${m}.dl.sourceforge.net/project/corefonts/the%20fonts/final/»
[root@loginsrv redmine]# rpmbuild -bb msttcorefonts-2.0-1.spec

[…skipped…]

Checking for unpackaged file(s): /usr/lib/rpm/check-files /root/rpmbuild/BUILDROOT/msttcorefonts-2.0-1.x86_64
Wrote: /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.QPOQuY
+ umask 022
+ cd /root/rpmbuild/BUILD
+ ‘[‘ /root/rpmbuild/BUILDROOT/msttcorefonts-2.0-1.x86_64 ‘!=’ / ‘]’
+ rm -rf /root/rpmbuild/BUILDROOT/msttcorefonts-2.0-1.x86_64
+ exit 0

При успешном выполнении, в консоли будет показан путь, куда был записан пакет:
Wrote: /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
Устанавливаем.
[root@loginsrv redmine]# rpm -ivh /root/rpmbuild/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
Preparing… ########################################### [100%]
1:msttcorefonts ########################################### [100%]
[root@loginsrv redmine]# cd /usr/share/fonts/msttcorefonts
[root@loginsrv msttcorefonts]# mkfontscale
[root@loginsrv msttcorefonts]# mkfontdir
[root@loginsrv msttcorefonts]# mkdir -p /usr/share/fonts/default/TrueType
[root@loginsrv msttcorefonts]# cd /usr/share/fonts/default/TrueType
[root@loginsrv TrueType]# find /usr/share/fonts/msttcorefonts/ -exec ln -s {} \;
15. Установка RMagick.
[root@loginsrv TrueType]# cd /usr/local/src/
[root@loginsrv src]# gem list rmagick —all —remote

*** REMOTE GEMS ***

rmagick (2.13.1, 2.12.2, 2.12.1, 2.12.0, 2.11.1, 2.11.0, 2.10.0, 2.9.2, 2.9.1, 2.9.0, 2.8.0, 2.7.2, 2.7.1, 2.7.0, 2.6.0, 2.5.2, 2.5.1, 2.5.0, 2.4.0, 2.3.0, 2.2.2, 2.2.0, 2.1.0, 2.0.0, 1.15.17, 1.15.16, 1.15.15, 1.15.14, 1.15.13, 1.15.12, 1.15.11, 1.15.10, 1.15.9, 1.15.8, 1.15.7, 1.15.6, 1.15.5, 1.15.4, 1.15.3, 1.15.2, 1.15.1, 1.15.0, 1.14.1, 1.14.0, 1.13.0, 1.12.0, 1.11.1, 1.11.0, 1.10.1, 1.10.0, 1.9.3, 1.9.2, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.4, 1.7.3, 1.7.2, 1.7.1)
rmagick4j (0.3.7, 0.3.6, 0.3.5, 0.3.4 java, 0.3.3 java, 0.3.2 java, 0.3.1 java)
rmagick_captcha (0.6.2)
[root@loginsrv src]# whereis pkgconfig
pkgconfig: /usr/lib64/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig
[root@loginsrv src]# printenv PKG_CONFIG_PATH
[root@loginsrv src]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[root@loginsrv src]# printenv PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
[root@loginsrv src]# gem install rmagick —version 2.13.1
Fetching: rmagick-2.13.1.gem (100%)
Building native extensions. This could take a while…
Successfully installed rmagick-2.13.1
1 gem installed
Installing ri documentation for rmagick-2.13.1…
Installing RDoc documentation for rmagick-2.13.1…
[root@loginsrv src]# gem list rmagick

*** LOCAL GEMS ***

rmagick (2.13.1)

16. Установка Redmine.

Скачиваем дистрибутив Redmine версии 2.0.3 с сайта http://rubyforge.org/frs/?group_id=1850.
[root@loginsrv src]# cd ~ebabenko/data/distrib/redmine
[root@loginsrv redmine]# wget http://rubyforge.org/frs/download.php/76259/redmine-2.0.3.tar.gz

[…skipped…]

[root@loginsrv redmine]# cd /var/lib
[root@loginsrv lib]# cp ~ebabenko/data/distrib/redmine/redmine-2.0.3.tar.gz .
[root@loginsrv lib]# tar zxvf redmine-2.0.3.tar.gz

[…skipped…]

[root@loginsrv lib]# rm redmine-2.0.3.tar.gz
rm: remove regular file `redmine-2.0.3.tar.gz’? y
[root@loginsrv lib]# mv redmine-2.0.3 redmine

17. Установка Apache.
[root@loginsrv lib]# yum install httpd httpd-devel

[…skipped…]

Total download size: 1.6 M
Is this ok [y/N]: y

[…skipped…]

Installed:
httpd-devel.x86_64 0:2.2.15-15.el6.centos.1

Dependency Installed:
apr-devel.x86_64 0:1.3.9-5.el6_2
apr-util-devel.x86_64 0:1.3.9-3.el6_0.1
expat-devel.x86_64 0:2.0.1-11.el6_2

Updated:
httpd.x86_64 0:2.2.15-15.el6.centos.1

Dependency Updated:
apr.x86_64 0:1.3.9-5.el6_2
expat.x86_64 0:2.0.1-11.el6_2
httpd-tools.x86_64 0:2.2.15-15.el6.centos.1

Complete!

18. Начальная настройка Redmine.
[root@loginsrv lib]# pwd
/var/lib
[root@loginsrv lib]# chown -R apache:apache redmine

Конфигурируем database.yml.
[root@loginsrv lib]# cd redmine/config
[root@loginsrv config]# cp database.yml.example database.yml
[root@loginsrv config]# vi database.yml
Использоваться будет только одна конфигурация — production. Поэтому приводим соответствующую секцию к следующему виду:
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: RedMinePasswd
encoding: utf8
Если требуется использовать и другие конфигурации, другие секции этого файла так же требуется привести к подобному виду (а так же не забыть под каждую из них создать соответствующих пользователей и БД в MySQL).
Создаём токен.
[root@loginsrv config]# cd ../
[root@loginsrv redmine]# gem install bundler
Successfully installed bundler-1.1.4
1 gem installed
Installing ri documentation for bundler-1.1.4…
Installing RDoc documentation for bundler-1.1.4…
[root@loginsrv redmine]# bundle install —without development test postgresql sqlite

[…skipped…]

[root@loginsrv redmine]# rake generate_session_store

Note: The rake task generate_session_store has been deprecated, please use the replacement version generate_secret_token
[root@loginsrv redmine]# rake generate_secret_token
[root@loginsrv redmine]# ls config/initializers/secret_token.rb
config/initializers/secret_token.rb

19. Установка модуля MySQL для подключения через Ruby.
[root@loginsrv redmine]# gem install mysql
Fetching: mysql-2.8.1.gem (100%)
Building native extensions. This could take a while…
Successfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1…
Installing RDoc documentation for mysql-2.8.1…
[root@loginsrv redmine]# whereis ruby
ruby: /usr/local/bin/ruby /usr/local/lib/ruby
[root@loginsrv redmine]# cd /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1
[root@loginsrv mysql-2.8.1]# whereis mysql_config
mysql_config: /usr/bin/mysql_config /usr/share/man/man1/mysql_config.1.gz
[root@loginsrv mysql-2.8.1]# ruby ext/mysql_api/extconf.rb —with-mysql-config=/usr/bin/mysql_config
checking for mysql_ssl_set()… yes
checking for rb_str_set_len()… yes
checking for rb_thread_start_timer()… no
checking for mysql.h… yes
ext/mysql_api/extconf.rb:67: Use RbConfig instead of obsolete and deprecated Config.
creating Makefile
[root@loginsrv mysql-2.8.1]# make
linking shared-object mysql_api.so
gcc: mysql.o: No such file or directory
make: *** [mysql_api.so] Error 1

Отредактировал Makefile следующим образом:
[root@loginsrv mysql-2.8.1]# vi Makefile
[…skipped…]

SRCS = mysql.c
OBJS = $(srcdir)/mysql.o

[…skipped…]

Собираем и устанавливаем.
[root@loginsrv mysql-2.8.1]# make
linking shared-object mysql_api.so
[root@loginsrv mysql-2.8.1]# make install
/usr/bin/install -c -m 0755 mysql_api.so /usr/local/lib/ruby/site_ruby/1.9.1/x86_64-linux
installing default mysql_api libraries
[root@loginsrv mysql-2.8.1]# cd /var/lib/redmine/lib
[root@loginsrv lib]# ln -s /usr/local/lib/ruby/gems/1.9.1/gems/mysql-2.8.1/lib/mysql.rb
[root@loginsrv lib]# cd ../
[root@loginsrv redmine]# rake db:migrate RAILS_ENV=production

[…skipped…]

[root@loginsrv redmine]# rake redmine:load_default_data RAILS_ENV=production

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, sq, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] ru
====================================
Default configuration data loaded.

20. Настройка файла configuration.yml.
[root@loginsrv redmine]# cd config
[root@loginsrv config]# cp configuration.yml.example configuration.yml
[root@loginsrv config]# vi configuration.yml
Найдите следующую запись и отредактируйте её в соответствии с вашими параметрами и предпочтениями.
# default configuration options for all environments
default:
# Outgoing emails configuration (see examples above)
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.example.net
port: 25
domain: example.net
authentication: :login
user_name: «redmine@example.net»
password: «redmine»
В начале файла приводится список различных примеров конфигураций. Я настроил на собственный ящик в GMail.
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
tls: true
enable_starttls_auto: true
address: «smtp.gmail.com»
port: 587
domain: «smtp.gmail.com»
authentication: :plain
user_name: «patttern@gmail.com»
password: «****»

21. Установка Passenger.
[root@loginsrv config]# cd /usr/local/src
[root@loginsrv src]# gem install passenger
Fetching: fastthread-1.0.7.gem (100%)
Building native extensions. This could take a while…
Fetching: daemon_controller-1.0.0.gem (100%)
Fetching: passenger-3.0.13.gem (100%)
Successfully installed fastthread-1.0.7
Successfully installed daemon_controller-1.0.0
Successfully installed passenger-3.0.13
3 gems installed
Installing ri documentation for fastthread-1.0.7…
Installing ri documentation for daemon_controller-1.0.0…
Installing ri documentation for passenger-3.0.13…
Installing RDoc documentation for fastthread-1.0.7…
Installing RDoc documentation for daemon_controller-1.0.0…
Installing RDoc documentation for passenger-3.0.13…
[root@loginsrv src]# yum install curl-devel

[…skipped…]

Total download size: 598 k
Is this ok [y/N]: y

[…skipped…]

Updated:
libcurl-devel.x86_64 0:7.19.7-26.el6_2.4

Dependency Updated:
curl.x86_64 0:7.19.7-26.el6_2.4
libcurl.x86_64 0:7.19.7-26.el6_2.4

Complete!
[root@loginsrv src]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v3.0.13.

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.
1

———————————————

Checking for required software…

[…skipped…]

———————————————
Compiling and installing Apache 2 module…

[…skipped…]

———————————————
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.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13
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:

<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/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/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.

22. Подключение и настройка модуля Passenger к Apache.

Для начала требуется создать файл конфигурации Passenger для Apache с содержимым, которое было объявлено при установке модуля + дополнительные настройки, которые я тупо скопировал с источника [1] (если вам требуется).
[root@loginsrv src]# vi /etc/httpd/conf.d/passenger.conf
# Pathes from passenger-install-apache2-module
LoadModule passenger_module /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.9.1/gems/passenger-3.0.13
PassengerRuby /usr/local/bin/ruby

# Remove HTTP Headers
Header always unset «X-Powered-By»
Header always unset «X-Rack-Cache»
Header always unset «X-Content-Digest»
Header always unset «X-Runtime»

# Tuning of Passenger
PassengerMaxPoolSize 20
PassengerMaxInstancesPerApp 4
PassengerPoolIdleTime 3600
PassengerUseGlobalQueue on
PassengerHighPerformance on
PassengerStatThrottleRate 10
RailsSpawnMethod smart
RailsAppSpawnerIdleTime 86400
RailsFrameworkSpawnerIdleTime 0

# ServerName Host:Port
ServerName bt.esphere.ru:80

Правим конфигурационный файл Apache.
[root@loginsrv src]# vi /etc/httpd/conf/httpd.conf

Добавляем в конец файла следующие строки.
<VirtualHost *:80>
ServerName bt.esphere.ru
DocumentRoot /var/www/html
RailsEnv production
RailsBaseURI /redmine
</VirtualHost>

Опция «RailsEnv production» используется опционально. Если вы планируете использовать несколько концигураций, этот параметр можно опустить (или закомментировать). Создаем симлинк на Redmine.
[root@loginsrv src]# ln -s /var/lib/redmine/public /var/www/html/redmine

23. Запуск Apache и установка его автозагрузки.
[root@loginsrv src]# /etc/init.d/httpd start
Starting httpd: [ OK ]
[root@loginsrv src]# /sbin/chkconfig httpd on
[root@loginsrv src]# /sbin/chkconfig —list httpd
httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off

 

Тэги: ,

Вы должны залогиниттся ,чтобы оставить комментарий.