Установка удобного менеджера проектов Redmine со связкой PostgreSQL
Подготавливаем структуру каталогов, создаем системного пользователя sudo mkdir -p /opt
cd /opt
svn co http://svn.redmine.org/redmine/branches/2.3-stable redmine-2.3
adduser --system -d /opt/redmine-2.3/ redmine
chown -R root.root /opt/redmine-2.3/
cd redmine-2.3
mkdir -p tmp tmp/pdf public/plugin_assets
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 files log tmp public/plugin_assets
Создаем базу данных createuser redmine
createdb redmine -O redmine
psql -q postgres
[postgres] =# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
redmine | redmine | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(4 rows)
Добавляем следующую строку:
host redmine redmine 127.0.0.1/32 trust
в /var/lib/pgsql/9.2/data/pg_hba.conf
и перегружаем postgresql
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all peer
# IPv4 local connections:
host redmine redmine 127.0.0.1/32 trust
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
service postgresql-9.2 restart
Проверяем, что пользователь redmine в postgresql настроены корректно. psql redmine -U redmine -h 127.0.0.1 -c 'select version();'
Вывод будет приблизительно следующий:
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 9.2.8 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-4), 64-bit
(1 строка)
Устанавливаем библиотеки Ruby yum install ruby
yum install gcc gcc-c++ make automake autoconf curl-devel openssl-devel zlib-devel httpd-devel apr-devel apr-util-devel sqlite-devel
yum install ruby-rdoc ruby-devel
yum install rubygems
yum install ruby-RMagick
yum install postgresql92-devel
yum install ImageMagick-devel
gem update
gem update --system
gem install rails
gem install bundler
Если вылезла следующая ошибка при установке рельсов
ERROR: Error installing rails:
activesupport requires Ruby version >= 1.9.3.
Установите Ruby или измените используемую версию для текущей сессии.
Создайте конфиг файл Redmine cp /opt/redmine-2.3/config/database.yml.example /opt/redmine-2.3/config/database.yml`
production:
adapter: postgresql
database: redmine
host: 127.0 .0 .1
username: redmine
password: "redmine"
Устанавливаем дополнительные бибилиотеки при помощи bundle Обратите внимание, если вы устанавливали PostgreSQL так как я описывал ранее, то вы должны явно указать путь до каталога с исполняемыми файлами PostgreSQL , т.к. по умолчанию дистрибутив устанавливается в нестандартное место.
cd /opt/redmine-2.3/
PATH=/usr/pgsql-9.2/bin:$PATH bundle install --without development test mysql2
Не забываем сгенерировать токен:
rake generate_secret_token
Создаем структуру базы данных и выполяем первичное заполнение RAILS_ENV=production rake db:migrate
RAILS_ENV=production REDMINE_LANG=ru rake redmine:load_default_data
Проверяем работоспособность Redmine: su -c 'ruby script/rails server webrick -e production' redmine
Вывод получится приблизительно следующий:
=> Booting WEBrick
=> Rails 3.2.13 application starting in production on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Rails Error: Unable to access log file. Please ensure that /opt/redmine-2.3/log /production.log exists and is chmod 0666. The log level has been raised to WARN and the output directed to STDERR until the problem is fixed.
OpenIdAuthentication.store is nil. Using in -memory store.
Creating scope :system. Overwriting existing method Enumeration.system.
Creating scope :sorted. Overwriting existing method Group.sorted.
Creating scope :sorted. Overwriting existing method User.sorted.
[2014-05-10 15:05:51] INFO WEBrick 1.3.1
[2014-05-10 15:05:51] INFO ruby 2.1.1 (2014-02-24) [x86_64-linux]
[2014-05-10 15:05:51] INFO WEBrick::HTTPServer
Настраиваем почтовые уведомления Отредактируйте configuration.yml
cd /opt/redmine-2.3/config/
cp configuration.yml.example configuration.yml
Раскомментируйте строчки:
production:
email_delivery:
delivery_method: :sendmail
Ставим NGINX и настраиваем как front-end Редактируем конфиг NGINX /etc/nginx/conf.d/default.conf
upstream mongrel {
server 127.0.0.1:8103 ;
}
server {
listen 80 ;
server_name localhost;
location / {
proxy_pass http://mongrel;
proxy_set_header Host $http_host ;
}
}
Настраиваем автостарт /etc/rc.local
(cd /opt/redmine-2.3/ && su -c 'ruby script/rails server webrick -e production -p 8103 -d' redmine)