...
Just my blog

Blog about everything, mostly about tech stuff I made. Here is the list of stuff I'm using at my blog. Feel free to ask me about implementations.

Soft I recommend
Py lib I recommend

I'm using these libraries so you can ask me about them.

Инсталим Redmine на Centos 6

Для начала следует сразу прочесть: официальный гайд СДЕЛАЛ СНЕПШОТ ВИРУАЛКИ После чего пойдем по нему:

yum -y install zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel

Я убрал сразу те пакеты, которые у меня уже были установлены:

openssl-devel httpd-devel mysql-devel

Не уверен только, что я последний раз ставил для SSL, поэтому его тоже не ставил, я ранее использовал шаровой сертификат для того, чтобы пробросить веб-приложение во Вконтакте под защищенным https. - но это уже совсем другая история!

Далее нужно скачать интерпретатор Ruby и распаковать его в нужной нам папке.
ftp ftp.ruby-lang.org 
Name (ftp.ruby-lang.org:root): anonymous
Password: anonymous
ftp> cd /pub/ruby 
ftp> get ruby-1.8.7-pXXX.tar.gz 
ftp> quit

У меня для этого была создана папка в \var\www\Downloads - чтобы не морочить голову я сразу скачал архив и положил его туда файлзиллой. После чего заолез в дерикторию и выполнил распаковку:

# You have now downloaded ruby and need to untar it
tar zxvf ruby-1.8.7-pXXX.tar.gz

Далее нужно это дело собрать и проинсталлить:

# Compile ruby
cd ruby-1.8.7-pXXX
./configure
make
make install

# Verify ruby installation
ruby -v
which ruby

Но у меня сразу с этим на зададилось, потом что я ничего не поставил из компиляторов:

[root@web-server ruby-1.8.7-p374]# ./configure
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/var/www/Downloads/ruby-1.8.7-p374':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

Вот и первый мой косяк, исправлямся, гуглим строчку ошибки и нагугливаем:

[root@web-server ruby-1.8.7-p374]# yum install gcc

Installed: gcc.x86_64 0:4.4.7-4.el6 Далее буду пробовать валить по списку инструкции, и попробую снова собрать: Проверка-конфиг: ./configure и далее все должно получиться:

config.status: creating Makefile
#Делаем
make
make install

Долго собирается... Проинсталил.

Следующий шаг: Get Gems 1.4.2 (does not work with Gems 1.5)

перейдем для этого в папку загрузок, которую я создавал ранее.

wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz
tar zxvf rubygems-1.4.2.tgz
cd rubygems-1.4.2
ruby setup.rb
gem -v
which gem
cd ..

[su_spoiler title="Лог: ruby setup.rb"]

[root@web-server rubygems-1.4.2]# ruby setup.rb RubyGems 1.4.2 installed === 1.4.2 / 2011-01-06 Bug fixes: * Gem::Versions: "1.b1" != "1.b.1", but "1.b1" eql? "1.b.1". Fixes gem indexing. * Fixed Gem.find_files. * Removed otherwise unused #find_all_dot_rb. Only 6 days old and hella buggy.
------------------------------------------------------------------------------ RubyGems installed the following executables: /usr/local/bin/gem
[root@web-server rubygems-1.4.2]# gem -v
1.4.2
[root@web-server rubygems-1.4.2]# which gem
/usr/local/bin/gem

[/su_spoiler]

И снова следующий шаг: Install Passenger (requires gcc)

Спасибо, что теперь нам решили сказать, что нужен gcc!

gem install passenger
passenger-install-apache2-module

Я пошел вторым путем, указанным для Centos 6 потому как не уверен, что первый способ не сломает мне к чертям апач. [su_spoiler title="Альтернативный метод: ЧИТАТЬ"]

An alternate method is to install mod_passenger RPM for Apache from the following location: 
http://passenger.stealthymonkeys.com/ 
RHEL/CentOS 5 
rpm -Uvh http://passenger.stealthymonkeys.com/rhel/5/passenger-release.noarch.rpm yum install mod_passenger 
RHEL/CentOS 6 
rpm --import http://passenger.stealthymonkeys.com/RPM-GPG-KEY-stealthymonkeys.asc yum install http://passenger.stealthymonkeys.com/rhel/6/passenger-release.noarch.rpm yum install mod_passenger

