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

Redmine — открытое серверное веб-приложение для управления проектами и задачами (в том числе для отслеживания ошибок). На сайте проекта все подробно описано об установке. Мы же разберем некоторые особенности при установки на CentOS 7.

Подготовка

1) Добавим сторонние репозиторий nginx и epel

# yum install epel-release
# vim /etc/yum.repos.d/nginx.repo

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/rhel/7/$basearch/
gpgcheck=0
enabled=1

2) Установим необходимые пакеты.

# yum update
# yum install ruby.x86_64 mariadb mariadb-server wget freetds-devel.x86_64 ImageMagick-c++-devel.x86_64 mariadb-devel.x86_64 gcc ruby-devel rubygem-json.x86_64 rubygem-psych.x86_64 libyaml nginx.x86_64

Замечу что в CentOS 7 в репозитории вместо пакета mysql-server находиться mariadb-server.
Предполагаю что такое изменение произошло из за неопределенной политике лицензирования Oracle.

3) Настроим сервис базы данных и создадим отдельную базы для redmine

Добавим в автозагрузку сервис базы данных.
# systemctl enable mariadb.service
# systemctl start mariadb

Подключимся к сервису базы данных и создадим базу
# mysql -u root
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

Установка Redmine

1) Скачаем с сайта архив с исходными кодами.

# cd /srv/
# wget http://www.redmine.org/releases/redmine-2.6.1.tar.gz
# tar -xf redmine-2.6.1.tar.gz
# mv redmine-2.6.1 redmine

2) Отредактируем фаил настроек базы данных

# cd /srv/redmine/config
# cp database.yml.example database.yml
# vim database.yml

production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: «redmine»
encoding: utf8

3) Установим bundler и необходимые gem’ы

# cd /srv/redmine
# gem install bundler
#export PATH='/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin'
# bundle install --without development test

4) Сгенерировать секретный ключ и инициализируем базу

# rake generate_secret_token
# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data
# mkdir -p tmp tmp/pdf public/plugin_assets

5) Запустим Redmine
# ruby script/rails server webrick -e production

6) Настрока Redmine + nginx + god + unicorn

