📜 ⬆️ ⬇️

Installing the latest RedMine + Apache + nginx

Redmine logo

I will give a brief summary of RedMine:


It was very important for me to install the latest versions of all the modules, I got a lot of sources, but almost all of them were unfinished, and the configuration was very inconvenient.
So I had to make a universal configuration myself, which can work under any of the main Web servers.

We put on CentOS 6.5 x86_64:
[root@Red ~]#uname -a Linux Red 2.6.32-431.17.1.el6.x86_64 #1 SMP Wed May 7 23:32:49 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux [root@Red ~]# lsb_release -a LSB Version::base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch Distributor ID:CentOS Description:CentOS release 6.5 (Final) Release:6.5 Codename:Final [root@Red ~]# 

')
Make sure all the packages are fresh:
 [root@Red ~]# yum update Loaded plugins: downloadonly, fastestmirror, security, verify Loading mirror speeds from cached hostfile Setting up Update Process No Packages marked for Update [root@Red ~]# 


Add the epel repository
 [root@Red ~]# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm 


Immediately install all the packages that we need, and not on the go ...
 [root@Red ~]# yum groupinstall "Development Tools" [root@Red ~]# yum install zlib-devel openssl-devel ncurses-devel gdbm-devel openssl-devel zlib-devel readline-devel libyaml-devel curl-devel httpd-devel apr-devel apr-util-devel mysql-devel libffi-devel rpm-build ttmkfdir cabextract 


Download the necessary sources, after looking at and checking the compatibility of the packages:
 [root@Red ~]# cd /usr/src [root@Red src]# [root@Red src]# wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz [root@Red src]# wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz [root@Red src]# wget ftp://ftp.kddlabs.co.jp/graphics/ImageMagick/ImageMagick-6.8.9-1.tar.gz [root@Red src]# wget http://pyyaml.org/download/libyaml/yaml-0.1.6.tar.gz [root@Red src]# wget http://rubyforge.org/frs/download.php/76729/rubygems-1.8.25.tgz 


Unpack and configure Rubby itself
 [root@Red src]# tar zxvf ruby-2.1.2.tar.gz [root@Red ruby-2.1.2]# ./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... gcc [...skipped...] checking for nroff... /usr/bin/nroff .ext/include/x86_64-linux/ruby/config.h updated ruby library version = 2.1.0 configure: creating ./config.status config.status: creating GNUmakefile config.status: creating Makefile config.status: creating ruby-2.1.pc [root@Red ruby-2.1.2]# 


There are no lines with non-found files / libraries - you can compile and install!
 [root@Red ruby-2.1.2]# make [root@Red ruby-2.1.2]# make install 


Check the version of Rubby
 [root@Red ruby-2.1.2]# rubby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux] 


Unpack and install RubyGems
 [root@Red src]# tar zxvf rubygems-1.8.25.tgz [root@Red src]# cd rubygems-1.8.25 [root@Red rubygems-1.8.25]# ruby setup.rb RubyGems 1.8.25 installed == 1.8.25/ 2013-01-24 * 6 bug fixes: * Added 11627 to setup bin_file location to protect against errors. Fixes #328 by ConradIrwin * Specification#ruby_code didn't handle Requirement with multiple * Fix error on creating a Version object with a frozen string. * Fix incremental index updates * Fix missing load_yaml in YAML-related requirement.rb code. * Manually backport encoding-aware YAML gemspec ------------------------------------------------------------------------------ RubyGems installed the following executables: /usr/local/bin/gem 

Check the version of RubyGems
 [root@Red rubygems-1.8.25]# gem --version 1.8.25 [root@Red rubygems-1.8.25]# 


Let's see which version of Rails is available.
 [root@Red rubygems-1.8.25]# gem list -r --all rails *** REMOTE GEMS *** rails (4.1.1, 4.1.0, 4.0.5, 4.0.4, 4.0.3, 4.0.2, 4.0.1, 4.0.0, 3.2.18, 3.2.17, 3.2.16, 3.2.15, 3.2.14, 3.2.13, 3.2.12, 3.2.11, 3.2.10, 3.2.9, 3.2.8, 3.2.7, 3.2.6, 3.2.5, 3.2.4, 3.2.3, 3.2.2, 3.2.1, 3.2.0, 3.1.12, 3.1.11, 3.1.10, 3.1.9, 3.1.8, 3.1.7, 3.1.6, 3.1.5, 3.1.4, 3.1.3, 3.1.2, 3.1.1, 3.1.0, 3.0.20, 3.0.19, 3.0.18, 3.0.17, 3.0.16, 3.0.15, 3.0.14, 3.0.13, 3.0.12, 3.0.11, 3.0.10, 3.0.9, 3.0.8, 3.0.7, 3.0.6, 3.0.5, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 2.3.18, 2.3.17, 2.3.16, 2.3.15, 2.3.14, 2.3.12, 2.3.11, 2.3.10, 2.3.9, 2.3.8, 2.3.7, 2.3.6, 2.3.5, 2.3.4, 2.3.3, 2.3.2, 2.2.3, 2.2.2, 2.1.2, 2.1.1, 2.1.0, 2.0.5, 2.0.4, 2.0.2, 2.0.1, 2.0.0, 1.2.6, 1.2.5, 1.2.4, 1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.6, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 1.0.0, 0.14.4, 0.14.3, 0.14.2, 0.14.1, 0.13.1, 0.13.0, 0.12.1, 0.12.0, 0.11.1, 0.11.0, 0.10.1, 0.10.0, 0.9.5, 0.9.4.1, 0.9.4, 0.9.3, 0.9.2, 0.9.1, 0.9.0, 0.8.5, 0.8.0) rails-3-settings (0.1.1) rails-action-args (0.1.1, 0.1.0) [root@Red rubygems-1.8.25]# 

Install Rails. If you want without extra documentation, then add the parameters —no-rdoc —no-ri

Thanks to Mark for this hint, in one of his posts - rubydev.ru/2012/09/tipstricks-no-ri-no-rdoc-gem-install
 [root@Red rubygems-1.8.25]# gem install rails Fetching: i18n-0.6.9.gem Fetching: i18n-0.6.9.gem (100%) Fetching: json-1.8.1.gem Fetching: json-1.8.1.gem (100%) Building native extensions. This could take a while... Fetching: thread_safe-0.3.3.gem [...skipped...] Fetching: rails-4.1.1.gem Fetching: rails-4.1.1.gem (100%) Successfully installed i18n-0.6.9 Successfully installed json-1.8.1 Successfully installed thread_safe-0.3.3 Successfully installed tzinfo-1.1.0 [...skipped...] Successfully installed rails-4.1.1 30 gems installed Installing ri documentation for i18n-0.6.9... Installing ri documentation for json-1.8.1... [...skipped...] Installing RDoc documentation for rails-4.1.1... [root@Red rubygems-1.8.25]# 


Check the Rails version:
 [root@Red src]# rails -v Rails 4.1.1 [root@Red src]# 


Then update the gem
 [root@Red src]# gem update --system Updating rubygems-update Fetching: rubygems-update-2.2.2.gem [...skipped...] Fetching: rubygems-update-2.2.2.gem (100%) Successfully installed rubygems-update-2.2.2 Installing RubyGems 2.2.2 RubyGems 2.2.2 installed Parsing documentation for rubygems-2.2.2 Installing ri documentation for rubygems-2.2.2 === 2.2.1 / 2014-01-06 Bug fixes: * Platforms in the Gemfile.lock GEM section are now handled correctly. Bug #767 by Diego Viola. [...skipped...] RubyGems installed the following executables: /usr/local/bin/gem Ruby Interactive (ri) documentation was installed. ri is kind of like man pages for ruby libraries. You may access it like this: ri Classname ri Classname.class_method ri Classname#instance_method If you do not wish to install this documentation in the future, use the --no-document flag, or set it as the default in your ~/.gemrc file. See 'gem help env' for details. RubyGems system software updated 

 [root@Red src]# gem --version 2.2.2 [root@Red src]# 


Checking the previously installed MySQL version
 [root@Red src]# yum list mysql mysql-server mysql-devellist Loaded plugins: downloadonly, fastestmirror, security, verify Loading mirror speeds from cached hostfile Installed Packages mysql.x86_64 5.1.73-3.el6_5 @updates mysql-devel.x86_64 5.1.73-3.el6_5 @updates mysql-server.x86_64 5.1.73-3.el6_5 @updates Available Packages mysql-devel.i686 5.1.73-3.el6_5 updates [root@Red src]# 


Make sure that everything is in order with UTF-8 and is set by default in the /etc/my.cnf file
 [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 

Although some suggest setting default-character-set = utf8

Making the first start of MySQL
 [root@Red etc]# servisece mysqld start Initializing MySQL database: 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 Red 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 ] [root@Red etc]# 

Create a mysqlroot password to MySQL
 [root@Red etc]# 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.73 Source distribution Copyright (c) 2000, 2013, 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';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@Red etc]# service mysqld restart Stopping mysqld: [ OK ] Starting mysqld: [ OK ] [root@Red etc]# 

Create user and password for redmine database
 [root@Red etc]# 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.73 Source distribution Copyright (c) 2000, 2013, 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 'RedPASS'; Query OK, 0 rows affected (0.00 sec) mysql> GRANT USAGE ON *.* TO 'redmine'@'localhost' IDENTIFIED BY 'RedPASS' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USE R_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 [root@Red etc]# 

We add with check of MySQL to autoload
 [root@Red etc]# chkconfig --list mysqld mysqld 0:off1:off2:off3:off4:off5:off6:off [root@Red etc]# chkconfig mysqld on [root@Red etc]# chkconfig --list mysqld mysqld 0:off1:off2:on3:on4:on5:on6:off [root@Red etc]# 


Just in case, check the dependent libraries for MySQL.
 [root@Red etc]# ll /usr/lib64/mysql total 3144 lrwxrwxrwx 1 root root 26 May 13 13:16 libmysqlclient_r.so -> libmysqlclient_r.so.16.0.0 lrwxrwxrwx 1 root root 26 May 13 12:51 libmysqlclient_r.so.16 -> libmysqlclient_r.so.16.0.0 -rwxr-xr-x 1 root root 1598280 Feb 12 21:42 libmysqlclient_r.so.16.0.0 lrwxrwxrwx 1 root root 24 May 13 13:16 libmysqlclient.so -> libmysqlclient.so.16.0.0 lrwxrwxrwx 1 root root 24 May 13 12:51 libmysqlclient.so.16 -> libmysqlclient.so.16.0.0 -rwxr-xr-x 1 root root 1587712 Feb 12 21:42 libmysqlclient.so.16.0.0 -rwxr-xr-x 1 root root 12935 Feb 12 21:42 mysqlbug -rwxr-xr-x 1 root root 6399 Feb 12 21:42 mysql_config drwxr-xr-x 2 root root 4096 May 13 12:52 plugin [root@Red etc]# 


Do not forget to add rules for port 3306 and access zone in / etc / sysconfig / iptables
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT 


Restart iptables
 [root@Red sysconfig]# service iptables restart iptables: Setting chains to policy ACCEPT: filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] iptables: Applying firewall rules: [ OK ] [root@Red sysconfig]# 


Personally, I prefer to give full rights to any host, and then separately configure in HeidiSQL or phpMyAdmin.
 mysql> GRANT ALL PRIVILEGES ON `root`.* TO '*'@'*'; 


Although you can install the latest version of ImageMagick through the repository - 6.5.4.7-7.
 [root@Red src]# yum list ImageMagick ImageMagick-devel Loaded plugins: downloadonly, fastestmirror, security, verify Loading mirror speeds from cached hostfile * base: ftp.colocall.net * epel: ftp.colocall.net * extras: ftp.colocall.net * updates: ftp.colocall.net Available Packages ImageMagick.i686 6.5.4.7-7.el6_5 updates ImageMagick.x86_64 6.5.4.7-7.el6_5 updates ImageMagick-devel.i686 6.5.4.7-7.el6_5 updates ImageMagick-devel.x86_64 6.5.4.7-7.el6_5 updates [root@Red src]# 


I install the latest ImageMagick from source:
 [root@Red src]# tar zxvf ImageMagick-6.8.9-1.tar.gz [root@Red ImageMagick-6.8.9-1]# ./configure configuring ImageMagick 6.8.9-1 checking build system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu [...skipped...] Update ImageMagick configuration checking that generated files are newer than configure... done configure: creating ./config.status config.status: creating common.shi [...skipped...] ImageMagick is configured as follows. Please verify that this configuration matches your expectations. Host system type: x86_64-unknown-linux-gnu Build system type: x86_64-unknown-linux-gnu Option Value ------------------------------------------------------------------------------- Shared libraries --enable-shared=yesyes [...skipped...] Options used to compile and link: PREFIX = /usr/local EXEC-PREFIX = /usr/local VERSION = 6.8.9 CC = gcc -std=gnu99 -std=gnu99 [...skipped...] 

Look for no errors, missing files, and then make
 [root@Red ImageMagick-6.8.9-1]# make make all-recursive make[1]: Entering directory `/usr/src/ImageMagick-6.8.9-1' Making all in . make[2]: Entering directory `/usr/src/ImageMagick-6.8.9-1' CC magick/magick_libMagickCore_6_Q16_la-accelerate.lo CC magick/magick_libMagickCore_6_Q16_la-animate.lo [...skipped...] cp -f magick/ImageMagick.pc magick/ImageMagick-6.Q16.pc cp -f magick/MagickCore.pc magick/MagickCore-6.Q16.pc cp -f wand/MagickWand.pc wand/MagickWand-6.Q16.pc cp -f wand/Wand.pc wand/Wand-6.Q16.pc cp -f Magick++/lib/Magick++.pc Magick++/lib/Magick++-6.Q16.pc cp -f Magick++/lib/ImageMagick++.pc Magick++/lib/ImageMagick++-6.Q16.pc make[2]: Leaving directory `/usr/src/ImageMagick-6.8.9-1' make[1]: Leaving directory `/usr/src/ImageMagick-6.8.9-1' [root@Red ImageMagick-6.8.9-1]# 


Check out the work of ImageMagick,

After that we will have a picture ImageMagic.gif can be downloaded and viewed.
 [root@Red src]# /usr/local/bin/convert loho: imagemagic.gif 

Imagemagick

Installs TrueType font support.
 [root@Red src]# rpm -Uihv http://dl.atrpms.net/el6.5-x86_64/atrpms/stable/atrpms-repo-6-7.el6.x86_64.rpm [root@Red src]# yum install chkfontpath 


Install the MS TrueType fonts. On the page corefonts.sourceforge.net we look and install the latest version
 [root@Red src]# wget http://corefonts.sourceforge.net/msttcorefonts-2.5-1.spec 


Through MC we find the line set_mirror {in this file and check or change the mirror to a line like this:
 mirror="http://${m}.dl.sourceforge.net/project/corefonts/the%20fonts/final/" 


After that, run the command, many packages will be downloaded and finally we will see where the installation package is located
 [root@Red src]# rpmbuild -bb msttcorefonts-2.5-1.spec [...skipped...] Wrote: /root/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.VHo2lJ + umask 022 + cd /root/rpmbuild/BUILD + '[' /root/rpmbuild/BUILDROOT/msttcorefonts-2.5-1.x86_64 '!=' / ']' + rm -rf /root/rpmbuild/BUILDROOT/msttcorefonts-2.5-1.x86_64 + exit 0 [root@Red src]# 


Install it and make the necessary links:
 [root@Red src]# rpm -ivh /root/rpmbuild/RPMS/noarch/msttcorefonts-2.5-1.noarch.rpm Preparing... ########################################### [100%] 1:msttcorefonts ########################################### [100%] [root@Red src]# cd /usr/share/fonts/msttcorefonts [root@Red msttcorefonts]# mkfontscale [root@Red msttcorefonts]# mkfontdir [root@Red msttcorefonts]# mkdir -p /usr/share/fonts/default/TrueType [root@Red msttcorefonts]# cd /usr/share/fonts/default/TrueType [root@Red TrueType]# find /usr/share/fonts/msttcorefonts/ -exec ln -s {} \; [root@Red TrueType]# 


Installing RMagick and its paths.
 [root@Red TrueType]# cd /usr/local/src/ [root@Red src]# gem list rmagick --all --remote *** REMOTE GEMS *** compass-rmagick-engine (0.0.2, 0.0.1) hornetseye-rmagick (1.0.3, 1.0.2, 1.0.1, 1.0.0, 0.5.0, 0.4.0, 0.3.1, 0.3.0, 0.2.2, 0.2.1, 0.2.0, 0.1.0) jdeerhake-compass-rmagick-engine (0.0.4, 0.0.3) rdp-rmagick (0.0.0) rmagick (2.13.2, 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) rmagick-metadata (0.0.2, 0.0.1) rmagick-screwdrivers (0.2.0, 0.1.2, 0.1.1) rmagick-sprite (0.0.8, 0.0.7, 0.0.6, 0.0.5, 0.0.4) rmagick4j (0.3.8, 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@Red src]# [root@Red src]# whereis pkgconfig pkgconfig: /usr/lib64/pkgconfig /usr/local/lib/pkgconfig /usr/share/pkgconfig [root@Red src]# printenv PKG_CONFIG_PATH [root@Red src]# export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig [root@Red src]# printenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig [root@Red src]# gem install rmagick Building native extensions. This could take a while... Successfully installed rmagick-2.13.2 Parsing documentation for rmagick-2.13.2 Installing ri documentation for rmagick-2.13.2 Done installing documentation for rmagick after 5 seconds 1 gem installed [root@Red src]# gem list rmagick *** LOCAL GEMS *** rmagick (2.13.2) [root@Red src]# 

Install passenger and apache module
 [root@Red redmine]# gem install passenger Fetching: daemon_controller-1.2.0.gem Fetching: daemon_controller-1.2.0.gem (100%) Successfully installed daemon_controller-1.2.0 Fetching: passenger-4.0.42.gem Fetching: passenger-4.0.42.gem (100%) Building native extensions. This could take a while... Successfully installed passenger-4.0.42 Parsing documentation for daemon_controller-1.2.0 Installing ri documentation for daemon_controller-1.2.0 Parsing documentation for passenger-4.0.42 Installing ri documentation for passenger-4.0.42 Done installing documentation for daemon_controller, passenger after 3 seconds 2 gems installed [root@Red redmine]# passenger-install-apache2-module Welcome to the Phusion Passenger Apache 2 module installer, v4.0.42. 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. 

We press Enter and Enter again - choosing Ruby, the compilation will go and as a result we will see:
 cd 'buildout/ruby/ruby-2.1.2-x86_64-linux/' && make compiling /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/ext/ruby/passenger_native_support.c /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/ext/ruby/passenger_native_support.c: In function f_generic_writev: /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/ext/ruby/passenger_native_support.c:327: warning: rb_thread_blocking_region is deprecated (declared at /usr/local/include/ruby-2.1.0/ruby/intern.h:870) linking shared-object passenger_native_support.so -------------------------------------------- Almost there! Please edit your Apache configuration file, and add these lines: LoadModule passenger_module /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42 PassengerDefaultRuby /usr/local/bin/ruby After you restart Apache, you are ready to deploy any number of web applications on Apache, with a minimum amount of configuration! Press ENTER to continue. -------------------------------------------- Deploying a web application: an example Suppose you have a web application in /somewhere. Add a virtual host to your Apache configuration file and set its DocumentRoot to /somewhere/public: ServerName www.yourhost.com # !!! Be sure to point DocumentRoot to 'public'! DocumentRoot /somewhere/public # This relaxes Apache security settings. AllowOverride all # MultiViews must be turned off. Options -MultiViews # Uncomment this if you're on Apache >= 2.4: #Require all granted 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/2.1.0/gems/passenger-4.0.42/doc/Users guide Apache.html http://www.modrails.com/documentation/Users%20guide%20Apache.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. [root@Red redmine]# 

According to the written settings, we will add the passenger configuration to apache by creating the /etc/httpd/conf.d/passenger.conf file
 # Pathes from passenger-install-apache2-module LoadModule passenger_module /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/buildout/apache2/mod_passenger.so PassengerRoot /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42 PassengerDefaultRuby /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 redmine:80 

After this, we will make the primary setting of RedMine, and since there will be a single configuration (production) on the host
then according to the example /var/www/redmine/www/config/database.yml.example in the same place we create the file database.yml
 # Default setup is given for MySQL with ruby1.9. If you're running Redmine # with MySQL and ruby1.8, replace the adapter name with `mysql`. # Examples for PostgreSQL, SQLite3 and SQL Server can be found at the end. # Line indentation must be 2 spaces (no tabs). production: adapter: mysql2 database: redmine host: localhost username: redmine password: "RedPASS" encoding: utf8 

In the same place, we create a configuration.yml file in which we specify the data for the mail in order to be able to receive notifications from RedMine. Everything depends on your mail server, protocols, authorization methods, etc. Those. there may have to work hard and look for extra. information
 # default configuration options for all environments default: # Outgoing emails configuration (see examples above) attachments_storage_path: /var/www/redmine/www/files autologin_cookie_name: autologin_cookie_path: autologin_cookie_secure: # scm_stderr_log_file: /var/log/redmine_scm_stderr.log scm_stderr_log_file: database_cipher_key: # Linux: # rmagick_font_path: /usr/share/fonts/ipa-mincho/ipam.ttf rmagick_font_path: # specific configuration options for production environment # that overrides the default ones production: email_delivery: delivery_method: :smtp smtp_settings: address: mail.domain.com port: 25 domain: domain.com authentication: :login user_name: redmine@domain.com password: RedMailPASS # specific configuration options for development environment # that overrides the default ones development: 

Install Bundler
 [root@Red www]# gem install bundler Successfully installed bundler-1.6.2 Parsing documentation for bundler-1.6.2 Done installing documentation for bundler after 1 seconds 1 gem installed [root@Red www]# bundle install --without development test postgresql sqlite 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. Fetching gem metadata from https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Installing rake 10.1.1 [...skipped...] Using rmagick 2.13.2 Your bundle is complete! Gems in the groups development, test, postgresql and sqlite were not installed. Use `bundle show [gemname]` to see where a bundled gem is installed. Post-install message from rdoc: Depending on your version of ruby, you may need to install ruby rdoc/ri data: <= 1.8.6 : unsupported = 1.8.7 : gem install rdoc-data; rdoc-data --install = 1.9.1 : gem install rdoc-data; rdoc-data --install >= 1.9.2 : nothing to do! Yay! [root@Red www]# 

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

In my case, the first time did not go smoothly, but such actions decided a slight hitch.
 [root@Red www]# rake generate_session_store --trace rake aborted! Gem::LoadError: You have already activated rake 10.3.1, but your Gemfile requires rake 10.1.1. Prepending `bundle exec` to your command may solve this. /usr/local/lib/ruby/gems/2.1.0/gems/bundler-1.6.2/lib/bundler/runtime.rb:34:in `block in setup' [...skipped...] 


In my case, I need rake 10.1.1 and an extra 10.3.1. Check:
 [root@Red ~]# gem list rake *** LOCAL GEMS *** rake (10.3.1, 10.1.1, 10.1.0) [root@Red ~]# gem uninstall rake -v 10.3.1 Successfully uninstalled rake-10.3.1 [root@Red ~]# gem uninstall rake -v 10.3.1 list rake -r *** LOCAL GEMS *** rake (10.1.1, 10.1.0) [root@Red ~]# 

Install the MySQL module for Ruby.
 [root@Red www]# gem install mysql Fetching: mysql-2.9.1.gem Fetching: mysql-2.9.1.gem (100%) Building native extensions. This could take a while... Successfully installed mysql-2.9.1 Parsing documentation for mysql-2.9.1 Installing ri documentation for mysql-2.9.1 Done installing documentation for mysql after 0 seconds 1 gem installed [root@Red www]# whereis ruby ruby: /usr/src/ruby-2.1.2/ruby.o /usr/src/ruby-2.1.2/ruby.c /usr/src/ruby-2.1.2/ruby /usr/local/bin/ruby /usr/local/lib/ruby [root@Red www]# cd /usr/local/lib/ryuby/gems/2.1.0/gems/mysql-2.9.1 [root@Red mysql-2.9.1]# whereis mysql_config mysql_config: /usr/bin/mysql_config /usr/share/man/man1/mysql_config.1.gz [root@Red mysql-2.9.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 creating Makefile [root@Red mysql-2.9.1]# 


Next, you need to build and install the package, but as a rule there will be an error when compiling, and then you need to tweak the Makefile a little bit - clearly set the paths
those. do this way:
 SRCS = mysql.c OBJS = $(srcdir)/mysql.o 

And compile again, we end up with:

 [root@Red mysql-2.9.1]# make linking shared-object mysql/mysql_api.so gcc: mysql.o: No such file or directory make: *** [mysql_api.so] Error 1 [root@Red mysql-2.9.1]# make linking shared-object mysql/mysql_api.so [root@Red mysql-2.9.1]# make install /usr/bin/install -c -m 0755 mysql_api.so /usr/local/lib/ruby/site_ruby/2.1.0/x86_64-linux/mysql installing default mysql_api libraries [root@Red mysql-2.9.1]# cd /var/www/redmine/www/lib [root@Red lib]# ln -s /usr/local/lib/ruby/gems/2.1.0/gems/mysql-2.9.1/lib/mysql.rb [root@Red lib]# cd ../ 


Create a database, after the second command choose ru
 [root@Red www]# rake db:migrate RAILS_ENV=production == Setup: migrating ========================================================== -- create_table("attachments", {:force=>true}) -> 0.0171s [...skipped...] == ChangeChangesetsCommentsLimit: migrated (0.0241s) ========================= [root@Red www]# [root@Red www]# rake redmine:load_default_data RAILS_ENV=production Select language: ar, az, 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. [root@Red www]# 

Deploy the RedMine code. Taking into account the fact that there may be a number of other WWW services on the server and they will work as under Apache and / or nginx
then put in the correct directory / var / www / redmine
 [root@Red src]# tar xzvf redmine-2.5.1.tar.gz [root@Red src]# mv redmine-2.5.1 /var/www/redmine 


The Apache server itself is already installed, we will write it into autoload and launch
 [root@Red www]# chkconfig --level 345 httpd on [root@Red www]# service httpd start Starting httpd: [root@Red www]# service httpd restart Stopping httpd: [ OK ] Starting httpd: [ OK ] [root@Red www]# 


After that, go to 127.0.0.1 or what is your IP there and check the operation of the start page.

It is advisable to make a link in this directory to the Apache configuration directory, which will then allow you not to run through heaps of directories)
 [root@Red www]# ln -s /etc/httpd /var/www/httpd 


configure Apache to work with virtual hosts - /etc/httpd/conf.d/vhosts.conf
 # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for all requests that do not # match a ServerName or ServerAlias in any block. # NameVirtualHost *:80 ServerAdmin admin@redmine DocumentRoot /var/www/redmine/www/public ServerName redmine ServerAlias www.redmine RailsEnv production RailsBaseURI /redmine # <Directory "/var/www/redmine/www/public/"> # Options Indexes ExecCGI FollowSymLinks # Order allow,deny # Allow from all # AllowOverride all # ErrorLog /var/www/redmine/error.log CustomLog /var/www/redmine/access.log common # # ServerAdmin admin@glpi # DocumentRoot /var/www/glpi/www # ServerName glpi # ServerAlias www.glpi # ErrorLog /var/www/glpi/error.log # CustomLog /var/www/glpi/access.log common # 

we will add a binding of the name to the ip on the local host - this will allow walks by name to this host.
 10.30.10.104 redmine 


Change owner to directory:
 [root@Red redmine]# pwd /var/www/redmine [root@Red redmine]# ls access.log error.log www [root@Red redmine]# chown -R apache:apache www [root@Red redmine]# chmod -R 755 www 


All after this, check RedMine's work,

if everything was done according to my script, the result will be appreciated:
RedMine start page
After this we tune the rest:
 [root@Red www]# gem list imagemagick --all -r *** REMOTE GEMS *** imagemagick-binaries (6.8.7.5.1) imagemagick-identify (0.0.1) [root@Red www]# gem list imagemagick --all *** LOCAL GEMS *** 

 [root@Red src]# gem install imagemagick-binaries Fetching: ffi-1.9.3.gem (100%) Building native extensions. This could take a while... Successfully installed ffi-1.9.3 Fetching: sys-uname-0.9.0.gem (100%) Successfully installed sys-uname-0.9.0 Fetching: imagemagick-binaries-6.8.7.5.1.gem (100%) imagemagick-binaries's executable "convert" conflicts with /usr/local/bin/convert Overwrite the executable? [yN] y imagemagick-binaries's executable "identify" conflicts with /usr/local/bin/identify Overwrite the executable? [yN] y Successfully installed imagemagick-binaries-6.8.7.5.1 Parsing documentation for ffi-1.9.3 Installing ri documentation for ffi-1.9.3 Parsing documentation for imagemagick-binaries-6.8.7.5.1 Installing ri documentation for imagemagick-binaries-6.8.7.5.1 Parsing documentation for sys-uname-0.9.0 Installing ri documentation for sys-uname-0.9.0 Done installing documentation for ffi, imagemagick-binaries, sys-uname after 7 seconds 3 gems installed [root@Red src]# gem install imagemagick-identify Fetching: imagemagick-identify-0.0.1.gem (100%) Successfully installed imagemagick-identify-0.0.1 Parsing documentation for imagemagick-identify-0.0.1 Installing ri documentation for imagemagick-identify-0.0.1 Done installing documentation for imagemagick-identify after 0 seconds 1 gem installed [root@Red src]# 


As you can see, ideally, it was working with the ImageMagick source code version 6.8.7.5.1, but still you need to make a number of settings so that Redmine is ticked and not an exclamation mark.
As a result, the best option is to install ImageMagick from the usual repository - it installs a number of dependent libraries
 [root@Red www]# yum install ImageMagick Loaded plugins: downloadonly, fastestmirror, security, verify Loading mirror speeds from cached hostfile Setting up Install Process Resolving Dependencies --> Running transaction check [...skipped...] Dependencies Resolved ================================================================================================================================== Package Arch Version Repository Size ================================================================================================================================== Installing: ImageMagick x86_64 6.5.4.7-7.el6_5 updates 1.7 M Installing for dependencies: GConf2 x86_64 2.28.0-6.el6 base 964 k ORBit2 x86_64 2.14.17-3.2.el6_3 base 168 k OpenEXR-libs x86_64 1.6.1-8.1.el6 base 197 k ilmbase x86_64 1.0.1-6.1.el6 base 72 k libIDL x86_64 0.8.13-2.1.el6 base 83 k libcroco x86_64 0.6.2-5.el6 base 100 k libgsf x86_64 1.14.15-5.el6 base 116 k librsvg2 x86_64 2.26.0-6.el6_5.3 updates 140 k libwmf-lite x86_64 0.2.8.4-22.el6.centos base 51 k sgml-common noarch 0.6.3-32.el6 base 43 k Transaction Summary ================================================================================================================================== Install 11 Package(s) [...skipped...] 

And only then can the versions be updated on top, although you can leave it as it is.

If the line “Catalog of module resources is available for writing” stands with an exclamation mark, then we do this:
 [root@Red www]# mkdir public/plugin_assets [root@Red www]# chown -R apache:apache public/plugin_assets [root@Red www]# chmod -R 755 files log tmp public/plugin_assets 


After everything works under apache - we will configure work under nginx.
Of course, it is possible to have different bundles in which on the status one and on the dynamics of the other, many options - I stopped at pure nginx We
do everything under our existing universal directory structure with sites.

In the epel repository, the version of nginx 1.0.15 although there is already 1.7.0, but the passenger works exactly with 1.6.0.

To do this, stop and disable Apache:
 [root@Red conf]# service httpd stop Stopping httpd: [ OK ] [root@Red conf]# chkconfig httpd off [root@Red conf]# chkconfig --list httpd httpd 0:off1:off2:off3:off4:off5:off6:off [root@Red conf]# 


Install passenger under nginx, and select the 1st installation method,
specifying the installation path of nginx as default / usr / local / nginx
 [root@Red conf]# passenger-install-nginx-module Welcome to the Phusion Passenger Nginx module installer, v4.0.42. This installer will guide you through the entire installation process. It shouldn't take more than 5 minutes in total. Here's what you can expect from the installation process: 1. This installer will compile and install Nginx with Passenger support. 2. You'll learn how to configure Passenger in Nginx. 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. [...skipped...] -------------------------------------------- Nginx with Passenger support was successfully installed. Please edit your Nginx configuration file (probably /usr/local/nginx/conf/nginx.conf), and set the passenger_root and passenger_ruby configuration options in the 'http' block, like this: http { ... passenger_root /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42; passenger_ruby /usr/local/bin/ruby; ... } After you (re)start Nginx, you are ready to deploy any number of web applications on Nginx. Press ENTER to continue. -------------------------------------------- Deploying a web application: an example Suppose you have a web application in /somewhere. Add a server block to your Nginx configuration file, set its root to /somewhere/public, and set 'passenger_enabled on', like this: server { listen 80; server_name www.yourhost.com; root /somewhere/public; # And that's it! You may also want to check the Users Guide for security and optimization tips and other useful information: /usr/local/lib/ruby/gems/2.1.0/gems/passenger-4.0.42/doc/Users guide Nginx.html http://www.modrails.com/documentation/Users%20guide%20Nginx.html Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-) https://www.phusionpassenger.com Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. [root@Red conf]# 

Create a link to nginx in the / var / www directory
 [root@Red www]# ln -s /usr/local/nginx /var/www/nginx 


And correct it as follows nginx.conf
 user nginx; worker_processes 1; error_log /var/log/nginx/error.log warn; pid /var/run/nginx.pid; events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on; tcp_nopush on; keepalive_timeout 65; server_tokens off; reset_timedout_connection on; output_buffers 1 64k; tcp_nodelay on; log_not_found off; gzip on; gzip_vary on; gzip_min_length 2048; gzip_comp_level 5; gzip_http_version 1.0; gzip_proxied any; gzip_disable "msie6"; gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript; client_max_body_size 30m; large_client_header_buffers 4 8k; include /etc/nginx/conf/*.conf; passenger_root /usr/local/lib/ruby/gems/1.9.1/gems/passenger-4.0.37; passenger_ruby /usr/local/bin/ruby; server { listen 80; server_name redmine redmine.domain.com; charset koi8-r; access_log /var/www/redmine/access.log main; error_log /var/www/redmine/error.log warn; passenger_enabled on; passenger_min_instances 1; rails_spawn_method smart; rails_env production; client_max_body_size 15m; # allow all; root /var/www/redmine/www/public; ## Disable viewing .htaccess & .htpassword location ~ /\.ht { deny all; } } } 

After that we put nginx in autoload
 [root@Red conf]# chkconfig nginx on [root@Red conf]# chkconfig --list nginx nginx 0:off1:off2:off3:off4:off5:off6:off [root@Red conf]# 

All, now we have a fully working bundle of nginx + redmine.

Although you can manually install the latest version of nginx:
 [root@Red src]# wget http://nginx.org/download/nginx-1.7.0.tar.gz [root@Red src]# tar zxvf nginx-1.7.0.tar.gz [root@Red src]# cd nginx-1.7.0 [root@Red nginx-1.7.0]# ./configure --without-http_rewrite_module checking for OS + Linux 2.6.32-431.17.1.el6.x86_64 x86_64 checking for C compiler ... found + using GNU C compiler + gcc version: 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) checking for gcc -pipe switch ... found [...skipped...] creating objs/Makefile Configuration summary + PCRE library is not used + OpenSSL library is not used + md5: using system crypto library + sha1: using system crypto library + using system zlib library nginx path prefix: "/usr/local/nginx" nginx binary file: "/usr/local/nginx/sbin/nginx" nginx configuration prefix: "/usr/local/nginx/conf" nginx configuration file: "/usr/local/nginx/conf/nginx.conf" nginx pid file: "/usr/local/nginx/logs/nginx.pid" nginx error log file: "/usr/local/nginx/logs/error.log" nginx http access log file: "/usr/local/nginx/logs/access.log" nginx http client request body temporary files: "client_body_temp" nginx http proxy temporary files: "proxy_temp" nginx http fastcgi temporary files: "fastcgi_temp" nginx http uwsgi temporary files: "uwsgi_temp" nginx http scgi temporary files: "scgi_temp" [root@Red nginx-1.7.0]# make [root@Red nginx-1.7.0]# make install make -f objs/Makefile install make[1]: Entering directory `/usr/src/nginx-1.7.0' test -d '/usr/local/nginx' || mkdir -p '/usr/local/nginx' test -d '/usr/local/nginx/sbin' || mkdir -p '/usr/local/nginx/sbin' test ! -f '/usr/local/nginx/sbin/nginx' || mv '/usr/local/nginx/sbin/nginx' '/usr/local/nginx/sbin/nginx.old' cp objs/nginx '/usr/local/nginx/sbin/nginx' test -d '/usr/local/nginx/conf' || mkdir -p '/usr/local/nginx/conf' cp conf/koi-win '/usr/local/nginx/conf' cp conf/koi-utf '/usr/local/nginx/conf' cp conf/win-utf '/usr/local/nginx/conf' test -f '/usr/local/nginx/conf/mime.types' || cp conf/mime.types '/usr/local/nginx/conf' cp conf/mime.types '/usr/local/nginx/conf/mime.types.default' test -f '/usr/local/nginx/conf/fastcgi_params' || cp conf/fastcgi_params '/usr/local/nginx/conf' cp conf/fastcgi_params '/usr/local/nginx/conf/fastcgi_params.default' test -f '/usr/local/nginx/conf/fastcgi.conf' || cp conf/fastcgi.conf '/usr/local/nginx/conf' cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default' test -f '/usr/local/nginx/conf/uwsgi_params' || cp conf/uwsgi_params '/usr/local/nginx/conf' cp conf/uwsgi_params '/usr/local/nginx/conf/uwsgi_params.default' test -f '/usr/local/nginx/conf/scgi_params' || cp conf/scgi_params '/usr/local/nginx/conf' cp conf/scgi_params '/usr/local/nginx/conf/scgi_params.default' test -f '/usr/local/nginx/conf/nginx.conf' || cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf' cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' test -d '/usr/local/nginx/html' || cp -R html '/usr/local/nginx' test -d '/usr/local/nginx/logs' || mkdir -p '/usr/local/nginx/logs' make[1]: Leaving directory `/usr/src/nginx-1.7.0' [root@Red nginx-1.7.0]# 

Also, do not forget to set 777 permissions on all tmp subfolders - this will allow for example to preview attached files.
 [root@Red www]# chmod -R 777 files log tmp tmp/cache public/plugin_assets 

RedMine info page

All these configuration files can be downloaded here .

Source: https://habr.com/ru/post/225667/


All Articles