[/su_spoiler] Все должно проинсталлиться без боков.

service httpd restart

После рестарта все завелось, апач не отвалился.

Следующий шаг Download Redmine

Иду ручками по ссылке качать и заливать на ftp: Download page: http://rubyforge.org/frs/?group_id=1850 - ссылка не работает, совет бесполезен. Так что просто идем на http://redmine.org/ и качаем там последнюю версию редмайна, на сейчас это redmine-2.5.1.tar.gz

tar zxvf redmine-2.5.1.tar.gz

Тащу папку в её законное место:

cp -av redmine-2.5.1/* /var/www/work_tk

Почти готово, папка там, где ей следует быть. Сайт и папку для него я создавал заранее.

Далее гайд уготовил для меня особый шаг: Configure Apache to host the documents

more information can be found here: HowTo configure Apache to run Redmine - что ж, идем читать. Там дохера читать, поэтому я создаю для этого гайда отдельный пост - Пока пройдемся дальше по гайду, чтобы позже донастроить апач. 

Install Bundler
gem install bundler

[su_spoiler title="Вывод"]

Fetching: bundler-1.6.3.gem (100%)
Successfully installed
bundler-1.6.3 1 gem installed
Installing ri documentation for bundler-1.6.3...
Installing RDoc documentation for bundler-1.6.3...

[/su_spoiler]

Create Gemfile - создаем файл связей. Он будет лежать в

nano /var/www/work_tk/Gemfile

source "http://rubygems.org" 
gem "rake", "0.8.3" 
gem "rack", "1.1.0" 
gem "i18n", "0.4.2" 
gem "rubytree", "0.5.2", :require => "tree" 
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "mysql" 
gem "coderay", "~>0.9.7"

Оказалось, что некоторые уже были проставлены, но это ничего, в случае ошибок или повторений он на это укажет. Почитать подробнее можно здесь: http://bundler.io/ Каждый раз, когда связи были переписаны - их нужно обновлять:

bundle install

[su_spoiler title="Вывод"]

[root@web-server work_tk]# bundle install Don't run Bundler as root.
Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine. 
You cannot specify the same gem twice with different version requirements. You specified: coderay (~> 1.1.0) and coderay (~> 0.9.7)

[/su_spoiler] Установка прошла успешно: [su_spoiler title="Вывод"]

[root@web-server work_tk]# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and installing your bundle as root will break this application for all non-root users on this machine.
Your Gemfile lists the gem activerecord-jdbcmysql-adapter (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
/usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/fetcher.rb:288:in `request': no such file to load -- openssl (LoadError)
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/fetcher.rb:257:in `fetch'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/fetcher.rb:234:in `use_api'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/source/rubygems.rb:252:in `remote_specs'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/source/rubygems.rb:252:in `select'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/source/rubygems.rb:252:in `remote_specs'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/source/rubygems.rb:191:in `fetch_specs'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/source/rubygems.rb:64:in `specs'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:216:in `index'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:213:in `each'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:213:in `index'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/index.rb:9:in `build'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:209:in `index'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:203:in `resolve'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:133:in `specs'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/definition.rb:122:in `resolve_remotely!'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/installer.rb:76:in `run'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/installer.rb:15:in `install'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/cli/install.rb:78:in `run'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/cli.rb:146:in `install'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `__send__'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/vendor/thor/command.rb:27:in `run'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/vendor/thor/invocation.rb:121:in `invoke_command'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/vendor/thor.rb:363:in `dispatch'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/vendor/thor/base.rb:440:in `start'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/cli.rb:9:in `start'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/bin/bundle:20
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/lib/bundler/friendly_errors.rb:5:in `with_friendly_errors'
 from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.6.3/bin/bundle:20
 from /usr/local/bin/bundle:19:in `load'
 from /usr/local/bin/bundle:19

[/su_spoiler]

 Generate the session store
[root@web-server work_tk]# RAILS_ENV=production bundle exec rake generate_session_store
Could not find gem 'rails (= 3.2.17) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

Далее ошибочка вылезла, идем гуглить. Полез в файл Gemfile и закомментил там все, что отличалось от инструкции и здравого смысла, после чего снова `bundle install` и снова:

[root@web-server work_tk]# RAILS_ENV=production bundle exec rake generate_session_store

Теперь же он не смог найти следующее: Could not find gem 'rake (~> 10.1.1) ruby' in the gems available on this machine. Быстро гуглим и находим немного инфы: http://stackoverflow.com/questions/21591985/rails-could-not-find-rake-10-1-1-in-any-of-the-sources Нужно поставить модуль rake:

[root@web-server work_tk]# gem install rake
Fetching: rake-10.3.2.gem (100%)
Successfully installed rake-10.3.2
1 gem installed
Installing ri documentation for rake-10.3.2...
Installing RDoc documentation for rake-10.3.2...

Пробуем снова:

[root@web-server work_tk]# bundle install
[root@web-server work_tk]# RAILS_ENV=production bundle exec rake generate_session_store
Could not find gem 'rake (~> 10.1.1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

Пришла в голову идея, удалил все из Gemfile кроме:

gem "rake", "0.8.3" 
gem "rack", "1.1.0" 
gem "i18n", "0.4.2" 
gem "rubytree", "0.5.2", :require => "tree" 
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "mysql" 
gem "coderay", "~>0.9.7"
$end

Пробую снова - ругается только на указанные ждемы - буду ставить по одному. Список пополняется:

[root@web-server work_tk]# gem list
*** LOCAL GEMS ***
bundler (1.6.3)
coderay (1.1.0)
metaclass (0.0.4)
mocha (1.1.0)
rake (10.3.2)

Все джемы долны быть установлены согласно списка из инструкции, если чего-то не хваетает:

gem install #того, что не хватает

Возможные проблемы, потому что пропустил. Дело в том, что вначале, я пропустил установку yum -y mysql-devel - считая, что новая может затереть все мои базы, но не следовало так думать, а просто сделать бекап. Инфа  

[root@web-server work_tk]# gem install mysql2
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.16
1 gem installed
Installing ri documentation for mysql2-0.3.16...
Installing RDoc documentation for mysql2-0.3.16...

Проверяем установленные джемы: > gem list

[root@web-server work_tk]# gem list
*** LOCAL GEMS ***
bundler (1.6.3)
coderay (1.1.0)
i18n (0.6.9)
json (1.8.1)
metaclass (0.0.4)
mocha (1.1.0)
mysql2 (0.3.16)
rack (1.5.2)
rake (10.3.2)
RedCloth (4.2.9)
rubytree (0.9.3)
structured_warnings (0.1.4)

После чего снова инсталим и раним команду для ключей:

bundle install
RAILS_ENV=production bundle exec rake generate_session_store
[root@web-server work_tk]# RAILS_ENV=production bundle exec rake generate_session_store
rake aborted!
LoadError: no such file to load -- rails/all
/var/www/work_tk/config/application.rb:3:in `require'
/var/www/work_tk/config/application.rb:3
/var/www/work_tk/Rakefile:5:in `require'
/var/www/work_tk/Rakefile:5
(See full trace by running task with --trace)

Круг замкнулся, гайды снова выводят меня на официальный сайт: http://www.redmine.org/boards/1/topics/33293 Так вот оно что: 2 Ruby MRI 1.8.7 support has reached its EOL and its use is discouraged. See Important: Ruby 1.8.7 out of support and #14371 for additional information. Ставлю новейший значит.

tar zxvf ruby-1.9.3-p484.tar.gz
# Compile ruby
cd ruby-1.9.3-p484
./configure
make
make install

Не забыть обновить файл в /REDMINE_FOLDER/public/dispatch.fcgi На путь от комманды >which ruby: /usr/local/bin/ruby