30 thoughts on “Установка Redmine на CentOS 7

  1. При установке gem’ов возникла проблема установки nokogiri.
    (Running ‘patch’ for libxml2 2.9.2… ERROR)
    Решение установка пакета patch (yum install patch)
    И потом установка модуля (gem install nokogiri)

  2. Еще возникли проблемы с установкой rake generate_secret_token
    Ошибка: NameError: uninitialized constant ActionView::Helpers::ActiveModelHelper
    Решение: установка rvm и последнего ruby + переустановка всех gem’ов
    https://rvm.io/rvm/install
    gpg —keyserver hkp://keys.gnupg.net —recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    \curl -sSL https://get.rvm.io | bash -s stable —ruby

  3. Всё установил, но сайт не доступен по сети, что делать?
    => Booting WEBrick
    => Rails 4.2.4 application starting in production on http://localhost:3000
    => Run `rails server -h` for more startup options
    => Ctrl-C to shutdown server
    [2015-10-07 10:07:54] INFO WEBrick 1.3.1
    [2015-10-07 10:07:54] INFO ruby 2.2.1 (2015-02-26) [x86_64-linux]
    [2015-10-07 10:07:54] INFO WEBrick::HTTPServer#start: pid=4049 port=3000

    • что бы redmine был доступен не с localhost а из локальной сети запустите его
      следующей командой bundle exec rails server -b 0.0.0.0 -p 80 webrik -e production

      • Пробую bundle exec rails server -b 0.0.0.0 -p 80 webrik -e production (настроено всё по инструкции), результат:
        bundle exec rails server -b 0.0.0.0 -p 80 webrik -e production
        Exiting
        /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require’: cannot load such file — rack/handler/webrik (LoadError)
        from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler.rb:78:in `try_require’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler.rb:16:in `get’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:290:in `server’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:125:in `print_boot_information’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:75:in `start’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!’
        from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `’
        from bin/rails:4:in `require’
        from bin/rails:4:in `’

          • Аналогичный вывод:
            bundle exec rails server -b 0.0.0.0 -p 80 webriсk -e production
            Exiting
            /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require’: cannot load such file — rack/handler/webriсk (LoadError)
            from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler.rb:78:in `try_require’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/handler.rb:16:in `get’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/rack-1.6.4/lib/rack/server.rb:290:in `server’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:125:in `print_boot_information’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/server.rb:75:in `start’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:80:in `block in server’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `tap’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:75:in `server’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands/commands_tasks.rb:39:in `run_command!’
            from /usr/local/rvm/gems/ruby-2.2.1/gems/railties-4.2.4/lib/rails/commands.rb:17:in `’
            from bin/rails:4:in `require’
            from bin/rails:4:in `’

  4. Could not find gem ‘rails (= 3.2.21)’ in any of the gem sources listed in your Gemfile or available on this machine.
    Run `bundle install` to install missing gems.

  5. [root@redmine redmine]# gem install bundler
    Successfully installed bundler-1.11.2
    Parsing documentation for bundler-1.11.2
    1 gem installed
    [root@redmine redmine]#

    • 3) Установим bundler и необходимые gem’ы

      # cd /srv/redmine
      # gem install bundler
      #export PATH=’/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin’
      # bundle install —without development test

  6. [root@redmine ~]# cd /srv/redmine
    [root@redmine redmine]# gem install bundler
    Successfully installed bundler-1.11.2
    Parsing documentation for bundler-1.11.2
    1 gem installed
    [root@redmine redmine]# export PATH=./usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/user/.local/bin:/home/user/bin.
    [root@redmine redmine]# bundle install .without development test
    -bash: bundle: command not found
    [root@redmine redmine]# bundle install .without development test
    -bash: bundle: command not found
    [root@redmine redmine]#

  7. An error occurred while installing json (1.8.3), and Bundler cannot continue.
    Make sure that `gem install json -v ‘1.8.3’` succeeds before bundling.
    [root@redmine redmine]#

    видимо json нужен

  8. Using tzinfo 0.3.46
    Using bundler 1.11.2
    Using coderay 1.1.0
    Using htmlentities 4.3.1
    Installing json 1.8.3 with native extensions
    Killed

  9. [root@redmine redmine]# ruby script/rails server webrick -e production
    Could not find gem ‘rails (= 3.2.21)’ in any of the gem sources listed in your Gemfile or available on this machine.
    Run `bundle install` to install missing gems.

  10. [root@redmine redmine]# 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.
    /usr/share/gems/gems/psych-2.0.0/lib/psych.rb:98: warning: already initialized constant Psych::VERSION
    /usr/share/ruby/psych.rb:98: warning: previous definition of VERSION was here
    /usr/share/gems/gems/psych-2.0.0/lib/psych.rb:101: warning: already initialized constant Psych::LIBYAML_VERSION
    /usr/share/ruby/psych.rb:101: warning: previous definition of LIBYAML_VERSION was here
    Fetching gem metadata from https://rubygems.org/………..
    Fetching version metadata from https://rubygems.org/
    Fetching dependency metadata from https://rubygems.org/..
    Resolving dependencies……………….
    Rubygems 2.0.14 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
    Using rake 10.5.0
    Using i18n 0.6.11
    Using multi_json 1.11.2
    Using builder 3.0.4
    Using erubis 2.7.0
    Using journey 1.0.4
    Using rack 1.4.7
    Using hike 1.2.3
    Using tilt 1.4.1
    Using mime-types 1.25.1
    Using polyglot 0.3.5
    Using arel 3.0.3
    Using tzinfo 0.3.46
    Using bundler 1.11.2
    Using coderay 1.1.0
    Using htmlentities 4.3.1
    Installing json 1.8.3 with native extensions
    Killed

  11. gem install rails -V возможно будет устанавливаться долго из за медленного соединения или может еще какие проблемы, флаг -V показывает установку в детализированном виде

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *